views:

49

answers:

0

In the lower levels of the application I am working on, the application uses SunJCE to encryt something (I'm pretty sure exactly what it is doing is not relevant to this question). Please let me know if you need more info on that and I'll dig it up.

We always use a Sun JDK,so the having the dependency of the SunJCE is not a big issue for us. The SunJCE always gets loaded on the QA and Production servers (Tomcat) and everything works swimmingly there.

On to the problem... I am using the m2eclipse plugin and have a separate maven installation as well. When I run mvn jetty:run from the command line the SunJCE class is loaded and the application works great. However, when I run jetty from inside eclipse using the exact same target, I get an exception when I exercise the code that requires the SunJCE. ( java.lang.ClassNotFoundException: com.sun.crypto.provider.SunJCE)

I have eliminated all jdks that I ever installed to my local development envrionment except for my Sun 1.6 jdk which is set as my JAVA_HOME. I have not modified anything as far as the Eclipse settings, just unzipped and started developing (essentially). I am using Windows XP. I have seen this problem when using both Galileo and Helios versions of Eclipse.

Here are a few things I have tried with no success. Some may be good efforts and some were grasping at straws…

  • Adding BouncyCastle's SunJCE library as a dependency in my project's pom
  • Changing the run configuration to use the JRE rather than the JDK.
  • Changing the project to run using my installed maven application rather than the embedded m2eclipse one.

What finally worked was adding a dependency to the pom file for the SunJCE, setting the scope as system and pointing it directly to the jar in the JRE's ext directory.

I don't want to have to do that, though, because I don't want that dependency to accidentally get into QA or Prod since they work fine. Plus I'm afraid the other developers on the project might laugh at me. (kidding of course)

So, finally my question: Is there another way for me to get that SunJCE dependency loaded when I run my application through Eclipse/Maven/Jetty?