user1130906
user1130906

Reputation: 101

servletengine Unable to send back last chunk: Software caused connection abort: socket write error

I have created a bundle for the class com.xxx.cq.wcm.foundation.profile.impl.TnailImages from the foundation file com.day.cq.wcm.foundation.profile.impl.ProfileImages.

Here are the changes I made ot this class

  1. width and height for the default foundation class ProfileImages to have our own default width and height in TnailImages.

  2. selectors changed to our own like

    • @scr.property name="sling.servlet.selectors" values.0="adjust"

    • values.1="adjust.small"

  3. Variable changed to private static final String THUMBNAIL = "small";

  4. Metatype annotation won't compile for CQ5.5 I changed this * @scr.component metatype="false"

    to

    • @Component(immediate = true)

This bundle compiled successfully and I see it in OSGi felix console, it is in start mode. Even then I did a restart of this bundle as well as whole CQ5.

When I call an image using the following tag

there are no spases anywhere

the servlet ThumbNailImages is not being call, I see the following error in error.log

servletengine Unable to send back last chunk: Software caused connection abort: socket write error

this image is not being displayed in the page, firebug displays failed to load URL

Default img works fine

Class com.day.cq.wcm.foundation.profile.impl.ProfileImages is available in

/libs/foundation/src/impl/src/main/java/com/day/cq/wcm/foundation/profile/impl/ProfileImages.java

Here are my annotations

 * @Component(immediate = true)
 * @scr.service
 * @scr.property name="sling.servlet.resourceTypes" value="nt:file"
 * @scr.property name="sling.servlet.extensions" values.0="res"
 *                          values.1="jpg"
 *                          values.2="png"
 *                          values.3="gif"
 * @scr.property name="sling.servlet.selectors" values.0="adjust"
 *                                              values.1="adjust.small"
 */

It seems that this servlet is not being called, when I invoke http://xyz.com:4502/content/dam/geometrixx/portraits/scott_reynolds.jpg.adjust.small.jpg I am getting 404 Cannot serve request to /content/dam/geometrixx/portraits/scott_reynolds.jpg.adjust.small.jpg in org.apache.sling.servlets.get.DefaultGetServlet

3 (2013-05-20 11:02:40) TIMER_END{2,resolveServlet(JcrNodeResource, type=dam:Asset, superType=null, path=/content/dam/geometrixx/portraits/scott_reynolds.jpg)} Using servlet com.day.cq.dam.core.impl.servlet.BinaryProviderServlet 3 (2013-05-20 11:02:40) TIMER_END{2,ServletResolution} URI=/content/dam/geometrixx/portraits/scott_reynolds.jpg.adjust.small.jpg handled by Servlet=com.day.cq.dam.core.impl.servlet.BinaryProviderServlet

It seems that my Servlet TnailImages is not being called, it is always going to default servlet.

Upvotes: 0

Views: 1138

Answers (1)

Bertrand Delacretaz
Bertrand Delacretaz

Reputation: 6100

If your servlet is not being called, you should first verify that it is correctly registered as an OSGi Servlet service, via the /system/console/components and /system/console/services webconsole pages. Verify also that the service properties are what you think.

It that's ok you can use the recent requests console page at /system/console/requests to see how Sling resolves a test request and which Servlet or script it selects to process it.

Last resort is to set DEBUG log level and watch the log for messages from the SlingServletResolver class.

In your case the problem is probably that the resource type of the scott_reynolds.jpg resource that you're accessing is not nt:file, on a vanilla CQ5.5 system that demo image has the dam:Asset resource type. The /system/console/requests page will show you that anyway.

Upvotes: 0

Related Questions