Return-Path: Delivered-To: apmail-jakarta-avalon-dev-archive@apache.org Received: (qmail 62817 invoked from network); 3 Sep 2002 11:30:07 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 3 Sep 2002 11:30:07 -0000 Received: (qmail 8107 invoked by uid 97); 3 Sep 2002 11:30:36 -0000 Delivered-To: qmlist-jakarta-archive-avalon-dev@jakarta.apache.org Received: (qmail 8084 invoked by uid 97); 3 Sep 2002 11:30:35 -0000 Mailing-List: contact avalon-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon Developers List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-dev@jakarta.apache.org Received: (qmail 14774 invoked by uid 98); 3 Sep 2002 07:48:50 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Content-Type: text/plain; charset="us-ascii" From: Frank Herrmann Organization: TU Dresden To: Avalon Developer Subject: Avalon+James+JCE (long!) Date: Tue, 3 Sep 2002 09:45:32 +0200 X-Mailer: KMail [version 1.4] MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200209030945.32447.herrmann.frank@gmx.de> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi! yesterday I asked the following question on the James developer list and=20 somebody recommended asking directly on the Avalon list. So here is the problem: -------------------------------------------------------------------------= ------- Hello! I'd like to use JCE (Java Cryptography Extension) inside a mailet. When I= try=20 to start James (run.sh) it throws the following exception:=20 java.lang.NoClassDefFoundError: com/sun/crypto/provider/SunJCE AFAIK this only happens if the provider class is not in the classpath. (for me it is /usr/lib/java/jre/lib/ext/sunjce_provider.jar) When I compile (and run) the code snippet in a separate ("normal") java f= ile=20 it works like a charm.=20 So the question is: How can I tell James where to find the sunjce_provide= r.jar=20 file ?=20 What I already tried: added classpath in /dist/bin/run.sh - no difference= =2E $JAVA_HOME/bin/java -classpath /usr/lib/java/jre/lib/ext/sunjce_provider.= jar=20 $JVM_OPTS -jar $PHOENIX_HOME/bin/phoenix-loader.jar $* Greetings, Frank -------------------------------little code sample--------------------- try { if (_DEBUG_CRYPTO) { // display providers we have available: secProviders =3D Security.getProviders(); System.out.println(secProviders.length); for (int i =3D 0; i < secProviders.length; i++) { System.out.println(secProviders[i].getInfo()); } } /* select provider SunJCE */ secProvider =3D new com.sun.crypto.provider.SunJCE(); Security.addProvider(secProvider); } catch (Exception e) {} -------------------------------------------------------------------- ------------------------the full exception output-------------------- James 2.0a3 There was an uncaught exception: --------------------------------------------------------- --- Message --- Failed to initialize application james. --- Stack Trace --- org.apache.avalon.phoenix.interfaces.DeploymentException: Failed to initi= alize=20 application james. at=20 org.apache.avalon.phoenix.components.deployer.DefaultDeployer.deploy(Defa= ultDeployer.java:183) at=20 org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(= DefaultEmbeddor.java:467) at=20 org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(= DefaultEmbeddor.java:461) at=20 org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFiles= (DefaultEmbeddor.java:449) at=20 org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployDefau= ltApplications(DefaultEmbeddor.java:439) at=20 org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute(Def= aultEmbeddor.java:182) at org.apache.avalon.phoenix.frontends.CLIMain.run(CLIMain.java:1= 15) at=20 org.apache.avalon.phoenix.frontends.CLIMain.execute(CLIMain.java:101) at org.apache.avalon.phoenix.frontends.CLIMain.main(CLIMain.java:= 67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at=20 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :39) at=20 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.avalon.phoenix.launcher.Main.startup(Main.java:88) at org.apache.avalon.phoenix.launcher.Main.main(Main.java:51) Caused by: org.apache.avalon.framework.CascadingException: Failed to=20 initialize application james. at=20 org.apache.avalon.phoenix.components.kernel.DefaultKernel.startup(Default= Kernel.java:134) at=20 org.apache.avalon.phoenix.components.kernel.DefaultKernel.addApplication(= DefaultKernel.java:169) at=20 org.apache.avalon.phoenix.components.deployer.DefaultDeployer.deploy(Defa= ultDeployer.java:166) ... 14 more Caused by: org.apache.avalon.framework.CascadingException: Block named=20 "spoolmanager" failed to pass through the Initialization stage. (Reason:=20 java.lang.NoClassDefFoundError: com/sun/crypto/provider/SunJCE). at=20 org.apache.avalon.phoenix.components.application.LifecycleHelper.fail(Lif= ecycleHelper.java:417) at=20 org.apache.avalon.phoenix.components.application.LifecycleHelper.startup(= LifecycleHelper.java:220) at=20 org.apache.avalon.phoenix.components.application.DefaultApplication.runPh= ase(DefaultApplication.java:176) at=20 org.apache.avalon.phoenix.components.application.DefaultApplication.start= (DefaultApplication.java:88) at=20 org.apache.avalon.phoenix.components.kernel.DefaultKernel.startup(Default= Kernel.java:122) ... 16 more Caused by: java.lang.NoClassDefFoundError: com/sun/crypto/provider/SunJCE at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:130) at=20 org.apache.james.transport.MailetLoader.getMailet(MailetLoader.java:57) at=20 org.apache.james.transport.JamesSpoolManager.initialize(JamesSpoolManager= =2Ejava:151) at=20 org.apache.avalon.phoenix.components.application.LifecycleHelper.startup(= LifecycleHelper.java:199) ... 19 more -------------------------------------------------------------------------= -------------------------------- For your convenience I append the answers I got on James developer list h= ere: Danny Angus wrote: -------------------------------------------------------------------------= ---------------------------------- Frank, the mailet classpath is controlled by Avalon Phoenix http://jakarta.apache/org/avalon If you're not familiar with avalon it provides james (I expect the Avaloo= n guys will "correct" me robustly when i get this wrong!) with a runtime platform "Phoenix", several services, and a lifecycle framework. Phoenix ensures classpath separation amongst apps its hosting, which is fine, but also (probably for good reasons) omits jre/lib/ext from the classpath it provides its "blocks" with. if you're using james 1.2a1-xx you could try putting the crypto provider in phoenix own common lib dirs, which I think would be either james/lib or james/ext I know one of these (can't remember which offhand) works for JDBC drivers= , check my JDBC related comments in the config file to find out what I used= to know ;-). As far as telling Phoenix to include jre/lib/ext in the classpath it provides, I'm not sure what to do, (if you are a *nix user I'd try linkin= g Phoenix /ext/ to jre/lib/ext, but thats not a portable answer). You may get further by asking this same question on the avalon lists. If you get a better answer anywhere let us know. -------------------------------------------------------------------------= -------------------- Noel J.Bergman wrote: -------------------------------------------------------------------------= ---------------------- Removing jre/lib/ext from the classpath seems like an error. That is explicitly where shared libraries are supposed to go. Separation of classpath's shouldn't apply. It would only make sense if the goal was to make SAR files self-contained= , except for Phoenix. --- Noel -------------------------------------------------------------------------= ----------------------- Thank you for reading! Frank -- To unsubscribe, e-mail: For additional commands, e-mail: