You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Brian Mauter (JIRA)" <de...@myfaces.apache.org> on 2007/02/20 17:02:06 UTC

[jira] Commented: (TOMAHAWK-699) the statement causes a NPE

    [ https://issues.apache.org/jira/browse/TOMAHAWK-699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474478 ] 

Brian Mauter commented on TOMAHAWK-699:
---------------------------------------

Hi, I'm getting the same kind of error, and I think I might be able to provide some insight.  Maybe not.  :)

We have a HttpSessionListener that tries to keep track of the number of sessions so that we can license our software for however many users.  This listener also has a JSF action called authenticate.

We've found that when a web app is reloaded, the faces session is still alive, but all of the contents of the session objects are invalid.  Faces probably gives us a good session, but we have to invalidate it anyway.  We then ask Faces for a new session.

I'm not sure, but I believe ExtensionsFilter has already gotten a reference to a session before my action was called.  I then invalidate it and later ExtensionsFilter finishes up and tries to use that session reference, only it's invalidated.  The resource ID is then null when it writes out the css <link> tag such that it looks like:  null/header.css.  The resource loader comes in and parses for the first "/" and converts it to a Long (StreamingResourceLoader, lines 43-44):
                int pos = resourceUri.indexOf("/");
                Long requestId = new Long(Long.parseLong(resourceUri.substring(0, pos), 10));

The quick fix for this would be to wrap the parsing in a try/catch in case it's not numeric.  If it's not put a warning in your logs and return.

The bigger fix is to find out why after a reload the sessions are still alive.  This was happening 1.1.3 and is still happening in 1.1.5.

Thanks,
-Brian

> the statement <t:documentHead> causes a NPE
> -------------------------------------------
>
>                 Key: TOMAHAWK-699
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-699
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.3
>         Environment: Tomcat 5.5.17, windows, myfaces-1.1.4
>            Reporter: Thomas Wabner
>         Attachments: grollmus.jsp, web.xml
>
>
> I'am new to myFaces and using a *minimal standard* configuration. All what I want is to display a simple "hello world" using the tomahwak <t:documentHead> and body stuff. I have configured the extention filter similar as it is described on the myFaces homepage. I got following output, if I start tomcat:
> 25.09.2006 12:02:00 org.apache.coyote.http11.Http11AprProtocol init
> INFO: Initializing Coyote HTTP/1.1 on http-8080
> 25.09.2006 12:02:00 org.apache.coyote.ajp.AjpAprProtocol init
> INFO: Initializing Coyote AJP/1.3 on ajp-8009
> 25.09.2006 12:02:00 org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 672 ms
> 25.09.2006 12:02:01 org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 25.09.2006 12:02:01 org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/5.5.17
> 25.09.2006 12:02:01 org.apache.catalina.core.StandardHost start
> INFO: XML validation disabled
> 25.09.2006 12:02:01 org.apache.myfaces.config.FacesConfigurator feedStandardConfig
> INFO: Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
> 25.09.2006 12:02:01 org.apache.myfaces.config.FacesConfigurator feedClassloaderConfigurations
> INFO: Reading config jar:file:/C:/Projects/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/webapps/spice-jom/WEB-INF/lib/tomahawk-1.1.3.jar!/META-INF/faces-config.xml
> 25.09.2006 12:02:01 org.apache.myfaces.config.FacesConfigurator feedWebAppConfig
> INFO: Reading config /WEB-INF/faces-config.xml
> 25.09.2006 12:02:01 org.apache.myfaces.shared_impl.util.LocaleUtils toLocale
> WARNUNG: Locale name in faces-config.xml null or empty, setting locale to default locale : de_DE
> 25.09.2006 12:02:02 org.apache.myfaces.webapp.StartupServletContextListener initFaces
> INFO: ServletContext 'C:\Projects\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\webapps\spice-jom\' initialized.
> 25.09.2006 12:02:02 org.apache.myfaces.webapp.StartupServletContextListener handleSerialFactory
> INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
> 25.09.2006 12:02:02 org.apache.myfaces.config.FacesConfigurator feedStandardConfig
> INFO: Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
> 25.09.2006 12:02:02 org.apache.myfaces.config.FacesConfigurator feedClassloaderConfigurations
> INFO: Reading config jar:file:/C:/Projects/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/webapps/spice-jom/WEB-INF/lib/tomahawk-1.1.3.jar!/META-INF/faces-config.xml
> 25.09.2006 12:02:02 org.apache.myfaces.config.FacesConfigurator feedWebAppConfig
> INFO: Reading config /WEB-INF/faces-config.xml
> 25.09.2006 12:02:02 org.apache.myfaces.shared_impl.util.LocaleUtils toLocale
> WARNUNG: Locale name in faces-config.xml null or empty, setting locale to default locale : de_DE
> 25.09.2006 12:02:03 org.apache.myfaces.webapp.StartupServletContextListener initFaces
> INFO: ServletContext 'C:\Projects\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\webapps\spice-jom\' initialized.
> 25.09.2006 12:02:03 org.apache.myfaces.webapp.StartupServletContextListener handleSerialFactory
> INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
> 25.09.2006 12:02:03 org.apache.coyote.http11.Http11AprProtocol start
> INFO: Starting Coyote HTTP/1.1 on http-8080
> 25.09.2006 12:02:03 org.apache.coyote.ajp.AjpAprProtocol start
> INFO: Starting Coyote AJP/1.3 on ajp-8009
> 25.09.2006 12:02:03 org.apache.catalina.storeconfig.StoreLoader load
> INFO: Find registry server-registry.xml at classpath resource
> 25.09.2006 12:02:03 org.apache.catalina.startup.Catalina start
> INFO: Server startup in 2375 ms
> 25.09.2006 12:02:06 org.apache.myfaces.shared_tomahawk.config.MyfacesConfig getBooleanInitParameter
> INFO: No context init parameter 'org.apache.myfaces.CHECK_EXTENSIONS_FILTER' found, using default value true
> 25.09.2006 12:02:06 org.apache.myfaces.shared_impl.config.MyfacesConfig getBooleanInitParameter
> INFO: No context init parameter 'org.apache.myfaces.CHECK_EXTENSIONS_FILTER' found, using default value true
> 25.09.2006 12:02:06 org.apache.myfaces.component.html.util.StreamingAddResource serveResource
> After invoking my simple jsp site I got from tomcat:
> SCHWERWIEGEND: Error while serving resource: null/header.css, message : For input string: "null"
> java.lang.NumberFormatException: For input string: "null"
> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> 	at java.lang.Long.parseLong(Long.java:403)
> 	at org.apache.myfaces.component.html.util.StreamingResourceLoader.serveResource(StreamingResourceLoader.java:25)
> 	at org.apache.myfaces.component.html.util.StreamingAddResource.serveResource(StreamingAddResource.java:755)
> 	at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:125)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> 	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
> 	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
> 	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
> 	at java.lang.Thread.run(Thread.java:595)
> If I have a look at the created document I see like this:
> <HEAD>
> 		<LINK type="text/css" href="/spice-jom/faces/myFacesExtensionResource/org.apache.myfaces.component.html.util.StreamingResourceLoader/11591785/null/header.css" rel="stylesheet"/>
> </HEAD>
> But I don't know how the /null/ is coming in.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.