tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aadi Deshpande <mailingli...@clubmom-inc.com>
Subject Cross context c:import not working?
Date Fri, 27 Feb 2004 23:25:17 GMT
Hi,

I'm not sure if this or the taglibs-user is the right place for posting 
this, but it looks to be a Tomcat error.

When trying to use a c:import in the vein of :

<c:import url="/test.jsp" context="/profile"/>
Hi,

Not sure if this is the right place or taglibs-user for this issue ( it 
seems to be a tomcat problem ), but it looks like cross context 
c:imports don't work if a page is session-enabled. This used to work in 
Tomcat 5.0.16 but is broken in 5.0.19

For example :

Both "/" and "/profile" contexts have crossContext="true"

<c:import url="/cross_context_import.jsp" context="/profile"/>

if cross_context_import.jsp has <%@ page session="false" %>, everything 
works well.

if cross_context_import doesn't have that ( or <%@ page session="true" 
%> ), then it gives me a NullPointerException ( stack trace at the end )

The problem it seems is that inside ApplicationHttpRequest.getSession(), 
the call to context.getManager().findSession(<id>) returns null ( this 
is for the first time that the context is accessed ).

However, before checking to see if the session is null, the .access() 
method is called on it ( presumably to update the access time ) . The 
whole thing is wrapped in an IOException, but which gets ignored since 
NullPointerException is a RuntimeException.

What's odd is that the check for the ( localSession == null  ) follows 
immediately after the try block, so it looks like some sort of oversight 
in my eyes.

What I've done is take the source code, and refactor it so that the 
access comes in an else block ( it looks like other session management 
code was put in place after 5.0.16 )


I'd like to make sure I didn't miss anything before erroneously 
reporting a bug.




java.lang.NullPointerException
    at 
org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:546)
    at 
org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:512)
    at 
org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:192)
    at 
org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:167)
    at 
org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:149)
    at 
org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:106)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:55)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
    at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:750)
    at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:636)
    at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:546)
    at 
org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:179)
    at 
org.apache.jsp.cross_005fcontext_005fimport_jsp._jspx_meth_c_import_0(cross_005fcontext_005fimport_jsp.java:85)
    at 
org.apache.jsp.cross_005fcontext_005fimport_jsp._jspService(cross_005fcontext_005fimport_jsp.java:59)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
    at 
clubmom.framework.PersistentHibernateSession.doFilter(PersistentHibernateSession.java:62)
    at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
    at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
    at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at 
org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:216)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
    at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
    at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
    at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
    at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
    at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
    at java.lang.Thread.run(Thread.java:534)



the application fails  with the error 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message