Security.addProvider(new com.sun.net.ssl.internal.ssl.Provide());
843811Dec 29 2003 — edited Feb 8 2004Hi Everybody,
I have suffered a problem in using IAIK JCE 3.02 together with JSSE 1.0.1 in IBM Websphere Application Server environment.
In Websphere environment, I have imported jsse.jar, jcert.jar, jnet.jar and iaik_jce.jar in the CLASSPATH. The problem seems that the internal classes have referenced to iaik.asn1.structures.Name. When I remove iaik_jce.jar in the classpath, it works normally.
I have tried to simplify the code and it throws java.lang.ClassCastException : iaik.asn1.structures.Name during runtime compliation in line "java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());"
As my application must run with implementation of iaik_jce.jar in my environment, I can't run without it.
Can anybody kindly give me suggestion in solving this problem ?
Many Thanks.
Regards,
Steven.
REF.
MY SIMPLE JSP
=================================================================
<%@ page import = "java.lang.*
,java.io.*"
%>
<%! public void debug(String str1)
{
System.out.println("testSSL.jsp->debug("+str1+")");
}
%>
<%
try
{
debug("1.........");
java.lang.System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
debug("2.........");
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
debug("3.........");
%>
<html>
<body>
OK
</body>
</html>
<%
}
catch(Exception exp)
{
%>
<html>
<body>
Exception(<%=exp.toString()%>)
</body>
</html>
<% } %>
RUNTIME EXCEPTION
=================================================================
[03.12.29 13:35:10:043 CST] 2322b726 WebGroup X Root Cause
java.lang.ClassCastException: iaik.asn1.structures.Name
at sun.security.pkcs.PKCS7.getCertificate(PKCS7.java(Compiled Code))
at sun.security.pkcs.SignerInfo.getCertificate(SignerInfo.java:207)
at sun.security.pkcs.SignerInfo.verify(SignerInfo.java:333)
at sun.security.pkcs.PKCS7.verify(PKCS7.java:472)
at sun.security.pkcs.PKCS7.verify(PKCS7.java(Compiled Code))
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:152)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:290)
at java.util.jar.JarVerifier.update(JarVerifier.java:203)
at java.util.jar.JarFile.initializeVerifier(JarFile.java(Compiled Code))
at java.util.jar.JarFile.getInputStream(JarFile.java(Compiled Code))
at sun.misc.URLClassPath$4.getInputStream(URLClassPath.java(Compiled Code))
at sun.misc.Resource.getBytes(Resource.java(Compiled Code))
at java.net.URLClassLoader.defineClass(URLClassLoader.java(Compiled Code))
at java.net.URLClassLoader.access$2(URLClassLoader.java(Compiled Code))
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java(Compiled Code))
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at com.ibm.servlet.classloader.ClassLoaderTemplate.loadClass(ClassLoaderTemplate.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at org.apache.jasper.runtime.JspLoader.loadClass(JspLoader.java:139)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java(Compiled Code))
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.load(JspServlet.java:167)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:321)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:351)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:712)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:879)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:644)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:160)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:287)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:105)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:371)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:793)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:719)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:666)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:257)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:154)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:105)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:214)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:160)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQEventListenerImp.java:230)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventListenerImp.java:104)
at com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(SQEventSource.java:216)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.notifyService(SQWrapperEventSource.java:354)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.run(SQWrapperEventSource.java:221)
at com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run(OutOfProcThread.java:248)
at java.lang.Thread.run(Thread.java:481)