WSO2应用程序服务器5.0.1使用Javax.Crypto软件包无法编译



我们正在使用WSO2应用程序服务器版本5.0.1。如果我在JSP页面中使用Javax.Crypto软件包,则在访问时无法编译。为了验证这一点,我在我们的Web应用程序的Web-Inf/Lib文件夹中复制了JCE.jar文件。如果jce.jar文件中存在Web-Inf/lib文件夹中,则JSP填充了良好,但是如果我从那里删除JCE.jar,则汇编失败,以下错误:

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)

想知道什么可能导致这些编译错误以及如何避免它们而无需将JCE.jar放入Web-Inf/lib/lib

如果我在servlet中使用javax.crypto软件包,则可以编译并运行正常。这使我相信WSO2应用程序服务器版本5.0.1上的JSP编译存在类问题。

有什么建议?

这可能是App Server中的类加载问题,但是我们将其修复为5.1.0版本。我们已经引入了一个名为WebApp-classloading.xml的新XML文件,以避免进行上传问题。

请参阅http://docs.wso2.org/display/as510/webapp classloading

由于jce.jar是JRE的一部分,因此应该在JSP Compilation Class Path上可用。因此,不需要额外的Web应用程序特定的类载荷,例如通过WebApp-Classloading.xml。以下是JSP页面的开始,该页面未能编译&在5.0.1上运行:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="org.apache.axiom.om.util.Base64"%>
<%@ page language="java" import="java.security.SecureRandom"%>
<%@ page language="java" import="java.security.spec.KeySpec"%>
<%@ page language="java" import="javax.crypto.SecretKeyFactory"%>
<%@ page language="java" import="javax.crypto.spec.PBEKeySpec"%>

您是否可以在5.1.0中确认此作品,而无需设置Web-App特定类Path?

相关内容

  • 没有找到相关文章

最新更新