Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-1375

UnsupportedDataTypeException sending email

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.0.0.Final, 7.0.1.Final, 7.0.2.Final
    • Fix Version/s: 7.1.0.Beta1
    • Component/s: None
    • Labels:
    • Environment:
      jdk-u26, jboss-as-7.1.0.Alpha1-SNAPSHOT(07/22/2011)
    • Affects:
      Release Notes
    • Estimated Difficulty:
      Low

      Description

      Seam 3 send mail example fails on:
      javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
      boundary="----=_Part_1_340486764.1311336438303"
      at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:905) [activation-1.1.1.jar:1.1.1]
      at javax.activation.DataHandler.writeTo(DataHandler.java:330) [activation-1.1.1.jar:1.1.1]
      at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476) [mail-1.4.4.jar:1.4.4]
      at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772) [mail-1.4.4.jar:1.4.4]
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099) [mail-1.4.4.jar:1.4.4]
      ... 42 more

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            teacurran Terrence Curran added a comment -

            I had this problem and fixed it by making sure my MANIFEST.MF has javax.activation.api in it's Dependencies

            Show
            teacurran Terrence Curran added a comment - I had this problem and fixed it by making sure my MANIFEST.MF has javax.activation.api in it's Dependencies
            Hide
            oranheim Ove Ranheim added a comment -

            I get the same issue with Seam Mail and added this to WEB-INF/jboss-deployment-structure.xml.

            <jboss-deployment-structure>
            <deployment>
            <dependencies>
            <module name="javax.activation.api" />
            </dependencies>
            </deployment>
            </jboss-deployment-structure>

            And it does not work! I haven't tried the MANIFEST approach though. I prefer the jboss-deployment-structure.xml to wire external container includes and excludes.

            Show
            oranheim Ove Ranheim added a comment - I get the same issue with Seam Mail and added this to WEB-INF/jboss-deployment-structure.xml. <jboss-deployment-structure> <deployment> <dependencies> <module name="javax.activation.api" /> </dependencies> </deployment> </jboss-deployment-structure> And it does not work! I haven't tried the MANIFEST approach though. I prefer the jboss-deployment-structure.xml to wire external container includes and excludes.
            Hide
            oranheim Ove Ranheim added a comment - - edited

            Added Dependencies: javax.activation.api to MANIFEST.MF.

            The same error still persists and does not solve the issue.

            Show
            oranheim Ove Ranheim added a comment - - edited Added Dependencies: javax.activation.api to MANIFEST.MF. The same error still persists and does not solve the issue.
            Hide
            dmlloyd David Lloyd added a comment - - edited

            Deployments should have javax.activation.api automatically added already. This looks like it's failing to load the specific content type handler. What if you added the following line to the manifest:

            Dependencies: javax.mail.api services export, javax.activation.api services export
            

            It's just a hypothesis but I suspect that javax.activation.api isn't seeing the javax.mail.api content handlers. Adding this line should fix that but I'm not 100% on that either.

            Show
            dmlloyd David Lloyd added a comment - - edited Deployments should have javax.activation.api automatically added already. This looks like it's failing to load the specific content type handler. What if you added the following line to the manifest: Dependencies: javax.mail.api services export, javax.activation.api services export It's just a hypothesis but I suspect that javax.activation.api isn't seeing the javax.mail.api content handlers. Adding this line should fix that but I'm not 100% on that either.
            Hide
            teacurran Terrence Curran added a comment -

            I had to do this to get it to work:
            in /modules/javax/mail/api/main/module.xml
            change the dependencies to:
            <dependencies>
            <module name="javax.activation.api" export="true"/>
            <module name="javax.api"/>
            </dependencies>

            Then in /your.war/META-INF/MANIFEST.MF
            Dependencies: javax.mail.api, javax.activation.api

            This is working for me and I am now able to send email again.

            Show
            teacurran Terrence Curran added a comment - I had to do this to get it to work: in /modules/javax/mail/api/main/module.xml change the dependencies to: <dependencies> <module name="javax.activation.api" export="true"/> <module name="javax.api"/> </dependencies> Then in /your.war/META-INF/MANIFEST.MF Dependencies: javax.mail.api, javax.activation.api This is working for me and I am now able to send email again.
            Hide
            dmlloyd David Lloyd added a comment -

            Okay so at best we're looking at changing a module definition, at worst we need to patch one or two EE APIs. But either way it should be a small change so let's try to get it in for 7.0.1 if we can!

            Show
            dmlloyd David Lloyd added a comment - Okay so at best we're looking at changing a module definition, at worst we need to patch one or two EE APIs. But either way it should be a small change so let's try to get it in for 7.0.1 if we can!
            Hide
            ctomc Tomaz Cerar added a comment -

            I have same problem, but in my case it goes for another module (mail subsystem) and no matter how I defined dependencies it does not work.
            as i found out the problem is that activation api is trying to load something that is in javax.mail and that does not work as there is no dependency to javax.mail, even if i add it as dependency it does not work (not sure if circular dependency is allowed at all)

            the only way I was able to make it work was a ugly ugly hack with adding mail-xxx.jar to javax.activation.api module as resource in that case it works like a charm

            here http://forum.springsource.org/showthread.php?69180-Problems-sending-MIME-multipart-mails&s=8b04b3db93b33e93850c493776bb31ec it is a good explanation where the main problem is (javax libs itself) and what can be done

            probably the best fix would be patching EE api jars..

            Show
            ctomc Tomaz Cerar added a comment - I have same problem, but in my case it goes for another module (mail subsystem) and no matter how I defined dependencies it does not work. as i found out the problem is that activation api is trying to load something that is in javax.mail and that does not work as there is no dependency to javax.mail, even if i add it as dependency it does not work (not sure if circular dependency is allowed at all) the only way I was able to make it work was a ugly ugly hack with adding mail-xxx.jar to javax.activation.api module as resource in that case it works like a charm here http://forum.springsource.org/showthread.php?69180-Problems-sending-MIME-multipart-mails&s=8b04b3db93b33e93850c493776bb31ec it is a good explanation where the main problem is (javax libs itself) and what can be done probably the best fix would be patching EE api jars..
            Hide
            dmlloyd David Lloyd added a comment -

            Tomaz I think in your case what you want is a dependency on "javax.activation.api" pointing to "javax.mail.api" as you have, except you should also add services="import" to that dependency line. Yes, circular dependencies are allowed but only if you do NOT turn on export="true".

            Show
            dmlloyd David Lloyd added a comment - Tomaz I think in your case what you want is a dependency on "javax.activation.api" pointing to "javax.mail.api" as you have, except you should also add services="import" to that dependency line. Yes, circular dependencies are allowed but only if you do NOT turn on export="true".
            Hide
            oranheim Ove Ranheim added a comment - - edited

            I retested mail (seam-mail 3.0.0.Alpha1) with as7.0.1 build 1519 (which is to my understanding the real 7.0.1 final). The following modification to activation module solves this issue:

            Workaround: modules/javax/activation/api/main/module.xml

            <module xmlns="urn:jboss:module:1.0" name="javax.activation.api">
             
                <dependencies>
                    <module name="javax.api"/>
                </dependencies>
             
                <resources>
                    <resource-root path="activation-1.1.1.jar"/>
                    <resource-root path="mail-1.4.4.jar"/>
                    <!-- Insert resources here -->
                </resources>
            </module>
            

            Copy modules/javax/mail/api/main/mail-1.4.4* modules/javax/activation/api/main/

            Show
            oranheim Ove Ranheim added a comment - - edited I retested mail (seam-mail 3.0.0.Alpha1) with as7.0.1 build 1519 (which is to my understanding the real 7.0.1 final). The following modification to activation module solves this issue: Workaround: modules/javax/activation/api/main/module.xml <module xmlns="urn:jboss:module:1.0" name="javax.activation.api"> <dependencies> <module name="javax.api"/> </dependencies> <resources> <resource-root path="activation-1.1.1.jar"/> <resource-root path="mail-1.4.4.jar"/> <!-- Insert resources here --> </resources> </module> Copy modules/javax/mail/api/main/mail-1.4.4* modules/javax/activation/api/main/
            Hide
            dmlloyd David Lloyd added a comment -

            This is not acceptable as a workaround. You should instead add a dependency on javax.mail.api in the <dependencies> section as I said; you probably also want services="import" on that line too. This should fix your problem just as well without resorting to copying JARs (which opens you up to CCEs).

            Show
            dmlloyd David Lloyd added a comment - This is not acceptable as a workaround. You should instead add a dependency on javax.mail.api in the <dependencies> section as I said; you probably also want services="import" on that line too. This should fix your problem just as well without resorting to copying JARs (which opens you up to CCEs).
            Hide
            ctomc Tomaz Cerar added a comment -

            i will take a look at this problem in the evening, and will try to find proper solution the way David explains...

            Show
            ctomc Tomaz Cerar added a comment - i will take a look at this problem in the evening, and will try to find proper solution the way David explains...
            Hide
            oranheim Ove Ranheim added a comment -

            David, if this is what you mean it doesn't work.

            <module xmlns="urn:jboss:module:1.0" name="javax.mail.api">
                <dependencies>
                    <module name="javax.activation.api" export="true"/>
                    <module name="javax.mail.api" services="import"/>
                    <module name="javax.api"/>
                </dependencies>
             
                <resources>
                    <resource-root path="mail-1.4.4.jar"/>
                    <!-- Insert resources here -->
                </resources>
            </module>
            

            Show
            oranheim Ove Ranheim added a comment - David, if this is what you mean it doesn't work. <module xmlns="urn:jboss:module:1.0" name="javax.mail.api"> <dependencies> <module name="javax.activation.api" export="true"/> <module name="javax.mail.api" services="import"/> <module name="javax.api"/> </dependencies>   <resources> <resource-root path="mail-1.4.4.jar"/> <!-- Insert resources here --> </resources> </module>
            Hide
            ctomc Tomaz Cerar added a comment -

            Fix is a bit different, it is necessary to import addition files from META-INF of mail.jar.

            javax.activation.api module must have depedencies defined like this:

            <module xmlns="urn:jboss:module:1.0" name="javax.activation.api">
            	<dependencies>
                    <module name="javax.api" />
                    <module name="javax.mail.api" >
                    	<imports><include path="META-INF"/></imports>
                    </module>	
            	</dependencies>        
                    
            	 <resources>
                    <resource-root path="activation-1.1.1.jar"/>
                        
            		<!-- Insert resources here -->
                </resources>
            </module>
            

            Show
            ctomc Tomaz Cerar added a comment - Fix is a bit different, it is necessary to import addition files from META-INF of mail.jar. javax.activation.api module must have depedencies defined like this: < module xmlns = "urn:jboss:module:1.0" name = "javax.activation.api" > < dependencies > < module name = "javax.api" /> < module name = "javax.mail.api" > < imports >< include path = "META-INF" /></ imports > </ module > </ dependencies > < resources > < resource -root path = "activation-1.1.1.jar" /> <!-- Insert resources here --> </ resources > </ module >
            Hide
            oranheim Ove Ranheim added a comment -

            Awesome! It works!

            Thank you

            Show
            oranheim Ove Ranheim added a comment - Awesome! It works! Thank you
            Hide
            ctomc Tomaz Cerar added a comment -

            fixed by AS7-1177

            Show
            ctomc Tomaz Cerar added a comment - fixed by AS7-1177
            Hide
            oranheim Ove Ranheim added a comment -

            How come this fix didn't make it for AS 7.0.2?

            Without the above configuration Seam Mail 3 doesn't work.

            http://seamframework.org/Seam3/MailModule

            Show
            oranheim Ove Ranheim added a comment - How come this fix didn't make it for AS 7.0.2? Without the above configuration Seam Mail 3 doesn't work. http://seamframework.org/Seam3/MailModule
            Hide
            tremes Tomas Remes added a comment -

            i am facing same problem on jboss-as-7.0.2.Final too

            Show
            tremes Tomas Remes added a comment - i am facing same problem on jboss-as-7.0.2.Final too
            Hide
            ctomc Tomaz Cerar added a comment -

            Fix is just in master and was not applied to 7.0.x version, it is in available in 7.1.x

            Show
            ctomc Tomaz Cerar added a comment - Fix is just in master and was not applied to 7.0.x version, it is in available in 7.1.x
            Hide
            tremes Tomas Remes added a comment -

            then it is ok.

            Show
            tremes Tomas Remes added a comment - then it is ok.
            Hide
            hantsy hantsy bai added a comment -

            I do not understand why javax.activation.api depends on java mail...and I open the java mail modules.xml, it depends on java activation.

            Show
            hantsy hantsy bai added a comment - I do not understand why javax.activation.api depends on java mail...and I open the java mail modules.xml, it depends on java activation.
            Hide
            ejroberts Ed Roberts added a comment -

            This fix is causing issue when exposing the javax.activation module as a capability to JBoss OSGi: The import is overriding the Manifest.mf
            of javax.activation and instead making javax.mail visible, which later causes problems with OSGi bundles wishing to use the Java Mail API.

            Do I need to raise a separate issue, or should this one be reopened ?

            Show
            ejroberts Ed Roberts added a comment - This fix is causing issue when exposing the javax.activation module as a capability to JBoss OSGi: The import is overriding the Manifest.mf of javax.activation and instead making javax.mail visible, which later causes problems with OSGi bundles wishing to use the Java Mail API. Do I need to raise a separate issue, or should this one be reopened ?
            Hide
            ctomc Tomaz Cerar added a comment -

            Ed,
            this looks like to be issue related just to OSGI, as fix for this issue actually enabled sending mail at all.
            open new issue for osgi subsystem.

            Show
            ctomc Tomaz Cerar added a comment - Ed, this looks like to be issue related just to OSGI, as fix for this issue actually enabled sending mail at all. open new issue for osgi subsystem.
            Hide
            ejroberts Ed Roberts added a comment -

            Thanks Tomaz. I have raised a new issue
            https://issues.jboss.org/browse/AS7-5187

            Show
            ejroberts Ed Roberts added a comment - Thanks Tomaz. I have raised a new issue https://issues.jboss.org/browse/AS7-5187

              People

              • Assignee:
                ctomc Tomaz Cerar
                Reporter:
                tremes Tomas Remes
              • Votes:
                0 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development