Re: Tomcat Servlet Bouncy Castle Problem
--- Mark Thomas [EMAIL PROTECTED] wrote: Jeng Yu wrote: 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. Tomcat only loads '.jar' files. '.zip' files will be ignored. Rename cldc_classes.zip to cdlc_classes.jar and you should be good to go. Mark Hi Mark! Thanks a lot. This suggestion from you solved the problem. 'Preciate it, dude! Jeng - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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; 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Servlet Bouncy Castle Problem
Jeng Yu wrote: 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. Tomcat only loads '.jar' files. '.zip' files will be ignored. Rename cldc_classes.zip to cdlc_classes.jar and you should be good to go. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Servlet Bouncy Castle Problem
- 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]
RE: Tomcat Servlet Bouncy Castle Problem
you'll want to make sure bcprov-ext-jdk15-140.jar is in WEB-INF=lib from http://www.bouncycastle.org/latest_releases.html feel free to ping me offline for implementation specific issues cheers, Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. From: [EMAIL PROTECTED] To: users@tomcat.apache.org Subject: Re: Tomcat Servlet Bouncy Castle Problem Date: Thu, 2 Oct 2008 16:53:46 +0200 - 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] _ See how Windows connects the people, information, and fun that are part of your life. http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/