----- Original Message ----- From: "Jeng Yu" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Thursday, October 02, 2008 10:19 AM
Subject: Tomcat Servlet & Bouncy Castle Problem


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;
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

Jeng we use BC in servlets and have no problems, but its a long time since I was into it...
I think you need to get into their mailing lists or what ever they have....

I cant remember using the cldc_classes.zip .... isnt that for JavaME only? ... because it doesnt have BIGINT or something... make sure you not screwing Java now. If your BC is in the class path, take it out of there and try get it going in your test apps... If in doubt... use the source code for BC... so A you can remove the huge amount of stuff you wont need... and B if I remember correctly we spent a lot of time making it independent of JCE which seems to change every java version...

Only place those libs must be is in your web app...

Anyway its not TC... bouncy castle is one complex piece of code with a million options and forks

... make sure its not in the classpath...

Good luck

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------



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

Reply via email to