"org.apache.jasper.JasperException: PWC6345" error when using Payara-Micro to deploy a JavaEE application

I'm deploying a JavaEE application on Payara Micro Programmatically. It works fine in Netbeans IDE, but I get the error below when using java -jar myapp.jar from cmd.

It looks like Payara Micro can't find javac. Suggestions on how to go about solving this would be much appreciated.

  • I have my JAVA_HOME set to C:\Program Files\Java\jdk1.8.0_111
  • I use Payara-micro 4.1.1.164 on Windows 7.
StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac.
  A full JDK (not just JRE) is required
        at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorH
andler.java:92)
        at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.j
ava:378)
        at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.j
ava:119)
        at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Jsr199JavaCompi
ler.java:208)
        at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:384)
        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:4
73)
        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
:1693)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:344)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:214)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:316)
        at org.springframework.security.web.access.intercept.FilterSecurityInter
ceptor.invoke(FilterSecurityInterceptor.java:126)
        at org.springframework.security.web.access.intercept.FilterSecurityInter
ceptor.doFilter(FilterSecurityInterceptor.java:90)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.access.ExceptionTranslationFilter.do
Filter(ExceptionTranslationFilter.java:114)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.session.SessionManagementFilter.doFi
lter(SessionManagementFilter.java:122)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.AnonymousAuthenticati
onFilter.doFilter(AnonymousAuthenticationFilter.java:111)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwar
eRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter
.doFilter(RequestCacheAwareFilter.java:48)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.AbstractAuthenticatio
nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.logout.LogoutFilter.d
oFilter(LogoutFilter.java:120)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterIn
ternal(HeaderWriterFilter.java:64)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.context.request.async.WebAsyncManage
rIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.session.ConcurrentSessionFilter.doFi
lter(ConcurrentSessionFilter.java:133)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.context.SecurityContextPersistenceFi
lter.doFilter(SecurityContextPersistenceFilter.java:91)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(Fi
lterChainProxy.java:213)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
nProxy.java:176)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
elegatingFilterProxy.java:344)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
ingFilterProxy.java:261)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:256)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:214)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:316)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:161)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:734)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:673)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:174)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.j
ava:416)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:283)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallab
le.call(ContainerMapper.java:466)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(Container
Mapper.java:169)
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.
java:206)
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.ja
va:180)
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpSer
verFilter.java:235)
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(Executor
Resolver.java:119)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(De
faultFilterChain.java:284)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart
(DefaultFilterChain.java:201)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultF
ilterChain.java:133)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultF
ilterChain.java:112)
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.jav
a:77)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNI
OTransport.java:526)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(Abstr
actIOStrategy.java:112)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerTh
readIOStrategy.java:117)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(Wo
rkerThreadIOStrategy.java:56)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadR
unnable.run(WorkerThreadIOStrategy.java:137)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(Abs
tractThreadPool.java:593)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(Abstra
ctThreadPool.java:573)
        at java.lang.Thread.run(Unknown Source)
]]


ANSWERS:


Check that java command refers to JDK and not JRE. If it does not, either use java command from C:\Program Files\Java\jdk1.8.0_111, or set C:\Program Files\Java\jdk1.8.0_111 as java.home system property like this:

java -Djava.home="C:\Program Files\Java\jdk1.8.0_111" -jar myapp.jar

Payara Micro tries to find the java compiler to compile JSPs on the classpath or in the folder defined by java.home system property, but cannot find it.

For details, see the source code of ToolPovider.getSystemJavaCompiler(), which is used by Payara Micro to find the Java compiler.



 MORE:


 ? CMD not recognizing Javac
 ? Why does order of where clauses effecting the performance?
 ? Can I optimize a SELECT DISTINCT x FROM hugeTable query by creating an index on column x?
 ? MySQL Workbench Create SQL Statements error when implementing in phpMyAdmin
 ? MySQL 3 rows from the same tables WHERE they match eachother
 ? using field selected in outer part of query as parameter for sub query
 ? SQL: Drop Views When Table is Dropped
 ? Performance of data retrieval process from SQL views
 ? Performance for big query in SQL Server view
 ? Can a parent method check which child method calls it?