We are using the WSO2 application server version 5.0.1. If I use javax.crypto package in a JSP page, it fails to compile when accessed. To verify this I copied the jce.jar file in WEB-INF/lib folder of our web application. If the jce.jar file is present in WEB-INF/lib folder, the jsp compiles fine but if I remove the jce.jar from there, the compilation fails with following errors :
Generated servlet error:
The type javax.activation.DataHandler cannot be resolved. It is indirectly referenced from required .class files
An error occurred at line: 10 in the jsp file: /processPassword.jsp
Generated servlet error:
PBEKeySpec cannot be resolved to a type
An error occurred at line: 10 in the jsp file: /processPassword.jsp
Generated servlet error:
SecretKeyFactory cannot be resolved to a type
An error occurred at line: 10 in the jsp file: /processPassword.jsp
Generated servlet error:
SecretKeyFactory cannot be resolved
] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
The type javax.activation.DataHandler cannot be resolved. It is indirectly referenced from required .class files
An error occurred at line: 10 in the jsp file: /processPassword.jsp
Generated servlet error:
PBEKeySpec cannot be resolved to a type
An error occurred at line: 10 in the jsp file: /processPassword.jsp
Generated servlet error:
SecretKeyFactory cannot be resolved to a type
An error occurred at line: 10 in the jsp file: /processPassword.jsp
Generated servlet error:
SecretKeyFactory cannot be resolved
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:172)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:701)
Wonder what could be causing these compile errors and how to avoid them without having to put the jce.jar in WEB-INF/lib
If I use javax.crypto package in a servlet it compiles and runs fine. Which leads me to believe there is a classpath problem with jsp compilation on WSO2 application server version 5.0.1.
Any suggestions?
Since jce.jar is part of jre, it should be available on jsp compilation classpath. As such it should require no extra web-application specific classloading e.g. via webapp-classloading.xml. Below is the start of a jsp page that fails to compile & run on 5.0.1 :
Can you confirm this works in 5.1.0 without having to set web-app specific classpath?