You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Trumml <Ma...@systema.info> on 2007/04/27 15:43:58 UTC

Access to context of HTTP session

I want to access the HTTP session inside of a backing bean.
I use jboss-4.0.5 and the attached war file: 
http://www.nabble.com/file/8109/ce.tests.war ce.tests.war 
But FacesContext.getCurrentInstance() always returns null :-(

Can anyone give me some help?

-- 
View this message in context: http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
Damn, I forgot to add the java files to the war file... :-(
Now the war file contains the source (but I deleted the lib files to
minimize the file size).
http://www.nabble.com/file/8123/ce.tests.war ce.tests.war 


Mike Kienenberger wrote:
> 
> We need to see source code, not jar files.
> 
> On 4/28/07, Trumml <Ma...@systema.info> wrote:
>>
>> That's why I added the war file
>> [http://www.nabble.com/file/8109/ce.tests.war
>> ce.tests.war] which is deployed correctly in JBoss...
>>
>> Part of the jboss ouput:
>> 14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound
>> ConnectionManager
>> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'jav
>> a:JmsXA'
>> 14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
>> warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
>> 14:08:46,687 INFO  [FacesConfigurator] Reading standard config
>> org/apache/myfaces/resource/standard-faces-config.xml
>> 14:08:46,796 INFO  [FacesConfigurator] Reading config
>> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
>> 14:08:47,015 INFO  [FacesConfigurator] Reading config
>> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
>> 14:08:47,437 INFO  [FacesConfigurator] Reading config
>> /WEB-INF/faces-config.xml
>> 14:08:56,937 INFO  [StartupServletContextListener] ServletContext
>> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
>> initialize
>> d.
>> 14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
>> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
>> initialized.
>> 14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
>> warUrl=.../deploy/jmx-console.war/
>> 14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
>> http-0.0.0.0-8080
>> 14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
>> 14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
>> 14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
>> CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
>> 14:09:13,140 INFO  [tests]] No state saving method defined, assuming
>> default
>> server state saving
>> 14:09:13,453 INFO  [STDOUT] Using bean id 1
>> 14:09:13,453 INFO  [STDOUT] context is null!
>> 14:09:13,453 INFO  [STDOUT] Duke's number: 7
>> 14:09:13,468 INFO  [STDOUT] context is null!
>>
>>
>> Mike Kienenberger wrote:
>> >
>> > I'm assuming you're asking why your backing bean code isn't being
>> > called from inside the JSF lifecycle.
>> >
>> > I don't know.  You haven't provided any information about what code is
>> > being called or how.
>> >
>> >
>> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
>> >>
>> >> Well, thanks for the fast answer but what do you mean by "executing
>> >> external
>> >> to JSF"?
>> >> Why isn't my backing bean inside the JSF lifecycle?
>> >>
>> >>
>> >> Mike Kienenberger wrote:
>> >> >
>> >> > I'm changing this to the users@myfaces mailing list.   The dev list
>> is
>> >> > for working on the MyFaces source code.
>> >> >
>> >> > FacesContext.getCurrentInstance() is only non-null during the JSF
>> >> > lifecycle.
>> >> > Apparently you're executing your backing bean code external to JSF.
>> >> >
>> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
>> >> >>
>> >> >> I want to access the HTTP session inside of a backing bean.
>> >> >> I use jboss-4.0.5 and the attached war file:
>> >> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
>> >> >> But FacesContext.getCurrentInstance() always returns null :-(
>> >> >>
>> >> >> Can anyone give me some help?
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
>> >> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10233941
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
We need to see source code, not jar files.

On 4/28/07, Trumml <Ma...@systema.info> wrote:
>
> That's why I added the war file [http://www.nabble.com/file/8109/ce.tests.war
> ce.tests.war] which is deployed correctly in JBoss...
>
> Part of the jboss ouput:
> 14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager
> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'jav
> a:JmsXA'
> 14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
> warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
> 14:08:46,687 INFO  [FacesConfigurator] Reading standard config
> org/apache/myfaces/resource/standard-faces-config.xml
> 14:08:46,796 INFO  [FacesConfigurator] Reading config
> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
> 14:08:47,015 INFO  [FacesConfigurator] Reading config
> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
> 14:08:47,437 INFO  [FacesConfigurator] Reading config
> /WEB-INF/faces-config.xml
> 14:08:56,937 INFO  [StartupServletContextListener] ServletContext
> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> initialize
> d.
> 14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> initialized.
> 14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
> warUrl=.../deploy/jmx-console.war/
> 14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
> http-0.0.0.0-8080
> 14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
> 14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
> 14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
> CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
> 14:09:13,140 INFO  [tests]] No state saving method defined, assuming default
> server state saving
> 14:09:13,453 INFO  [STDOUT] Using bean id 1
> 14:09:13,453 INFO  [STDOUT] context is null!
> 14:09:13,453 INFO  [STDOUT] Duke's number: 7
> 14:09:13,468 INFO  [STDOUT] context is null!
>
>
> Mike Kienenberger wrote:
> >
> > I'm assuming you're asking why your backing bean code isn't being
> > called from inside the JSF lifecycle.
> >
> > I don't know.  You haven't provided any information about what code is
> > being called or how.
> >
> >
> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >>
> >> Well, thanks for the fast answer but what do you mean by "executing
> >> external
> >> to JSF"?
> >> Why isn't my backing bean inside the JSF lifecycle?
> >>
> >>
> >> Mike Kienenberger wrote:
> >> >
> >> > I'm changing this to the users@myfaces mailing list.   The dev list is
> >> > for working on the MyFaces source code.
> >> >
> >> > FacesContext.getCurrentInstance() is only non-null during the JSF
> >> > lifecycle.
> >> > Apparently you're executing your backing bean code external to JSF.
> >> >
> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >> >>
> >> >> I want to access the HTTP session inside of a backing bean.
> >> >> I use jboss-4.0.5 and the attached war file:
> >> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
> >> >> But FacesContext.getCurrentInstance() always returns null :-(
> >> >>
> >> >> Can anyone give me some help?
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
> >> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
I don't know, maybe I'm wrong.

org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
20:00:33,680 ERROR [STDERR]     at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)

Unfortunately, I don't really do anything with JSP (I use facelets) so
I can't probably be of much more help.

On 4/28/07, Mike Kienenberger <mk...@gmail.com> wrote:
> Oops.  You're right.  I didn't see this inside the huge posting you had before.
>
> Looks to me like it's happening from the jsp servlet and not the JSF servlet.
>
> Are you  using the wrong url to access the file?  I think the correct
> one would be along the lines of <context>/guess/greeting.jsp?
>
>
> On 4/28/07, Trumml <Ma...@systema.info> wrote:
> >
> > Thank's for the example, I will take a look at it.
> > The stack trace is from the recommended code modification! But here is it
> > again with another stack trace:
> >
> > First invocation:
> > 20:00:33,680 INFO  [STDOUT] context is null!
> > 20:00:33,680 ERROR [STDERR] java.lang.Exception: Stack trace
> > 20:00:33,680 ERROR [STDERR]     at
> > java.lang.Thread.dumpStack(Thread.java:1158)
> > 20:00:33,680 ERROR [STDERR]     at
> > at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> > 20:00:33,680 ERROR [STDERR]     at
> > at.co.systema.ce.tests.view.UserNumberBean.<init>(UserNumberBean.java:31)
> > 20:00:33,680 ERROR [STDERR]     at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> > 20:00:33,680 ERROR [STDERR]     at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> > 20:00:33,680 ERROR [STDERR]     at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> > 20:00:33,680 ERROR [STDERR]     at
> > java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> > 20:00:33,680 ERROR [STDERR]     at
> > java.lang.Class.newInstance0(Class.java:350)
> > 20:00:33,680 ERROR [STDERR]     at
> > java.lang.Class.newInstance(Class.java:303)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:250)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:241)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:40)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:292)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:558)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:65)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspx_meth_h_outputText_0(greeting_jsp.java:204)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:156)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > 20:00:33,680 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,680 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> > 20:00:33,695 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> > 20:00:33,695 ERROR [STDERR]     at
> > org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> > 20:00:33,695 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
> >
> > Stack trace after pressing a button:
> > 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
> > 20:00:33,789 ERROR [STDERR]     at
> > java.lang.Thread.dumpStack(Thread.java:1158)
> > 20:00:33,789 ERROR [STDERR]     at
> > at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> > 20:00:33,789 ERROR [STDERR]     at
> > at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
> > 20:00:33,789 ERROR [STDERR]     at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > 20:00:33,789 ERROR [STDERR]     at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > 20:00:33,789 ERROR [STDERR]     at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > 20:00:33,789 ERROR [STDERR]     at
> > java.lang.reflect.Method.invoke(Method.java:585)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> > 20:00:33,789 ERROR [STDERR]     at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> > 20:00:33,789 ERROR [STDERR]     at
> > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> > 20:00:33,805 ERROR [STDERR]     at
> > org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> > 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
> >
> >
> >
> >
> > If you really want to get a FacesContext inside a servlet filter, try
> > this approach.
> >
> > It's worked fine for me.  Just remember to free the FacesContext when
> > you're done with it.
> >
> > http://www.thoughtsabout.net/blog/archives/000033.html
> >
> > The stack trace you posted is something else.  It's not from the code
> > modification I recommended for tracking the problem down.
> > --
> > View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236399
> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >
> >
>

Re: Access to context of HTTP session

Posted by Bruno Aranda <br...@gmail.com>.
And what if you try?

http://localhost:8080/ce.tests/guess/greeting.jsf

Bruno

On 28/04/07, Trumml <Ma...@systema.info> wrote:
>
> I guess I'm using the correct URL:
> http://localhost:8080/ce.tests/guess/greeting.jsp
> And the servlet(-mapping) in my web.xml look okay for me...
> I have NO idea what could be wrong and also the jboss homepage gave me no
> clue  http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces
> http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces .
>
>
> Mike Kienenberger wrote:
> >
> > Oops.  You're right.  I didn't see this inside the huge posting you had
> > before.
> >
> > Looks to me like it's happening from the jsp servlet and not the JSF
> > servlet.
> >
> > Are you  using the wrong url to access the file?  I think the correct
> > one would be along the lines of <context>/guess/greeting.jsp?
> >
> >
> > On 4/28/07, Trumml <Ma...@systema.info> wrote:
> >>
> >> Thank's for the example, I will take a look at it.
> >> The stack trace is from the recommended code modification! But here is it
> >> again with another stack trace:
> >>
> >> First invocation:
> >> 20:00:33,680 INFO  [STDOUT] context is null!
> >> 20:00:33,680 ERROR [STDERR] java.lang.Exception: Stack trace
> >> 20:00:33,680 ERROR [STDERR]     at
> >> java.lang.Thread.dumpStack(Thread.java:1158)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> at.co.systema.ce.tests.view.UserNumberBean.<init>(UserNumberBean.java:31)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> java.lang.Class.newInstance0(Class.java:350)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> java.lang.Class.newInstance(Class.java:303)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:250)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:241)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:40)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:292)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:558)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:65)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_h_outputText_0(greeting_jsp.java:204)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:156)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,680 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >> 20:00:33,695 ERROR [STDERR]     at
> >> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> >> 20:00:33,695 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
> >>
> >> Stack trace after pressing a button:
> >> 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
> >> 20:00:33,789 ERROR [STDERR]     at
> >> java.lang.Thread.dumpStack(Thread.java:1158)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> java.lang.reflect.Method.invoke(Method.java:585)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> >> 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
> >>
> >>
> >>
> >>
> >> If you really want to get a FacesContext inside a servlet filter, try
> >> this approach.
> >>
> >> It's worked fine for me.  Just remember to free the FacesContext when
> >> you're done with it.
> >>
> >> http://www.thoughtsabout.net/blog/archives/000033.html
> >>
> >> The stack trace you posted is something else.  It's not from the code
> >> modification I recommended for tracking the problem down.
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236399
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236627
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
Well, after reading 
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces  again I
noticed the following:
If you don't remove the JSF RI libraries from your WEB-INF/lib then you
might get strange errors like No faces context?!
Awkward, that's it....



Trumml wrote:
> 
> I guess I'm using the correct URL:
> http://localhost:8080/ce.tests/guess/greeting.jsp
> And the servlet(-mapping) in my web.xml look okay for me...
> I have NO idea what could be wrong and also the jboss homepage gave me no
> clue  http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces
> http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces .
> 
> 
> Mike Kienenberger wrote:
>> 
>> Oops.  You're right.  I didn't see this inside the huge posting you had
>> before.
>> 
>> Looks to me like it's happening from the jsp servlet and not the JSF
>> servlet.
>> 
>> Are you  using the wrong url to access the file?  I think the correct
>> one would be along the lines of <context>/guess/greeting.jsp?
>> 
>> 
>> On 4/28/07, Trumml <Ma...@systema.info> wrote:
>>>
>>> Thank's for the example, I will take a look at it.
>>> The stack trace is from the recommended code modification! But here is
>>> it
>>> again with another stack trace:
>>>
>>> First invocation:
>>> 20:00:33,680 INFO  [STDOUT] context is null!
>>> 20:00:33,680 ERROR [STDERR] java.lang.Exception: Stack trace
>>> 20:00:33,680 ERROR [STDERR]     at
>>> java.lang.Thread.dumpStack(Thread.java:1158)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> at.co.systema.ce.tests.view.UserNumberBean.<init>(UserNumberBean.java:31)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> java.lang.Class.newInstance0(Class.java:350)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> java.lang.Class.newInstance(Class.java:303)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:250)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:241)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:40)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:292)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:558)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:65)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspx_meth_h_outputText_0(greeting_jsp.java:204)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:156)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,680 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>>> 20:00:33,695 ERROR [STDERR]     at
>>> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>>> 20:00:33,695 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>>>
>>> Stack trace after pressing a button:
>>> 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
>>> 20:00:33,789 ERROR [STDERR]     at
>>> java.lang.Thread.dumpStack(Thread.java:1158)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> java.lang.reflect.Method.invoke(Method.java:585)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>>> 20:00:33,789 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>>> 20:00:33,805 ERROR [STDERR]     at
>>> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>>> 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>>>
>>>
>>>
>>>
>>> If you really want to get a FacesContext inside a servlet filter, try
>>> this approach.
>>>
>>> It's worked fine for me.  Just remember to free the FacesContext when
>>> you're done with it.
>>>
>>> http://www.thoughtsabout.net/blog/archives/000033.html
>>>
>>> The stack trace you posted is something else.  It's not from the code
>>> modification I recommended for tracking the problem down.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236399
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236656
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
I guess I'm using the correct URL:
http://localhost:8080/ce.tests/guess/greeting.jsp
And the servlet(-mapping) in my web.xml look okay for me...
I have NO idea what could be wrong and also the jboss homepage gave me no
clue  http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces .


Mike Kienenberger wrote:
> 
> Oops.  You're right.  I didn't see this inside the huge posting you had
> before.
> 
> Looks to me like it's happening from the jsp servlet and not the JSF
> servlet.
> 
> Are you  using the wrong url to access the file?  I think the correct
> one would be along the lines of <context>/guess/greeting.jsp?
> 
> 
> On 4/28/07, Trumml <Ma...@systema.info> wrote:
>>
>> Thank's for the example, I will take a look at it.
>> The stack trace is from the recommended code modification! But here is it
>> again with another stack trace:
>>
>> First invocation:
>> 20:00:33,680 INFO  [STDOUT] context is null!
>> 20:00:33,680 ERROR [STDERR] java.lang.Exception: Stack trace
>> 20:00:33,680 ERROR [STDERR]     at
>> java.lang.Thread.dumpStack(Thread.java:1158)
>> 20:00:33,680 ERROR [STDERR]     at
>> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
>> 20:00:33,680 ERROR [STDERR]     at
>> at.co.systema.ce.tests.view.UserNumberBean.<init>(UserNumberBean.java:31)
>> 20:00:33,680 ERROR [STDERR]     at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> 20:00:33,680 ERROR [STDERR]     at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> 20:00:33,680 ERROR [STDERR]     at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> 20:00:33,680 ERROR [STDERR]     at
>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>> 20:00:33,680 ERROR [STDERR]     at
>> java.lang.Class.newInstance0(Class.java:350)
>> 20:00:33,680 ERROR [STDERR]     at
>> java.lang.Class.newInstance(Class.java:303)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:250)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:241)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:40)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:292)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:558)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:65)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_h_outputText_0(greeting_jsp.java:204)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:156)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>> 20:00:33,680 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,680 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>> 20:00:33,695 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>> 20:00:33,695 ERROR [STDERR]     at
>> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>> 20:00:33,695 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>>
>> Stack trace after pressing a button:
>> 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
>> 20:00:33,789 ERROR [STDERR]     at
>> java.lang.Thread.dumpStack(Thread.java:1158)
>> 20:00:33,789 ERROR [STDERR]     at
>> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
>> 20:00:33,789 ERROR [STDERR]     at
>> at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
>> 20:00:33,789 ERROR [STDERR]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 20:00:33,789 ERROR [STDERR]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 20:00:33,789 ERROR [STDERR]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 20:00:33,789 ERROR [STDERR]     at
>> java.lang.reflect.Method.invoke(Method.java:585)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>> 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>>
>>
>>
>>
>> If you really want to get a FacesContext inside a servlet filter, try
>> this approach.
>>
>> It's worked fine for me.  Just remember to free the FacesContext when
>> you're done with it.
>>
>> http://www.thoughtsabout.net/blog/archives/000033.html
>>
>> The stack trace you posted is something else.  It's not from the code
>> modification I recommended for tracking the problem down.
>> --
>> View this message in context:
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236399
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236627
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
Oops.  You're right.  I didn't see this inside the huge posting you had before.

Looks to me like it's happening from the jsp servlet and not the JSF servlet.

Are you  using the wrong url to access the file?  I think the correct
one would be along the lines of <context>/guess/greeting.jsp?


On 4/28/07, Trumml <Ma...@systema.info> wrote:
>
> Thank's for the example, I will take a look at it.
> The stack trace is from the recommended code modification! But here is it
> again with another stack trace:
>
> First invocation:
> 20:00:33,680 INFO  [STDOUT] context is null!
> 20:00:33,680 ERROR [STDERR] java.lang.Exception: Stack trace
> 20:00:33,680 ERROR [STDERR]     at
> java.lang.Thread.dumpStack(Thread.java:1158)
> 20:00:33,680 ERROR [STDERR]     at
> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> 20:00:33,680 ERROR [STDERR]     at
> at.co.systema.ce.tests.view.UserNumberBean.<init>(UserNumberBean.java:31)
> 20:00:33,680 ERROR [STDERR]     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 20:00:33,680 ERROR [STDERR]     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 20:00:33,680 ERROR [STDERR]     at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 20:00:33,680 ERROR [STDERR]     at
> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> 20:00:33,680 ERROR [STDERR]     at
> java.lang.Class.newInstance0(Class.java:350)
> 20:00:33,680 ERROR [STDERR]     at
> java.lang.Class.newInstance(Class.java:303)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:250)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:241)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:40)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:292)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:558)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> 20:00:33,680 ERROR [STDERR]     at
> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:65)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
> 20:00:33,680 ERROR [STDERR]     at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> 20:00:33,680 ERROR [STDERR]     at
> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> 20:00:33,680 ERROR [STDERR]     at
> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_h_outputText_0(greeting_jsp.java:204)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:156)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> 20:00:33,680 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> 20:00:33,680 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> 20:00:33,680 ERROR [STDERR]     at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> 20:00:33,680 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,680 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> 20:00:33,695 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,695 ERROR [STDERR]     at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> 20:00:33,695 ERROR [STDERR]     at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> 20:00:33,695 ERROR [STDERR]     at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> 20:00:33,695 ERROR [STDERR]     at
> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> 20:00:33,695 ERROR [STDERR]     at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> 20:00:33,695 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>
> Stack trace after pressing a button:
> 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
> 20:00:33,789 ERROR [STDERR]     at
> java.lang.Thread.dumpStack(Thread.java:1158)
> 20:00:33,789 ERROR [STDERR]     at
> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> 20:00:33,789 ERROR [STDERR]     at
> at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
> 20:00:33,789 ERROR [STDERR]     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 20:00:33,789 ERROR [STDERR]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 20:00:33,789 ERROR [STDERR]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 20:00:33,789 ERROR [STDERR]     at
> java.lang.reflect.Method.invoke(Method.java:585)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> 20:00:33,789 ERROR [STDERR]     at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> 20:00:33,789 ERROR [STDERR]     at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> 20:00:33,805 ERROR [STDERR]     at
> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>
>
>
>
> If you really want to get a FacesContext inside a servlet filter, try
> this approach.
>
> It's worked fine for me.  Just remember to free the FacesContext when
> you're done with it.
>
> http://www.thoughtsabout.net/blog/archives/000033.html
>
> The stack trace you posted is something else.  It's not from the code
> modification I recommended for tracking the problem down.
> --
> View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236399
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
Thank's for the example, I will take a look at it.
The stack trace is from the recommended code modification! But here is it
again with another stack trace:

First invocation:
20:00:33,680 INFO  [STDOUT] context is null!
20:00:33,680 ERROR [STDERR] java.lang.Exception: Stack trace
20:00:33,680 ERROR [STDERR]     at
java.lang.Thread.dumpStack(Thread.java:1158)
20:00:33,680 ERROR [STDERR]     at
at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
20:00:33,680 ERROR [STDERR]     at
at.co.systema.ce.tests.view.UserNumberBean.<init>(UserNumberBean.java:31)
20:00:33,680 ERROR [STDERR]     at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
20:00:33,680 ERROR [STDERR]     at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
20:00:33,680 ERROR [STDERR]     at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
20:00:33,680 ERROR [STDERR]     at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
20:00:33,680 ERROR [STDERR]     at
java.lang.Class.newInstance0(Class.java:350)
20:00:33,680 ERROR [STDERR]     at
java.lang.Class.newInstance(Class.java:303)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:250)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:241)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:40)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:292)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:558)
20:00:33,680 ERROR [STDERR]     at
org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
20:00:33,680 ERROR [STDERR]     at
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
20:00:33,680 ERROR [STDERR]     at
javax.faces.component.UIOutput.getValue(UIOutput.java:75)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:65)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
20:00:33,680 ERROR [STDERR]     at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
20:00:33,680 ERROR [STDERR]     at
javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
20:00:33,680 ERROR [STDERR]     at
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
20:00:33,680 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_h_outputText_0(greeting_jsp.java:204)
20:00:33,680 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:156)
20:00:33,680 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
20:00:33,680 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
20:00:33,680 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
20:00:33,680 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
20:00:33,680 ERROR [STDERR]     at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
20:00:33,680 ERROR [STDERR]     at
org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
20:00:33,680 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
20:00:33,680 ERROR [STDERR]     at
org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
20:00:33,680 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,680 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
20:00:33,695 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
20:00:33,695 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
20:00:33,695 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,695 ERROR [STDERR]     at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
20:00:33,695 ERROR [STDERR]     at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
20:00:33,695 ERROR [STDERR]     at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
20:00:33,695 ERROR [STDERR]     at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
20:00:33,695 ERROR [STDERR]     at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
20:00:33,695 ERROR [STDERR]     at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
20:00:33,695 ERROR [STDERR]     at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
20:00:33,695 ERROR [STDERR]     at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
20:00:33,695 ERROR [STDERR]     at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
20:00:33,695 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)

Stack trace after pressing a button:
20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
20:00:33,789 ERROR [STDERR]     at
java.lang.Thread.dumpStack(Thread.java:1158)
20:00:33,789 ERROR [STDERR]     at
at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
20:00:33,789 ERROR [STDERR]     at
at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
20:00:33,789 ERROR [STDERR]     at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
20:00:33,789 ERROR [STDERR]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
20:00:33,789 ERROR [STDERR]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
20:00:33,789 ERROR [STDERR]     at
java.lang.reflect.Method.invoke(Method.java:585)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
20:00:33,789 ERROR [STDERR]     at
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
20:00:33,789 ERROR [STDERR]     at
javax.faces.component.UIOutput.getValue(UIOutput.java:75)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
20:00:33,789 ERROR [STDERR]     at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
20:00:33,789 ERROR [STDERR]     at
javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
20:00:33,789 ERROR [STDERR]     at
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
20:00:33,789 ERROR [STDERR]     at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
20:00:33,789 ERROR [STDERR]     at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
20:00:33,789 ERROR [STDERR]     at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
20:00:33,805 ERROR [STDERR]     at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
20:00:33,805 ERROR [STDERR]     at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
20:00:33,805 ERROR [STDERR]     at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
20:00:33,805 ERROR [STDERR]     at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
20:00:33,805 ERROR [STDERR]     at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)




If you really want to get a FacesContext inside a servlet filter, try
this approach.

It's worked fine for me.  Just remember to free the FacesContext when
you're done with it.

http://www.thoughtsabout.net/blog/archives/000033.html

The stack trace you posted is something else.  It's not from the code
modification I recommended for tracking the problem down.
-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236399
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
If you really want to get a FacesContext inside a servlet filter, try
this approach.

It's worked fine for me.  Just remember to free the FacesContext when
you're done with it.

http://www.thoughtsabout.net/blog/archives/000033.html

The stack trace you posted is something else.  It's not from the code
modification I recommended for tracking the problem down.


