3 Replies Latest reply on Feb 4, 2013 5:45 AM by u005078

    Servlet sample "navimage.png.java" from CQ5-Docu "How to get fully featured Website" does not work.

    u005078 Level 1

      When working on the sample described in "How to create a fully featured Website", I got an error in the part "Creating the Top Navigation Component". I have discussed this at the page itself (see the comments there) and in the sling mailing list. I was told,  this forum would be the best place to find a solution. So I will ask the remaining question here:


      The sample uses a servlet "navimage.png.java" to create dynamically top navigation buttons with a meaningful text displayed.


      We have got a node "/content/mywebsite/en/products" (there are more, but it is easier to explain when focusing on one of them) with jcr:primaryType=cq:Page with childnode jcr:content with the property sling:resourceType=mywebsite/components/contentpage.

      The path "/apps/mywebsite/components/contentpage" contains a node body.jsp. The request http://localhost:4502//content/mywebsite/en/products.html renders the node /apps/mywebsite/components/contentpage/body.jsp.

      The body.jsp includes another jsp "topnav.jsp" which refers to /content/mywebsite/en/products.navimage.png by the expression "src="<%= child.getPath() %>.navimage.png"></a><%".

      The servlet "navimage.png.java" has been placed to /apps/mywebsite/components/contentpage/navimage.png.java. See inserted screenshot for the layout.


      When issuing the request, none of the expected buttons is displayed. The "Recent Requests"-tab at the OSGi-Console shows a whole bunch of message requests.


      The "GET customers.navimage.png", "GET services.navimage.png" and "GET products.navimage.png" tell me, that the request has been resolved (excerpt from the messages):

        10 (2013-02-01 15:45:18) LOG Including resource JcrNodeResource, type=mywebsite/components/contentpage, superType=null, path=/content/mywebsite/en/products/jcr:content (SlingRequestPathInfo: path='/content/mywebsite/en/products/jcr:content',  selectorString='navimage', extension='png', suffix='null')

           10 (2013-02-01 15:45:18) TIMER_START{resolveServlet(JcrNodeResource, type=mywebsite/components/contentpage, superType=null, path=/content/mywebsite/en/products/jcr:content)}

           10 (2013-02-01 15:45:18) TIMER_END{0,resolveServlet(JcrNodeResource, type=mywebsite/components/contentpage, superType=null, path=/content/mywebsite/en/products/jcr:content)} Using servlet /apps/mywebsite/components/contentpage/navimage.png.java

           10 (2013-02-01 15:45:18) LOG Applying Includefilters


      But the "GET navimage.png" does not find anything:

        10 (2013-02-01 16:08:06) TIMER_END{10,ResourceResolution} URI=/apps/mywebsite/components/contentpage/navimage.png resolves to Resource=NonExistingResource, path=/apps/mywebsite/components/contentpage/navimage.png

           10 (2013-02-01 16:08:06) LOG Resource Path Info: SlingRequestPathInfo: path='/apps/mywebsite/components/contentpage/navimage.png', selectorString='null', extension='png', suffix='null'

           10 (2013-02-01 16:08:06) TIMER_START{ServletResolution}

           10 (2013-02-01 16:08:06) TIMER_START{resolveServlet(NonExistingResource, path=/apps/mywebsite/components/contentpage/navimage.png)}

           10 (2013-02-01 16:08:06) LOG {0}: no servlet found


      So the servlet has been detected. Why isn't it displayed. When I place a real picture in the path (navimage.png) the sample works fine.

      - What can I do to detect the cause of the error

      - When becomes the servlet compiled and where is the class-file stored?


      Thank you for your support.