ICEfaces
  1. ICEfaces
  2. ICE-985

ServletContext.getResource("/") sometimes returns null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6DR#6, 1.6
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      Noted in forum: http://www.icefaces.org/JForum/posts/list/0/2828.page#13738

      Apparently, in a non-exploded war file, getResource("/") in an unexploded war
      returns null, and web app startup fails:

       Dear Icesoft.
      We found and confirmed a bug concerning Icefaces component.

      Environment: Weblogic 8.1sp3 on Solaris, J2se 1.4

      If we deploy the timezone2.war exploded, it works.

      If we deploy timezone2.war as a not exploded war, it deploy but loading webapp
      brokes:

      Stacktrace:
      java.lang.NullPointerException
      at com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet.service(Unknown Source)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at
      weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
      at
      weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:312)
      at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:150)
      at jsp_servlet.__index._jspService(__index.java:124)
      at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
      at
      weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:463)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
      at
      weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
      at
      weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
      at
      weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
      at
      weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
      at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
      at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

        Activity

        Hide
        Deryk Sinotte added a comment -

        I'm changing the summary of this problem since it is not limited to WebLogic.

        In getting ICEfaces to run on SAP's NetWeaver, it turns out that the ServletContext.getResource("/") call we use to seed the IdGenerator also returns "null" on that application server. In fact, any resource that is a directory appears to return null. For the call to return something useful, it needs to resolve to an actual physical file. For example, the following resources returned null:

        /
        /WEB-INF
        /WEB-INF/

        but by changing them to point at actual files the call returned valid URLs:

        /index.jsp
        /WEB-INF/web.xml

        So I'd recommend two things:

        1) Leave the current logic the way it is (since it works most of the time and won't dramatically impact our current code) but add some additional logic that tries to find a known resource (like /WEB-INF/web.xml).

        2) Add some useful logging statements as this was particularly hard to track down on NetWeaver.

        Show
        Deryk Sinotte added a comment - I'm changing the summary of this problem since it is not limited to WebLogic. In getting ICEfaces to run on SAP's NetWeaver, it turns out that the ServletContext.getResource("/") call we use to seed the IdGenerator also returns "null" on that application server. In fact, any resource that is a directory appears to return null. For the call to return something useful, it needs to resolve to an actual physical file. For example, the following resources returned null: / /WEB-INF /WEB-INF/ but by changing them to point at actual files the call returned valid URLs: /index.jsp /WEB-INF/web.xml So I'd recommend two things: 1) Leave the current logic the way it is (since it works most of the time and won't dramatically impact our current code) but add some additional logic that tries to find a known resource (like /WEB-INF/web.xml). 2) Add some useful logging statements as this was particularly hard to track down on NetWeaver.
        Hide
        Deryk Sinotte added a comment -

        I've checked in some more robust logic and added a bit of logging when getting an application specific resource. Marking as FIXED.

        Show
        Deryk Sinotte added a comment - I've checked in some more robust logic and added a bit of logging when getting an application specific resource. Marking as FIXED.

          People

          • Assignee:
            Unassigned
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: