[ 
http://issues.apache.org/jira/browse/MYFACES-630?page=comments#action_12331359 
] 

Thomas Timbul commented on MYFACES-630:
---------------------------------------

Please note that if only the api jar is placed in the container, the problem 
does not occur, but it means that myfaces-impl.jar has to be in every webapp 
that needs it (useless duplication)

You can easily reproduce this yourself by installing a fresh container (or 
emptying an existing one) and dump to stdout. I use Resin 3.0.14, so the log is 
as below. Note that the ROOT context it is trying to load is empty and only 
contains an index.jsp. All subsequent contexts fail to complete initialisation. 
Both myfaces-api and myfaces-impl jars are in container classpath.

Log & Trace:

Starting Resin on Wed, 05 Oct 2005 09:17:25 +0100 (BST)

[09:17:27.812] Server[] starting
[09:17:27.875] http listening to *:8080
[09:17:27.906] hmux listening to localhost:6802
[09:17:28.078] Host[] starting
[09:17:28.296] WebApp[http://localhost:8080] starting
log4j:WARN No appenders could be found for logger 
(org.apache.myfaces.webapp.StartupServletContextListener).
log4j:WARN Please initialize the log4j system properly.

javax.faces.FacesException: java.lang.NullPointerException
        at 
org.apache.myfaces.webapp.webxml.WebXmlParser.parse(WebXmlParser.java:105)
        at org.apache.myfaces.webapp.webxml.WebXml.init(WebXml.java:135)
        at 
org.apache.myfaces.webapp.StartupServletContextListener.initFaces(StartupServletContextListener.java:66)
        at 
org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:46)
        at 
com.caucho.server.webapp.Application.addListenerObject(Application.java:1032)
        at com.caucho.jsp.cfg.TldListener.register(TldListener.java:72)
        at com.caucho.jsp.cfg.TldPreload.init(TldPreload.java:147)
        at com.caucho.jsp.TldManager.parseTldPreload(TldManager.java:686)
        at com.caucho.jsp.TldManager.parseTldPreload(TldManager.java:631)
        at com.caucho.jsp.TldManager.loadJarTlds(TldManager.java:408)
        at com.caucho.jsp.TldManager.loadClassPathTlds(TldManager.java:291)
        at com.caucho.jsp.TldManager.init(TldManager.java:201)
        at com.caucho.jsp.TldManager.create(TldManager.java:123)
        at com.caucho.jsp.JspManager.<init>(JspManager.java:84)
        at com.caucho.jsp.JspServlet.init(JspServlet.java:71)
        at 
com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:599)
        at 
com.caucho.server.dispatch.ServletManager.init(ServletManager.java:152)
        at com.caucho.server.webapp.Application.start(Application.java:1546)
        at 
com.caucho.server.deploy.DeployController.startImpl(DeployController.java:563)
        at 
com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAutoRedeployAutoStrategy.java:72)
        at 
com.caucho.server.deploy.DeployController.startOnInit(DeployController.java:451)
        at 
com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:157)
        at 
com.caucho.server.webapp.ApplicationContainer.start(ApplicationContainer.java:610)
        at com.caucho.server.host.Host.start(Host.java:385)
        at 
com.caucho.server.deploy.DeployController.startImpl(DeployController.java:563)
        at 
com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAutoRedeployAutoStrategy.java:72)
        at 
com.caucho.server.deploy.DeployController.startOnInit(DeployController.java:451)
        at 
com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:157)
        at com.caucho.server.host.HostContainer.start(HostContainer.java:468)
        at com.caucho.server.resin.ServletServer.start(ServletServer.java:934)
        at 
com.caucho.server.deploy.DeployController.startImpl(DeployController.java:563)
        at 
com.caucho.server.deploy.AbstractDeployControllerStrategy.start(AbstractDeployControllerStrategy.java:56)
        at 
com.caucho.server.deploy.DeployController.start(DeployController.java:459)
        at com.caucho.server.resin.ResinServer.start(ResinServer.java:465)
        at com.caucho.server.resin.Resin.init(Resin.java)
        at com.caucho.server.resin.Resin.main(Resin.java:612)
Caused by: java.lang.NullPointerException
        at com.caucho.xml.AbstractParser.parseDocument(AbstractParser.java:810)
        at 
com.caucho.xml.parsers.AbstractDocumentBuilder.parse(AbstractDocumentBuilder.java:63)
        at 
org.apache.myfaces.webapp.webxml.WebXmlParser.parse(WebXmlParser.java:89)
        ... 35 more

> StartupServletContextListener should ignore missing web.xml
> -----------------------------------------------------------
>
>          Key: MYFACES-630
>          URL: http://issues.apache.org/jira/browse/MYFACES-630
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: 1.1.0
>  Environment: any proper J2EE container
>     Reporter: Thomas Timbul
>     Assignee: Martin Marinschek
>     Priority: Critical

>
> When myfaces is placed on the container classpath, the Startup Listener is 
> called for each web application.
> The listener fails (crashes and does not recover) with a NPE if the 
> application does not have a web.xml file, although this is a perfectly legal 
> J2EE configuration (e.g. html only web-app).
> Correct behaviour would be to ignore (skip) a context if no web.xml file can 
> be found.
> Although I have no patch, it should be easy to fix by adding a simple check 
> for whether the file is found or not before passing it to the xml parser.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to