On 4/28/07, Trumml <Ma...@systema.info> wrote:
>
> I tried to implement the filter from the following resource (but I only did
> this to see if I can access the context inside the filter):
> http://marcchung.com/2005/01/24/performing-a-jsf-get-2/
> http://marcchung.com/2005/01/24/performing-a-jsf-get-2/
> But looking at the stacktrace below can you tell me why
> FacesContext.getCurrentInstance() returns null inside my backing bean?
>
>
>
> Mike Kienenberger wrote:
> >
> > There is no FacesConfig available in a servlet filter.   It's only
> > availble inside of the Faces Servlet.
> >
> >
> > On 4/28/07, Trumml <Ma...@systema.info> wrote:
> >>
> >> Well...
> >> 1) I wanted to see what happens, if I add a Filter, but the following
> >> code
> >> throws an exception:
> >> FacesContextFactory contextFactory =
> >> (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
> >>
> >> 21:04:22,358 ERROR [[jsp]] Servlet.service() for servlet jsp threw
> >> exception
> >> java.lang.IllegalStateException: No Factories configured for this
> >> Application. This happens if the faces-initialization does not work at
> >> all -
> >> make su
> >> re that you properly include all configuration settings necessary for a
> >> basic faces application and that all the necessary libs are included.
> >> Also
> >> che
> >> ck the logging output of your web application and your container for any
> >> exceptions!
> >> If you did that and find nothing, the mistake might be due to the fact
> >> that
> >> you use some special web-containers which do not support registering
> >> conte
> >> xt-listeners via TLD files and a context listener is not setup in your
> >> web.xml.
> >> A typical config looks like this;
> >> <listener>
> >>
> >> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
> >> </listener>
> >>
> >>         at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
> >>         at
> >> at.co.systema.ce.tests.jsf.core.filter.JSFGet.getFacesContext(JSFGet.java:76)
> >>         at
> >> at.co.systema.ce.tests.jsf.core.filter.JSFGet.doFilter(JSFGet.java:42)
> >>         at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >>         at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >>         at
> >> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> >>         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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> >>         at
> >> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> >>         at
> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >>         at
> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >>         at
> >> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> >>         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.Http11Processor.process(Http11Processor.java:869)
> >>         at
> >> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> >>         at
> >> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >>         at
> >> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> >>         at java.lang.Thread.run(Thread.java:595)
> >>
> >> 2) Here is the stacktrace when the context is null:
> >> 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
> >> 20:00:33,789 ERROR [STDERR]     at
> >> java.lang.Thread.dumpStack(Thread.java:1158)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> java.lang.reflect.Method.invoke(Method.java:585)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> >> 20:00:33,789 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >> 20:00:33,805 ERROR [STDERR]     at
> >> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> >> 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
> >>
> >>
> >> Mike Kienenberger wrote:
> >> >
> >> > That's kinda odd.
> >> >
> >> > Try this:
> >> >
> >> >
> >> >     private void _hasContext()
> >> >     {
> >> >         FacesContext context = FacesContext.getCurrentInstance();
> >> >         if (context != null)
> >> >         {
> >> >             HttpSession session =
> >> > (HttpSession)context.getExternalContext().getSession(false);
> >> >             System.out.println("session id = " + session.getId());
> >> >         }
> >> >         else
> >> >         {
> >> >             new Exception("context is null!").printStackTrace();
> >> >         }
> >> >     }
> >> >
> >> > Let's find out what's going on when this is called.
> >> >
> >> > On 4/28/07, Trumml <Ma...@systema.info> wrote:
> >> >>
> >> >> That's why I added the war file
> >> >> [http://www.nabble.com/file/8109/ce.tests.war
> >> >> ce.tests.war] which is deployed correctly in JBoss...
> >> >>
> >> >> Part of the jboss ouput:
> >> >> 14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound
> >> >> ConnectionManager
> >> >> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name
> >> 'jav
> >> >> a:JmsXA'
> >> >> 14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
> >> >> warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
> >> >> 14:08:46,687 INFO  [FacesConfigurator] Reading standard config
> >> >> org/apache/myfaces/resource/standard-faces-config.xml
> >> >> 14:08:46,796 INFO  [FacesConfigurator] Reading config
> >> >>
> >> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
> >> >> 14:08:47,015 INFO  [FacesConfigurator] Reading config
> >> >>
> >> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
> >> >> 14:08:47,437 INFO  [FacesConfigurator] Reading config
> >> >> /WEB-INF/faces-config.xml
> >> >> 14:08:56,937 INFO  [StartupServletContextListener] ServletContext
> >> >>
> >> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> >> >> initialize
> >> >> d.
> >> >> 14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
> >> >>
> >> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> >> >> initialized.
> >> >> 14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
> >> >> warUrl=.../deploy/jmx-console.war/
> >> >> 14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
> >> >> http-0.0.0.0-8080
> >> >> 14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on
> >> /0.0.0.0:8009
> >> >> 14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
> >> >> 14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
> >> >> CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
> >> >> 14:09:13,140 INFO  [tests]] No state saving method defined, assuming
> >> >> default
> >> >> server state saving
> >> >> 14:09:13,453 INFO  [STDOUT] Using bean id 1
> >> >> 14:09:13,453 INFO  [STDOUT] context is null!
> >> >> 14:09:13,453 INFO  [STDOUT] Duke's number: 7
> >> >> 14:09:13,468 INFO  [STDOUT] context is null!
> >> >>
> >> >>
> >> >> Mike Kienenberger wrote:
> >> >> >
> >> >> > I'm assuming you're asking why your backing bean code isn't being
> >> >> > called from inside the JSF lifecycle.
> >> >> >
> >> >> > I don't know.  You haven't provided any information about what code
> >> is
> >> >> > being called or how.
> >> >> >
> >> >> >
> >> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >> >> >>
> >> >> >> Well, thanks for the fast answer but what do you mean by "executing
> >> >> >> external
> >> >> >> to JSF"?
> >> >> >> Why isn't my backing bean inside the JSF lifecycle?
> >> >> >>
> >> >> >>
> >> >> >> Mike Kienenberger wrote:
> >> >> >> >
> >> >> >> > I'm changing this to the users@myfaces mailing list.   The dev
> >> list
> >> >> is
> >> >> >> > for working on the MyFaces source code.
> >> >> >> >
> >> >> >> > FacesContext.getCurrentInstance() is only non-null during the JSF
> >> >> >> > lifecycle.
> >> >> >> > Apparently you're executing your backing bean code external to
> >> JSF.
> >> >> >> >
> >> >> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >> >> >> >>
> >> >> >> >> I want to access the HTTP session inside of a backing bean.
> >> >> >> >> I use jboss-4.0.5 and the attached war file:
> >> >> >> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
> >> >> >> >> But FacesContext.getCurrentInstance() always returns null :-(
> >> >> >> >>
> >> >> >> >> Can anyone give me some help?
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >> >>
> >> >>
> >> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
> >> >> >> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
> >> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10235833
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236300
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
I tried to implement the filter from the following resource (but I only did
this to see if I can access the context inside the filter): 
http://marcchung.com/2005/01/24/performing-a-jsf-get-2/
http://marcchung.com/2005/01/24/performing-a-jsf-get-2/  
But looking at the stacktrace below can you tell me why
FacesContext.getCurrentInstance() returns null inside my backing bean?



Mike Kienenberger wrote:
> 
> There is no FacesConfig available in a servlet filter.   It's only
> availble inside of the Faces Servlet.
> 
> 
> On 4/28/07, Trumml <Ma...@systema.info> wrote:
>>
>> Well...
>> 1) I wanted to see what happens, if I add a Filter, but the following
>> code
>> throws an exception:
>> FacesContextFactory contextFactory =
>> (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
>>
>> 21:04:22,358 ERROR [[jsp]] Servlet.service() for servlet jsp threw
>> exception
>> java.lang.IllegalStateException: No Factories configured for this
>> Application. This happens if the faces-initialization does not work at
>> all -
>> make su
>> re that you properly include all configuration settings necessary for a
>> basic faces application and that all the necessary libs are included.
>> Also
>> che
>> ck the logging output of your web application and your container for any
>> exceptions!
>> If you did that and find nothing, the mistake might be due to the fact
>> that
>> you use some special web-containers which do not support registering
>> conte
>> xt-listeners via TLD files and a context listener is not setup in your
>> web.xml.
>> A typical config looks like this;
>> <listener>
>>
>> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
>> </listener>
>>
>>         at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
>>         at
>> at.co.systema.ce.tests.jsf.core.filter.JSFGet.getFacesContext(JSFGet.java:76)
>>         at
>> at.co.systema.ce.tests.jsf.core.filter.JSFGet.doFilter(JSFGet.java:42)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>         at
>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>>         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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>>         at
>> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>>         at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>>         at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>>         at
>> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>>         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.Http11Processor.process(Http11Processor.java:869)
>>         at
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>>         at
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>>         at
>> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>>         at java.lang.Thread.run(Thread.java:595)
>>
>> 2) Here is the stacktrace when the context is null:
>> 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
>> 20:00:33,789 ERROR [STDERR]     at
>> java.lang.Thread.dumpStack(Thread.java:1158)
>> 20:00:33,789 ERROR [STDERR]     at
>> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
>> 20:00:33,789 ERROR [STDERR]     at
>> at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
>> 20:00:33,789 ERROR [STDERR]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 20:00:33,789 ERROR [STDERR]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 20:00:33,789 ERROR [STDERR]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 20:00:33,789 ERROR [STDERR]     at
>> java.lang.reflect.Method.invoke(Method.java:585)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>> 20:00:33,789 ERROR [STDERR]     at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>> 20:00:33,789 ERROR [STDERR]     at
>> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>> 20:00:33,805 ERROR [STDERR]     at
>> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>> 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>>
>>
>> Mike Kienenberger wrote:
>> >
>> > That's kinda odd.
>> >
>> > Try this:
>> >
>> >
>> >     private void _hasContext()
>> >     {
>> >         FacesContext context = FacesContext.getCurrentInstance();
>> >         if (context != null)
>> >         {
>> >             HttpSession session =
>> > (HttpSession)context.getExternalContext().getSession(false);
>> >             System.out.println("session id = " + session.getId());
>> >         }
>> >         else
>> >         {
>> >             new Exception("context is null!").printStackTrace();
>> >         }
>> >     }
>> >
>> > Let's find out what's going on when this is called.
>> >
>> > On 4/28/07, Trumml <Ma...@systema.info> wrote:
>> >>
>> >> That's why I added the war file
>> >> [http://www.nabble.com/file/8109/ce.tests.war
>> >> ce.tests.war] which is deployed correctly in JBoss...
>> >>
>> >> Part of the jboss ouput:
>> >> 14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound
>> >> ConnectionManager
>> >> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name
>> 'jav
>> >> a:JmsXA'
>> >> 14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
>> >> warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
>> >> 14:08:46,687 INFO  [FacesConfigurator] Reading standard config
>> >> org/apache/myfaces/resource/standard-faces-config.xml
>> >> 14:08:46,796 INFO  [FacesConfigurator] Reading config
>> >>
>> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
>> >> 14:08:47,015 INFO  [FacesConfigurator] Reading config
>> >>
>> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
>> >> 14:08:47,437 INFO  [FacesConfigurator] Reading config
>> >> /WEB-INF/faces-config.xml
>> >> 14:08:56,937 INFO  [StartupServletContextListener] ServletContext
>> >>
>> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
>> >> initialize
>> >> d.
>> >> 14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
>> >>
>> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
>> >> initialized.
>> >> 14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
>> >> warUrl=.../deploy/jmx-console.war/
>> >> 14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
>> >> http-0.0.0.0-8080
>> >> 14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on
>> /0.0.0.0:8009
>> >> 14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
>> >> 14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
>> >> CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
>> >> 14:09:13,140 INFO  [tests]] No state saving method defined, assuming
>> >> default
>> >> server state saving
>> >> 14:09:13,453 INFO  [STDOUT] Using bean id 1
>> >> 14:09:13,453 INFO  [STDOUT] context is null!
>> >> 14:09:13,453 INFO  [STDOUT] Duke's number: 7
>> >> 14:09:13,468 INFO  [STDOUT] context is null!
>> >>
>> >>
>> >> Mike Kienenberger wrote:
>> >> >
>> >> > I'm assuming you're asking why your backing bean code isn't being
>> >> > called from inside the JSF lifecycle.
>> >> >
>> >> > I don't know.  You haven't provided any information about what code
>> is
>> >> > being called or how.
>> >> >
>> >> >
>> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
>> >> >>
>> >> >> Well, thanks for the fast answer but what do you mean by "executing
>> >> >> external
>> >> >> to JSF"?
>> >> >> Why isn't my backing bean inside the JSF lifecycle?
>> >> >>
>> >> >>
>> >> >> Mike Kienenberger wrote:
>> >> >> >
>> >> >> > I'm changing this to the users@myfaces mailing list.   The dev
>> list
>> >> is
>> >> >> > for working on the MyFaces source code.
>> >> >> >
>> >> >> > FacesContext.getCurrentInstance() is only non-null during the JSF
>> >> >> > lifecycle.
>> >> >> > Apparently you're executing your backing bean code external to
>> JSF.
>> >> >> >
>> >> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
>> >> >> >>
>> >> >> >> I want to access the HTTP session inside of a backing bean.
>> >> >> >> I use jboss-4.0.5 and the attached war file:
>> >> >> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
>> >> >> >> But FacesContext.getCurrentInstance() always returns null :-(
>> >> >> >>
>> >> >> >> Can anyone give me some help?
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
>> >> >> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
>> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10235833
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10236300
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
There is no FacesConfig available in a servlet filter.   It's only
availble inside of the Faces Servlet.


On 4/28/07, Trumml <Ma...@systema.info> wrote:
>
> Well...
> 1) I wanted to see what happens, if I add a Filter, but the following code
> throws an exception:
> FacesContextFactory contextFactory =
> (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
>
> 21:04:22,358 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
> java.lang.IllegalStateException: No Factories configured for this
> Application. This happens if the faces-initialization does not work at all -
> make su
> re that you properly include all configuration settings necessary for a
> basic faces application and that all the necessary libs are included. Also
> che
> ck the logging output of your web application and your container for any
> exceptions!
> If you did that and find nothing, the mistake might be due to the fact that
> you use some special web-containers which do not support registering conte
> xt-listeners via TLD files and a context listener is not setup in your
> web.xml.
> A typical config looks like this;
> <listener>
>
> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
> </listener>
>
>         at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
>         at
> at.co.systema.ce.tests.jsf.core.filter.JSFGet.getFacesContext(JSFGet.java:76)
>         at
> at.co.systema.ce.tests.jsf.core.filter.JSFGet.doFilter(JSFGet.java:42)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>         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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>         at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>         at
> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>         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.Http11Processor.process(Http11Processor.java:869)
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>         at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>         at java.lang.Thread.run(Thread.java:595)
>
> 2) Here is the stacktrace when the context is null:
> 20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
> 20:00:33,789 ERROR [STDERR]     at
> java.lang.Thread.dumpStack(Thread.java:1158)
> 20:00:33,789 ERROR [STDERR]     at
> at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
> 20:00:33,789 ERROR [STDERR]     at
> at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
> 20:00:33,789 ERROR [STDERR]     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 20:00:33,789 ERROR [STDERR]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 20:00:33,789 ERROR [STDERR]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 20:00:33,789 ERROR [STDERR]     at
> java.lang.reflect.Method.invoke(Method.java:585)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.component.UIOutput.getValue(UIOutput.java:75)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
> 20:00:33,789 ERROR [STDERR]     at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> 20:00:33,789 ERROR [STDERR]     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> 20:00:33,789 ERROR [STDERR]     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> 20:00:33,789 ERROR [STDERR]     at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
> 20:00:33,789 ERROR [STDERR]     at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> 20:00:33,805 ERROR [STDERR]     at
> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> 20:00:33,805 ERROR [STDERR]     at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> 20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
>
>
> Mike Kienenberger wrote:
> >
> > That's kinda odd.
> >
> > Try this:
> >
> >
> >     private void _hasContext()
> >     {
> >         FacesContext context = FacesContext.getCurrentInstance();
> >         if (context != null)
> >         {
> >             HttpSession session =
> > (HttpSession)context.getExternalContext().getSession(false);
> >             System.out.println("session id = " + session.getId());
> >         }
> >         else
> >         {
> >             new Exception("context is null!").printStackTrace();
> >         }
> >     }
> >
> > Let's find out what's going on when this is called.
> >
> > On 4/28/07, Trumml <Ma...@systema.info> wrote:
> >>
> >> That's why I added the war file
> >> [http://www.nabble.com/file/8109/ce.tests.war
> >> ce.tests.war] which is deployed correctly in JBoss...
> >>
> >> Part of the jboss ouput:
> >> 14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound
> >> ConnectionManager
> >> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'jav
> >> a:JmsXA'
> >> 14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
> >> warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
> >> 14:08:46,687 INFO  [FacesConfigurator] Reading standard config
> >> org/apache/myfaces/resource/standard-faces-config.xml
> >> 14:08:46,796 INFO  [FacesConfigurator] Reading config
> >> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
> >> 14:08:47,015 INFO  [FacesConfigurator] Reading config
> >> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
> >> 14:08:47,437 INFO  [FacesConfigurator] Reading config
> >> /WEB-INF/faces-config.xml
> >> 14:08:56,937 INFO  [StartupServletContextListener] ServletContext
> >> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> >> initialize
> >> d.
> >> 14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
> >> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> >> initialized.
> >> 14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
> >> warUrl=.../deploy/jmx-console.war/
> >> 14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
> >> http-0.0.0.0-8080
> >> 14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
> >> 14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
> >> 14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
> >> CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
> >> 14:09:13,140 INFO  [tests]] No state saving method defined, assuming
> >> default
> >> server state saving
> >> 14:09:13,453 INFO  [STDOUT] Using bean id 1
> >> 14:09:13,453 INFO  [STDOUT] context is null!
> >> 14:09:13,453 INFO  [STDOUT] Duke's number: 7
> >> 14:09:13,468 INFO  [STDOUT] context is null!
> >>
> >>
> >> Mike Kienenberger wrote:
> >> >
> >> > I'm assuming you're asking why your backing bean code isn't being
> >> > called from inside the JSF lifecycle.
> >> >
> >> > I don't know.  You haven't provided any information about what code is
> >> > being called or how.
> >> >
> >> >
> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >> >>
> >> >> Well, thanks for the fast answer but what do you mean by "executing
> >> >> external
> >> >> to JSF"?
> >> >> Why isn't my backing bean inside the JSF lifecycle?
> >> >>
> >> >>
> >> >> Mike Kienenberger wrote:
> >> >> >
> >> >> > I'm changing this to the users@myfaces mailing list.   The dev list
> >> is
> >> >> > for working on the MyFaces source code.
> >> >> >
> >> >> > FacesContext.getCurrentInstance() is only non-null during the JSF
> >> >> > lifecycle.
> >> >> > Apparently you're executing your backing bean code external to JSF.
> >> >> >
> >> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >> >> >>
> >> >> >> I want to access the HTTP session inside of a backing bean.
> >> >> >> I use jboss-4.0.5 and the attached war file:
> >> >> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
> >> >> >> But FacesContext.getCurrentInstance() always returns null :-(
> >> >> >>
> >> >> >> Can anyone give me some help?
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
> >> >> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10235833
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
Well...
1) I wanted to see what happens, if I add a Filter, but the following code
throws an exception:
FacesContextFactory contextFactory =
(FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);

