-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Frank Herrmann wrote:
| Hi!
|
| yesterday I asked the following question on the James developer list and
| 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
| to start James (run.sh) it throws the following exception:
|
| 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 file
| it works like a charm.
|
| So the question is: How can I tell James where to find the
sunjce_provider.jar
| file ?
|
| What I already tried: added classpath in /dist/bin/run.sh - no difference.
|
| $JAVA_HOME/bin/java -classpath
/usr/lib/java/jre/lib/ext/sunjce_provider.jar
| $JVM_OPTS -jar $PHOENIX_HOME/bin/phoenix-loader.jar $*
|
I'm not sure if it helps, but once I've encountered similar problem -
some JVM versions ignore -classpath argument if supplied simultanously
with -jar argument. Try this:
$JAVA_HOME/bin/java -classpath
/usr/lib/java/jre/lib/ext/sunjce_provider.jar:$PHOENIX_HOME/bin/phoenix-loader.jar
$JVM_OPTS org.apache.avalon.phoenix.launcher.Main $*
No guarantee it will work. It's only workaround, and you should consult
someone more skilled in Phoenix/James class loading issues to defeat the
problem. IMHO Noel is right - you should include standard extensions in
your classpath (which is what they're for), or put sunjce_provider.jar
in Phoenix/James lib directory.
| Greetings,
| Frank
|
| -------------------------------little code sample---------------------
| try {
|
| if (_DEBUG_CRYPTO) {
| // display providers we have available:
| secProviders = Security.getProviders();
| System.out.println(secProviders.length);
| for (int i = 0; i < secProviders.length; i++)
| {
| System.out.println(secProviders[i].getInfo());
| }
| }
|
| /* select provider SunJCE */
| secProvider = 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
initialize
| application james.
| at
|
org.apache.avalon.phoenix.components.deployer.DefaultDeployer.deploy(DefaultDeployer.java:183)
| at
|
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(DefaultEmbeddor.java:467)
| at
|
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(DefaultEmbeddor.java:461)
| at
|
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFiles(DefaultEmbeddor.java:449)
| at
|
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployDefaultApplications(DefaultEmbeddor.java:439)
| at
|
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute(DefaultEmbeddor.java:182)
| at
org.apache.avalon.phoenix.frontends.CLIMain.run(CLIMain.java:115)
| at
| 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
|
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
|
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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
| initialize application james.
| at
|
org.apache.avalon.phoenix.components.kernel.DefaultKernel.startup(DefaultKernel.java:134)
| at
|
org.apache.avalon.phoenix.components.kernel.DefaultKernel.addApplication(DefaultKernel.java:169)
| at
|
org.apache.avalon.phoenix.components.deployer.DefaultDeployer.deploy(DefaultDeployer.java:166)
| ... 14 more
| Caused by: org.apache.avalon.framework.CascadingException: Block named
| "spoolmanager" failed to pass through the Initialization stage. (Reason:
| java.lang.NoClassDefFoundError: com/sun/crypto/provider/SunJCE).
| at
|
org.apache.avalon.phoenix.components.application.LifecycleHelper.fail(LifecycleHelper.java:417)
| at
|
org.apache.avalon.phoenix.components.application.LifecycleHelper.startup(LifecycleHelper.java:220)
| at
|
org.apache.avalon.phoenix.components.application.DefaultApplication.runPhase(DefaultApplication.java:176)
| at
|
org.apache.avalon.phoenix.components.application.DefaultApplication.start(DefaultApplication.java:88)
| at
|
org.apache.avalon.phoenix.components.kernel.DefaultKernel.startup(DefaultKernel.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
| org.apache.james.transport.MailetLoader.getMailet(MailetLoader.java:57)
| at
|
org.apache.james.transport.JamesSpoolManager.initialize(JamesSpoolManager.java:151)
| at
|
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 here:
|
| 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 Avaloon
| 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 linking
| 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:
<mailto:[EMAIL PROTECTED]>
| For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
|
|
- --
Tomasz Skutnik, R&D Director, www.e-point.pl
tel +48 (22) 853 48 30, mob +48 501 555 705, fax +48 (22) 853 48 30
e-point S.A., ul. Filona 16, 02-658 Warsaw, Poland
PGP/GPG public key: http://scooter.ext.e-point.pl/tomasz.skutnik.gpg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE9dJ+FKoVCme/JcTgRAralAJ0e6Zh5uZ/0wqrfXPfVRV6dT+gLtQCfdCUG
s8uWfveqofALkEQLnThXwyo=
=kR49
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>