2 Replies Latest reply on Jul 21, 2011 3:50 PM by Rafal Glowinski

    Multipart mail send problem.

    Rafal Glowinski Newbie

      Hello,

       

      I have a pretty complex situation to solve.

       

      I have a multi-bundle application and in one of the bunles I have emebedded weblogic.jar using following entries in the MANIFEST file:

       

      Bundle-Version: 0.07.02.06-SNAPSHOT

      Bundle-Name: xxxxxxxxxxxxx

      Bundle-ClassPath: .,lib/weblogic-8.1.5.0.jar

      Build-Jdk: 1.5.0_22

      Embed-Directory: lib

      Bundle-ManifestVersion: 2

      Tool: Bnd-0.0.357

      Embed-Dependency: weblogic;scope=*

       

      The bad luck is that weblogic.jar contains lots of javax.activation and com.sun.mail.* classes. It causes a nasty exception:

       

      Caused by: java.lang.ClassCastException: com.sun.mail.handlers.multipart_mixed

      at org.apache.servicemix.specs.activation.OsgiMailcapCommandMap.createDataContentHandler(OsgiMailcapCommandMap.java:60)[65:org.apache.servicemix.specs.activation-api-1.1:

      1.7.0]

      at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:249)65:org.apache.servicemix.specs.activation-api-1.1:1.7.0

      at javax.activation.DataHandler.writeTo(DataHandler.java:73)65:org.apache.servicemix.specs.activation-api-1.1:1.7.0

      at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1383)117:javax.mail:1.4.3

      at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1743)117:javax.mail:1.4.3

      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:888)117:javax.mail:1.4.3

      at javax.mail.Transport.send0(Transport.java:191)117:javax.mail:1.4.3

      at javax.mail.Transport.send(Transport.java:120)117:javax.mail:1.4.3

      .......

       

      My other bundle - sending the email is really simple. Just plain Java Mail API Code + pom.xml configuration as follows:

       

                   

       

      How should I proceed to solve this problem? Removing the weblogic.jar from my bundle is out of the questions since it contains LOTS of different CORBA classes which are really necessary.

       

      Rafal

       

      Edited by: rglowinski on Jul 21, 2011 2:16 PM