21:04:22,358 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: No Factories configured for this
Application. This happens if the faces-initialization does not work at all -
make su
re that you properly include all configuration settings necessary for a
basic faces application and that all the necessary libs are included. Also
che
ck the logging output of your web application and your container for any
exceptions!
If you did that and find nothing, the mistake might be due to the fact that
you use some special web-containers which do not support registering conte
xt-listeners via TLD files and a context listener is not setup in your
web.xml.
A typical config looks like this;
<listener>
 
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
        at
at.co.systema.ce.tests.jsf.core.filter.JSFGet.getFacesContext(JSFGet.java:76)
        at
at.co.systema.ce.tests.jsf.core.filter.JSFGet.doFilter(JSFGet.java:42)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
        at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        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.Http11Processor.process(Http11Processor.java:869)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
        at java.lang.Thread.run(Thread.java:595)

2) Here is the stacktrace when the context is null:
20:00:33,789 ERROR [STDERR] java.lang.Exception: Stack trace
20:00:33,789 ERROR [STDERR]     at
java.lang.Thread.dumpStack(Thread.java:1158)
20:00:33,789 ERROR [STDERR]     at
at.co.systema.ce.tests.view.UserNumberBean._hasContext(UserNumberBean.java:60)
20:00:33,789 ERROR [STDERR]     at
at.co.systema.ce.tests.view.UserNumberBean.getUserNumber(UserNumberBean.java:45)
20:00:33,789 ERROR [STDERR]     at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
20:00:33,789 ERROR [STDERR]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
20:00:33,789 ERROR [STDERR]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
20:00:33,789 ERROR [STDERR]     at
java.lang.reflect.Method.invoke(Method.java:585)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:383)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:68)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:533)
20:00:33,789 ERROR [STDERR]     at
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:362)
20:00:33,789 ERROR [STDERR]     at
javax.faces.component.UIOutput.getValue(UIOutput.java:75)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:234)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49)
20:00:33,789 ERROR [STDERR]     at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:319)
20:00:33,789 ERROR [STDERR]     at
javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
20:00:33,789 ERROR [STDERR]     at
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_h_inputText_0(greeting_jsp.java:269)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_h_form_0(greeting_jsp.java:170)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspx_meth_f_view_0(greeting_jsp.java:122)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.greeting_jsp._jspService(greeting_jsp.java:87)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:225)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:299)
20:00:33,789 ERROR [STDERR]     at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
20:00:33,789 ERROR [STDERR]     at
org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:57)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
20:00:33,789 ERROR [STDERR]     at
org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
20:00:33,789 ERROR [STDERR]     at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
20:00:33,789 ERROR [STDERR]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
20:00:33,789 ERROR [STDERR]     at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
20:00:33,789 ERROR [STDERR]     at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
20:00:33,789 ERROR [STDERR]     at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
20:00:33,805 ERROR [STDERR]     at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
20:00:33,805 ERROR [STDERR]     at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
20:00:33,805 ERROR [STDERR]     at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
20:00:33,805 ERROR [STDERR]     at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
20:00:33,805 ERROR [STDERR]     at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
20:00:33,805 ERROR [STDERR]     at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
20:00:33,805 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)


Mike Kienenberger wrote:
> 
> That's kinda odd.
> 
> Try this:
> 
> 
>     private void _hasContext()
>     {
>         FacesContext context = FacesContext.getCurrentInstance();
>         if (context != null)
>         {
>             HttpSession session =
> (HttpSession)context.getExternalContext().getSession(false);
>             System.out.println("session id = " + session.getId());
>         }
>         else
>         {
>             new Exception("context is null!").printStackTrace();
>         }
>     }
> 
> Let's find out what's going on when this is called.
> 
> On 4/28/07, Trumml <Ma...@systema.info> wrote:
>>
>> That's why I added the war file
>> [http://www.nabble.com/file/8109/ce.tests.war
>> ce.tests.war] which is deployed correctly in JBoss...
>>
>> Part of the jboss ouput:
>> 14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound
>> ConnectionManager
>> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'jav
>> a:JmsXA'
>> 14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
>> warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
>> 14:08:46,687 INFO  [FacesConfigurator] Reading standard config
>> org/apache/myfaces/resource/standard-faces-config.xml
>> 14:08:46,796 INFO  [FacesConfigurator] Reading config
>> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
>> 14:08:47,015 INFO  [FacesConfigurator] Reading config
>> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
>> 14:08:47,437 INFO  [FacesConfigurator] Reading config
>> /WEB-INF/faces-config.xml
>> 14:08:56,937 INFO  [StartupServletContextListener] ServletContext
>> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
>> initialize
>> d.
>> 14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
>> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
>> initialized.
>> 14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
>> warUrl=.../deploy/jmx-console.war/
>> 14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
>> http-0.0.0.0-8080
>> 14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
>> 14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
>> 14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
>> CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
>> 14:09:13,140 INFO  [tests]] No state saving method defined, assuming
>> default
>> server state saving
>> 14:09:13,453 INFO  [STDOUT] Using bean id 1
>> 14:09:13,453 INFO  [STDOUT] context is null!
>> 14:09:13,453 INFO  [STDOUT] Duke's number: 7
>> 14:09:13,468 INFO  [STDOUT] context is null!
>>
>>
>> Mike Kienenberger wrote:
>> >
>> > I'm assuming you're asking why your backing bean code isn't being
>> > called from inside the JSF lifecycle.
>> >
>> > I don't know.  You haven't provided any information about what code is
>> > being called or how.
>> >
>> >
>> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
>> >>
>> >> Well, thanks for the fast answer but what do you mean by "executing
>> >> external
>> >> to JSF"?
>> >> Why isn't my backing bean inside the JSF lifecycle?
>> >>
>> >>
>> >> Mike Kienenberger wrote:
>> >> >
>> >> > I'm changing this to the users@myfaces mailing list.   The dev list
>> is
>> >> > for working on the MyFaces source code.
>> >> >
>> >> > FacesContext.getCurrentInstance() is only non-null during the JSF
>> >> > lifecycle.
>> >> > Apparently you're executing your backing bean code external to JSF.
>> >> >
>> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
>> >> >>
>> >> >> I want to access the HTTP session inside of a backing bean.
>> >> >> I use jboss-4.0.5 and the attached war file:
>> >> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
>> >> >> But FacesContext.getCurrentInstance() always returns null :-(
>> >> >>
>> >> >> Can anyone give me some help?
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
>> >> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10235833
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
That's kinda odd.

Try this:


    private void _hasContext()
    {
        FacesContext context = FacesContext.getCurrentInstance();
        if (context != null)
        {
            HttpSession session =
(HttpSession)context.getExternalContext().getSession(false);
            System.out.println("session id = " + session.getId());
        }
        else
        {
            new Exception("context is null!").printStackTrace();
        }
    }

Let's find out what's going on when this is called.

On 4/28/07, Trumml <Ma...@systema.info> wrote:
>
> That's why I added the war file [http://www.nabble.com/file/8109/ce.tests.war
> ce.tests.war] which is deployed correctly in JBoss...
>
> Part of the jboss ouput:
> 14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager
> 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'jav
> a:JmsXA'
> 14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
> warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
> 14:08:46,687 INFO  [FacesConfigurator] Reading standard config
> org/apache/myfaces/resource/standard-faces-config.xml
> 14:08:46,796 INFO  [FacesConfigurator] Reading config
> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
> 14:08:47,015 INFO  [FacesConfigurator] Reading config
> jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
> 14:08:47,437 INFO  [FacesConfigurator] Reading config
> /WEB-INF/faces-config.xml
> 14:08:56,937 INFO  [StartupServletContextListener] ServletContext
> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> initialize
> d.
> 14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
> 'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
> initialized.
> 14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
> warUrl=.../deploy/jmx-console.war/
> 14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
> http-0.0.0.0-8080
> 14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
> 14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
> 14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
> CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
> 14:09:13,140 INFO  [tests]] No state saving method defined, assuming default
> server state saving
> 14:09:13,453 INFO  [STDOUT] Using bean id 1
> 14:09:13,453 INFO  [STDOUT] context is null!
> 14:09:13,453 INFO  [STDOUT] Duke's number: 7
> 14:09:13,468 INFO  [STDOUT] context is null!
>
>
> Mike Kienenberger wrote:
> >
> > I'm assuming you're asking why your backing bean code isn't being
> > called from inside the JSF lifecycle.
> >
> > I don't know.  You haven't provided any information about what code is
> > being called or how.
> >
> >
> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >>
> >> Well, thanks for the fast answer but what do you mean by "executing
> >> external
> >> to JSF"?
> >> Why isn't my backing bean inside the JSF lifecycle?
> >>
> >>
> >> Mike Kienenberger wrote:
> >> >
> >> > I'm changing this to the users@myfaces mailing list.   The dev list is
> >> > for working on the MyFaces source code.
> >> >
> >> > FacesContext.getCurrentInstance() is only non-null during the JSF
> >> > lifecycle.
> >> > Apparently you're executing your backing bean code external to JSF.
> >> >
> >> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >> >>
> >> >> I want to access the HTTP session inside of a backing bean.
> >> >> I use jboss-4.0.5 and the attached war file:
> >> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
> >> >> But FacesContext.getCurrentInstance() always returns null :-(
> >> >>
> >> >> Can anyone give me some help?
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
> >> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
That's why I added the war file [http://www.nabble.com/file/8109/ce.tests.war
ce.tests.war] which is deployed correctly in JBoss...

