Re: Cross context c:import not working?
For the archives : this is bug 27309 ( http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27309 ) and has been fixed in head. -a Aadi Deshpande wrote: 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
Cross context c:import not working?
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