3 Replies Latest reply: Mar 13, 2012 9:49 PM by jimcpl RSS

    Newbie: Trying to 'call' JSP from CFML (example doesn't work)

    jimcpl Community Member

      Hi,

       

      I am (really) just getting started with CFML, so I got ColdFusion 8 Developer deployed onto a GlassFish 3.1.1 server.

       

      I put a copy of a small hello.cfm into the <GF_DOMAIN>/applications/cfusion/ directory, and when I point a browser to http://<host>:8080/cfusion/hello.cfm, I get the "Hello world".

       

      So next, I'm trying to 'call' a JSP from a CFML page, and I found this example:

       

      http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Java_6.html

       

      I put a copy of the CFML at cfusion/hellojsp.cfm:

       

       

      <cfapplication name="myApp" sessionmanagement="yes">

      <cfscript>

      Request.myVariable = "This";

      Session.myVariable = "is a";

      Application.myVariable = "test.";

      GetPageContext().include("hello.jsp?name=Bobby");

      </cfscript>

       

      and also created a cfusion/hello.jsp per the above link:

       

      <%@page import="java.util.*" %>

      <h2>Hello <%= request.getParameter("name")%>!</h2>

       

       

      <br>Request.myVariable: <%= request.getAttribute("myVariable")%>

      <br>session.myVariable: <%= ((Map)(session.getAttribute("myApp"))).get("myVariable")%>

      <br>Application.myVariable: <%= ((Map)(application.getAttribute("myApp"))).get("myVariable")%>

       

       

      In other words, in the <GF_DOMAIN>/applications/cfusion directory, I have:

       

      hellojsp.cfm

      hello.jsp

       

      However, if I point the browser to either http://<host>:8080/cfusion/hellojsp.cfm or http://<host>:8080/cfusion/hello.jsp, I get a 500 error.

       

      In the GlassFish server.log, I get the following:

       

      INFO: 03/13 21:17:24 Error [http-thread-pool-8080(5)] - coldfusion.jsp.JspWriterIncludeResponse.getStatus()I The specific sequence of files included or processed is: C:\glassfish3\glassfish\domains\domain1\applications\cfusion\hellojsp.cfm, line: 6

       

       

      Mar 13, 2012 9:17:24 PM org.apache.catalina.core.StandardWrapperValve log

      WARNING: StandardWrapperValve[CfmServlet]: PWC1406: Servlet.service() for servlet CfmServlet threw exception

      javax.servlet.ServletException: ROOT CAUSE:

      java.lang.AbstractMethodError: coldfusion.jsp.JspWriterIncludeResponse.getStatus()I

                at javax.servlet.http.HttpServletResponseWrapper.getStatus(HttpServletResponseWrapper.java:2 53)

                at com.sun.web.server.J2EEInstanceListener.handleAfterEvent(J2EEInstanceListener.java:356)

                at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:112)

                at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:465)

                at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1562)

                at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:787)

                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

                at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)

                at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:534)

                at coldfusion.runtime.NeoPageContext.include(NeoPageContext.java:2086)

                at coldfusion.runtime.NeoPageContext.include(NeoPageContext.java:2060)

                at sun.reflect.GeneratedMethodAccessor469.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at coldfusion.runtime.StructBean.invoke(StructBean.java:511)

                at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2300)

                at cfhellojsp2ecfm1997599341.runPage(C:\glassfish3\glassfish\domains\domain1\applications\cf usion\hellojsp.cfm:6)

                at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)

                at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)

                at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)

                at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)

                at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)

                at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)

                at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)

                at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)

                at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)

                at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)

                at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)

                at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)

                at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)

                at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)

                at coldfusion.CfmServlet.service(CfmServlet.java:175)

                at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)

                at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:343)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42 )

                at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:256)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

                at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPi peline.java:91)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

                at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

                at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

                at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

                at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

                at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

                at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                at java.lang.Thread.run(Thread.java:662)

       

       

                at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:70 )

                at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:256)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

                at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPi peline.java:91)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

                at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

                at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

                at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

                at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

                at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

                at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                at java.lang.Thread.run(Thread.java:662)

       

       

      Can anyone tell me what might be causing this problem?

       

      Thanks,

      Jim

        • 1. Re: Newbie: Trying to 'call' JSP from CFML (example doesn't work)
          jimcpl Community Member

          Hi,

           

          I've been "dissecting" the hello.jsp and the .cfm, and it appears that:

           

          1) From within the hello.jsp, all the "myVariable" variables appear to be null (i.e., they are set in the .cfm, but when the hello.jsp is invoked, they are null, and

          2) In hello.jsp, the line where "session.getAttribute()" is called is blowing up, causing the 500 error.

           

          but, I'm not sure why either of the above things are happening?

           

          Jim

          • 2. Re: Newbie: Trying to 'call' JSP from CFML (example doesn't work)
            jimcpl Community Member

            Hi,

             

            I just got things working:

             

            1) The Request variable name apparently has to be lower-case ('myvariable", rather than "myVariable").  This was causing the request variable not to be passed to the hello.jsp, and

             

            2) In the CF admin, the "use J2EE session variables" under "Server Settings" ==> "Memory variables" was unchecked, and I had to check/enable that.

             

            So, now, the example .cfm/jsp work.

             

            Jim

            • 3. Re: Newbie: Trying to 'call' JSP from CFML (example doesn't work)
              jimcpl Community Member

              Hi,

               

              Sigh ... I thought I had this solved, and, in fact, I do get a correct output webpage now.

               

              However, if I use that small .cfm, with the .forward(), whenever I access it, I get an error/stacktrace:

               

              Mar 14, 2012 12:44:27 AM org.apache.catalina.core.StandardWrapperValve log

              WARNING: StandardWrapperValve[CfmServlet]: PWC1406: Servlet.service() for servlet CfmServlet threw exception

              javax.servlet.ServletException: ROOT CAUSE:

              java.lang.AbstractMethodError: coldfusion.jsp.JspWriterIncludeResponse.getStatus()I

                        at javax.servlet.http.HttpServletResponseWrapper.getStatus(HttpServletResponseWrapper.java:2 53)

                        at com.sun.web.server.J2EEInstanceListener.handleAfterEvent(J2EEInstanceListener.java:356)

                        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:112)

                        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:465)

                        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1580)

                        at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:787)

                        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

                        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)

                        at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:534)

                        at coldfusion.runtime.NeoPageContext.include(NeoPageContext.java:2086)

                        at coldfusion.runtime.NeoPageContext.include(NeoPageContext.java:2060)

                        at sun.reflect.GeneratedMethodAccessor473.invoke(Unknown Source)

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                        at java.lang.reflect.Method.invoke(Method.java:597)

                        at coldfusion.runtime.StructBean.invoke(StructBean.java:511)

                        at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2300)

                        at cfhellojsp2ecfm1997599341.runPage(C:\glassfish3\glassfish\domains\domain1\applications\cf usion\hellojsp.cfm:6)

                        at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)

                        at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)

                        at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)

                        at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)

                        at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)

                        at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)

                        at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)

                        at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)

                        at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)

                        at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)

                        at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)

                        at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)

                        at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)

                        at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)

                        at coldfusion.CfmServlet.service(CfmServlet.java:175)

                        at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)

                        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:343)

                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                        at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42 )

                        at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)

                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:256)

                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

                        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPi peline.java:91)

                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

                        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

                        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

                        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

                        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

                        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

                        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

                        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                        at java.lang.Thread.run(Thread.java:662)

               

               

                        at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:70 )

                        at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)

                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:256)

                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

                        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

                        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

                        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPi peline.java:91)

                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

                        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

                        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

                        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)

                        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)

                        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)

                        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

                        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                        at java.lang.Thread.run(Thread.java:662)

               

              Can anyone tell me what is causing that error?

               

              Thanks,

              Jim

               

              P.S.  If I change the .forward() to a .include(), I don't get an error...