[GLASSFISH-20721]  [embedded] JSP compilation fails in embedded Created: 22/Jul/13  Updated: 22/Aug/14

Status: Open
Project: glassfish
Component/s: embedded
Affects Version/s: 4.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: arjan tijms Assignee: Bhavanishankar
Resolution: Unresolved Votes: 6
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When using the embedded container from GlassFish 4.0 compilation for JSP pages fails. This seems to be the exact same issue as GLASSFISH-9511. When I change the container to the one from GlassFish 3.1.2.2 everything works correctly.

E.g. when using Maven having the following in pom.xml when using Arquillian and Drone will cause the error:

<dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>4.0</version>
    <scope>provided</scope>
</dependency>

changing this to 3.1.2.2 will not cause an error:

<dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>3.1.2.2</version>
    <scope>provided</scope>
</dependency>

Relevant entries in log including exception stack trace:

INFO: Loading application [register-session-simple] at [/register-session-simple]
Jul 23, 2013 12:13:21 AM org.glassfish.deployment.admin.DeployCommand execute
INFO: register-session-simple was successfully deployed in 1,399 milliseconds.
Jul 23, 2013 12:13:22 AM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Error compiling file: /var/folders/lb/tt__r4nd2ldgfvhwkfqrzyh00000gn/T/gfembed2742910557672872056tmp/generated/jsp/register-session-simple/org/apache/jsp/index_jsp.java
Jul 23, 2013 12:13:22 AM org.apache.catalina.core.StandardWrapperValve log
WARNING: StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP

PWC6199: Generated servlet error:
package javax.servlet does not exist

PWC6199: Generated servlet error:
package javax.servlet.http does not exist

PWC6199: Generated servlet error:
package javax.servlet.jsp does not exist

PWC6199: Generated servlet error:
package org.apache.jasper.runtime does not exist

PWC6199: Generated servlet error:
package org.apache.jasper.runtime does not exist

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class JspFactory
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
package org.glassfish.jsp.api does not exist

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class HttpServletRequest
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class HttpServletResponse
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class ServletException
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   variable JspFactory
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class PageContext
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class HttpSession
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class ServletContext
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class ServletConfig
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class JspWriter
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
incompatible types
  required: java.lang.Object
  found:    org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class JspWriter
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class PageContext
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
package org.glassfish.jsp.api does not exist

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class SkipPageException
  location: class org.apache.jsp.index_jsp

PWC6199: Generated servlet error:
cannot find symbol
  symbol:   class ServletException
  location: class org.apache.jsp.index_jsp


	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:129)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:299)
	at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:392)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
	at org.apache.catalina.core.StandardPipeline.doChainInvoke(StandardPipeline.java:678)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
	at java.lang.Thread.run(Thread.java:722)


 Comments   
Comment by ejroberts [ 26/Sep/13 ]

We are also experiencing this issue. Any ideas what is causing it ?

2013-09-26 10:31:49,659 WARNING glassfish 4.0 javax.enterprise.web.core _ThreadID=42;_ThreadName=http-listener-2(5); Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP

PWC6199: Generated servlet error:
package mycom.mypackage does not exist

PWC6197: An error occurred at line: 5 in the jsp file: /WEB-INF/inc/redirector.jsp
PWC6199: Generated servlet error:
package mycom.mypackage does not exist

PWC6197: An error occurred at line: 5 in the jsp file: /WEB-INF/inc/redirector.jsp
PWC6199: Generated servlet error:
package mycom.mypackage does not exist

PWC6197: An error occurred at line: 5 in the jsp file: /WEB-INF/inc/redirector.jsp
PWC6199: Generated servlet error:
package mycom.mypackage does not exist


	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:129)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:299)
	at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:392)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
	at org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(ServletMvcView.java:50)
	at org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:187)
	at org.springframework.webflow.engine.ViewState.render(ViewState.java:296)
	at org.springframework.webflow.engine.ViewState.doEnter(ViewState.java:186)
	at org.springframework.webflow.engine.State.enter(State.java:194)
	at org.springframework.webflow.engine.Transition.execute(Transition.java:227)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:393)
	at org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
	at org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
	at org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:388)
	at org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
	at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:105)
	at org.springframework.webflow.engine.State.enter(State.java:194)
	at org.springframework.webflow.engine.Transition.execute(Transition.java:227)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:393)
	at org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
	at org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
	at org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:388)
	at org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
	at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:105)
	at org.springframework.webflow.engine.State.enter(State.java:194)
	at org.springframework.webflow.engine.Transition.execute(Transition.java:227)
	at org.springframework.webflow.engine.DecisionState.doEnter(DecisionState.java:51)
	at org.springframework.webflow.engine.State.enter(State.java:194)
	at org.springframework.webflow.engine.Transition.execute(Transition.java:227)
	at org.springframework.webflow.engine.DecisionState.doEnter(DecisionState.java:51)
	at org.springframework.webflow.engine.State.enter(State.java:194)
	at org.springframework.webflow.engine.Flow.start(Flow.java:535)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:366)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:225)
	at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody2(SafeDispatcherServlet.java:128)
	at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody3$advice(SafeDispatcherServlet.java:57)
	at org.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:1)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
	at com.github.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:63)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:354)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
	at java.lang.Thread.run(Thread.java:722)
 
Comment by ejroberts [ 26/Sep/13 ]

For what it is worth, I am running GlassFish on Windows 8 with Oracle Java 7 Update 13.

I am deploying a WAB reliant on a mixture of embedded libraries and OSGi bundle imports. The package that cannot be accessed is in one of the OSGi bundle wirings.

With debug enabled on org.apache.jasper, I can see that none of the OSGi wired bundles are being included in the Jasper Compiler's classpath.

Comment by dmatej [ 22/Aug/14 ]

The problem is in default-web.xml file and was even on GF3, so I don't understand why it worked for you. This file contains a list of jar files that should be on classpath given to JSP compiler - but we use embedded glassfish jar file instead and maven dependencies!

For my simple application I created today the workaround was to add <useSystemClassLoader>false</useSystemClassLoader> to surefire/failsafe configuration.
Our bigger configuration has another more complicated workaround - configures instance's endorsed and lib directories and puts dependencies there (maven dependency plugin).

I think the system-jar-includes init param in default-web.xml is bad mechanism - it would be better to honor application's classloader hierarchy. But to do that, the compiling mechanism would have to be changed.

Generated at Fri Feb 12 08:17:35 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.