In my application need to send mail function, and I use the Java Mail API to implemented it. So the Java Mail API related jar file and activation.jar file is included in my application.
When I put the application into jetty and run in J2SE 5, the application works fine and the mail send successful. But when I put the application into jetty and run in J2SE 6, the application throws error exception:java.lang.LinkageError: loader constraint
violation: when resolving method "javax.mail.internet.MimeBodyPart.setDataHandler(Ljavax/activation/DataHandler;)V" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class,
net/heartsome/tesystem/util/MailTools, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for resolved class, javax/mail/internet/MimeBodyPart, have different Class objects for the type
javax/activation/DataHandler used in the signature.
Because JavaBeans Activation Framework 1.1.1 final release is included with the Java SE6 release. And also I find the activation.jar in <JETTY_HOME>/lib/plus, and the file don't add to the jetty class path by default, otherwise my application should also throw exception in J2SE 5, is it right?
My question is: is it possible Configure jetty to load the activation.jar file depend on jre version? If yes, Please give me some hints.
PS: I posted the mail to the jetty user mail list, but no reply, so I post here. Please help me.