tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeng Yu <jengyu2...@yahoo.co.uk>
Subject Tomcat Servlet & Bouncy Castle Problem
Date Thu, 02 Oct 2008 08:19:18 GMT
Hello Friends!

I have a debugging problem here that I hope the gurus
here can help me figure out.

I'm trying to do RSA public key encryption in a
servlet that I'm developing inside Netbeans 6.1. I'm
using the Bouncy Castle (BC) crypto package. When I
build the servlet, there are no errors. Then I run it,
and Netbeans invokes the Tomcat 6.0.16 container in it
and  waits for a client to conect. But when I connect
to the servlet from a client, it crashes when it
executes this line in my code:

private RSAPrivateCrtKeyParameters RSAprivKey = null;

with this message in the Tomcat log output:

	SEVERE: Allocate exception for servlet Fortune
	java.lang.NoClassDefFoundError:
Lorg/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters;

and prints this stack trace:

        at java.lang.Class.getDeclaredFields0(Native
Method)
        at
java.lang.Class.privateGetDeclaredFields(Class.java:2291)
        at
java.lang.Class.getDeclaredFields(Class.java:1743)
        at
org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:131)
        at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1108)
        at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)

Interestngly, the same RSA public encryption code with
Bouncy Castle library works flawlessly when I develop
it in Netbeans IDE and run it as a java application
(not servlet). In servlet environment, it fails. Yes,
I added cldc_classes.zip class library file from
Bouncy Castle to compile the code.

Oh, and the client reports the following error when
trying to connect to the servlet:

	The server encountered and internal error that
        prevented it from fulfilling this request.
	ServletException: Error instantiating servlet 
        class fortune.Fortune.

What am I not doing right? Has anyone else seen
something similar and what's the 
getaround/workaround?

Thanks,

Jeng Yu




      

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message