Part of the jboss ouput:
14:08:45,234 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager
'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'jav
a:JmsXA'
14:08:46,375 INFO  [TomcatDeployer] deploy, ctxPath=/ce.tests,
warUrl=.../tmp/deploy/tmp64783ce.tests-exp.war/
14:08:46,687 INFO  [FacesConfigurator] Reading standard config
org/apache/myfaces/resource/standard-faces-config.xml
14:08:46,796 INFO  [FacesConfigurator] Reading config
jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64784.jar!/META-INF/faces-config.xml
14:08:47,015 INFO  [FacesConfigurator] Reading config
jar:file:/C:/DOKUME~1/martin6/LOKALE~1/Temp/myfaces64785.jar!/META-INF/faces-config.xml
14:08:47,437 INFO  [FacesConfigurator] Reading config
/WEB-INF/faces-config.xml
14:08:56,937 INFO  [StartupServletContextListener] ServletContext
'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
initialize
d.
14:08:56,937 INFO  [MyFacesServlet] MyFacesServlet for context
'D:\jboss-4.0.5.ga\server\default\.\tmp\deploy\tmp64783ce.tests-exp.war\'
initialized.
14:08:57,109 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console,
warUrl=.../deploy/jmx-console.war/
14:08:57,437 INFO  [Http11BaseProtocol] Starting Coyote HTTP/1.1 on
http-0.0.0.0-8080
14:08:57,609 INFO  [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
14:08:57,625 INFO  [JkMain] Jk running ID=0 time=0/47  config=null
14:08:57,625 INFO  [Server] JBoss (MX MicroKernel) [4.0.5.GA (build:
CVSTag=Branch_4_0 date=200610162339)] Started in 40s:688ms
14:09:13,140 INFO  [tests]] No state saving method defined, assuming default
server state saving
14:09:13,453 INFO  [STDOUT] Using bean id 1
14:09:13,453 INFO  [STDOUT] context is null!
14:09:13,453 INFO  [STDOUT] Duke's number: 7
14:09:13,468 INFO  [STDOUT] context is null!


Mike Kienenberger wrote:
> 
> I'm assuming you're asking why your backing bean code isn't being
> called from inside the JSF lifecycle.
> 
> I don't know.  You haven't provided any information about what code is
> being called or how.
> 
> 
> On 4/27/07, Trumml <Ma...@systema.info> wrote:
>>
>> Well, thanks for the fast answer but what do you mean by "executing
>> external
>> to JSF"?
>> Why isn't my backing bean inside the JSF lifecycle?
>>
>>
>> Mike Kienenberger wrote:
>> >
>> > I'm changing this to the users@myfaces mailing list.   The dev list is
>> > for working on the MyFaces source code.
>> >
>> > FacesContext.getCurrentInstance() is only non-null during the JSF
>> > lifecycle.
>> > Apparently you're executing your backing bean code external to JSF.
>> >
>> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
>> >>
>> >> I want to access the HTTP session inside of a backing bean.
>> >> I use jboss-4.0.5 and the attached war file:
>> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
>> >> But FacesContext.getCurrentInstance() always returns null :-(
>> >>
>> >> Can anyone give me some help?
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
>> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10232407
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
I'm assuming you're asking why your backing bean code isn't being
called from inside the JSF lifecycle.

I don't know.  You haven't provided any information about what code is
being called or how.


On 4/27/07, Trumml <Ma...@systema.info> wrote:
>
> Well, thanks for the fast answer but what do you mean by "executing external
> to JSF"?
> Why isn't my backing bean inside the JSF lifecycle?
>
>
> Mike Kienenberger wrote:
> >
> > I'm changing this to the users@myfaces mailing list.   The dev list is
> > for working on the MyFaces source code.
> >
> > FacesContext.getCurrentInstance() is only non-null during the JSF
> > lifecycle.
> > Apparently you're executing your backing bean code external to JSF.
> >
> > On 4/27/07, Trumml <Ma...@systema.info> wrote:
> >>
> >> I want to access the HTTP session inside of a backing bean.
> >> I use jboss-4.0.5 and the attached war file:
> >> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
> >> But FacesContext.getCurrentInstance() always returns null :-(
> >>
> >> Can anyone give me some help?
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
> >> Sent from the My Faces - Dev mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Access to context of HTTP session

Posted by Trumml <Ma...@systema.info>.
Well, thanks for the fast answer but what do you mean by "executing external
to JSF"?
Why isn't my backing bean inside the JSF lifecycle?


Mike Kienenberger wrote:
> 
> I'm changing this to the users@myfaces mailing list.   The dev list is
> for working on the MyFaces source code.
> 
> FacesContext.getCurrentInstance() is only non-null during the JSF
> lifecycle.
> Apparently you're executing your backing bean code external to JSF.
> 
> On 4/27/07, Trumml <Ma...@systema.info> wrote:
>>
>> I want to access the HTTP session inside of a backing bean.
>> I use jboss-4.0.5 and the attached war file:
>> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
>> But FacesContext.getCurrentInstance() always returns null :-(
>>
>> Can anyone give me some help?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
>> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-Access-to-context-of-HTTP-session-tf3657743.html#a10219687
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Access to context of HTTP session

Posted by Mike Kienenberger <mk...@gmail.com>.
I'm changing this to the users@myfaces mailing list.   The dev list is
for working on the MyFaces source code.

FacesContext.getCurrentInstance() is only non-null during the JSF lifecycle.
Apparently you're executing your backing bean code external to JSF.

On 4/27/07, Trumml <Ma...@systema.info> wrote:
>
> I want to access the HTTP session inside of a backing bean.
> I use jboss-4.0.5 and the attached war file:
> http://www.nabble.com/file/8109/ce.tests.war ce.tests.war
> But FacesContext.getCurrentInstance() always returns null :-(
>
> Can anyone give me some help?
>
> --
> View this message in context: http://www.nabble.com/Access-to-context-of-HTTP-session-tf3657714.html#a10219374
> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>
>