Hi,

Thanks for the recommendation.  Will try forthwith.

Do you happen to know of any publicly accessible Maven or OSGI Repositories that might have that combined bundle already?

John K

On 10/9/12 11:54 PM, Felix Meschberger wrote:
Hi,

You already removed the javax.mail and javax.activation from the system 
packages in the felix config. This is fine.

Other than that we experienced that the mail and activation libraries are quite 
intertwined and our best experience with those was to actually have a single 
bundle combining both bundles. This way, they have access to their internals, 
which they seem to expect...

But then, some bundle must provide the "application/atom+xml" data handler and 
I am not sure whether this is part of either the javax.mail or javax.activation libraries 
....

Regards
Felix

Am 10.10.2012 um 03:16 schrieb John King:

Folks,

I have recently started working on the Opencast Matterhorn project which
involves capturing, trans-coding and distribution of digital video files.

One of the services we distribute to is YouTube.  As I understand it,
the Matterhorn module that does this worked fine in Felix 3 but now
fails in Felix 4.

We are running the application with Java 1.6.

The stack trace for this error:
17:08:44 WARN (YoutubeDistributionService:418) - Error distributing
http://localhost:8080/files/mediapackage/a78f4054-9b79-4d87-b938-08547d495a9d/49a4dfe4-91bf-4450-b186-e0d8f24a53cd/test3.mp4

javax.activation.UnsupportedDataTypeException: application/atom+xml
     at javax.activation.DataHandler.writeTo(DataHandler.java:75)
     at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:452)
     at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:157)
     at
com.google.gdata.wireformats.output.media.MediaMultipartGenerator.generate(MediaMultipartGenerator.java:58)
     at
com.google.gdata.wireformats.output.media.MediaMultipartGenerator.generate(MediaMultipartGenerator.java:37)
     at com.google.gdata.client.Service.writeRequestData(Service.java:2071)
     at
com.google.gdata.client.media.MediaService.insert(MediaService.java:398)
     at
org.opencastproject.distribution.youtube.YoutubeDistributionService.distribute(YoutubeDistributionService.java:344)
     .......................

Obviously the google gdata code, specifically gdata-media, is in play
here along with javax.mail and javax.activation.

In the Felix 4 context we are using the following javax.mail and
javax.activation bundles from Geronimo
geronimo-activation_1.1_spec-1.1.jar and
geronimo-javamail_1.4_mail-1.8.3.jar

Googling for this error, I found the following thread that discusses a
problem that seems closely analogous to our problem,
http://forum.springsource.org/archive/index.php/t-69180.html

The container in that discussion is the Spring dm Server but the error
and likely cause seem relevant.  See especially the posting on Mar 21st,
2009 by oleg.zhurakousky.

Note particularly that the root cause is likely not an
UnsupportedDataTypeException but a ClassNotFoundException for one of the
classes in com.sun.mail.handlers that becomes the
UnsupportedDataTypeException. Quoting the thread " This results in the
DataContentHandler for your MIME type being null which is the root of
your exception. "

I have tried explicitly importing the Geronimo javax.mail and
javax.activation bundles using <Import-Bundle> and <Embed-Dependency> as
an analogous fix to that in the Spring thread but that doesn't fix our
problem.  I've tried several other javax.mail and javax.activation
bundles e.g. from Spring but with no luck.  Manipulating the
ClassLoaders as discussed there doesn't seem possible as the error is
being generated in the gdata code and, in any event, that approach seems
evil.

Any pointers or suggestions are most welcome.  For example, should I
explicitly import com.sun.mail.handlers.* even though neither our code
nor the gdata code calls them directly?  That also seems evil to me.

I've looked at all the imports in the system/console/bundles UI for our
bundle and the Geronimo bundles and everything appears consistent namely
that our YouTube bundle is importing the javax.mail packages from the
Geronimo bundle.  Also the Geronimo mail bundle is importing
javax.activation bundle from the Geronimo mail bundle.

Relevant sections of the Felix 4 config for our app are:

# Packages 'javax.xml.stream, javax.xml.stream.events,
javax.xml.stream.util' removed --> provided by ServiceMix STAX bundle
# Packages 'javax.mail, javax.mail.internet' removed --> provided by
Geronimo JavaMail bundle
org.osgi.framework.system.packages=org.osgi.framework;version=1.6.0,org.osgi.framework.hooks.bundle;version=1.0.0,org.osgi.framework.hooks.resolver;version=1.0.0,org.osgi.framework.hooks.service;version=1.1.0,org.osgi.framework.hooks.weaving;version=1.0.0,org.osgi.framework.launch;version=1.0.0,org.osgi.framework.startlevel;version=1.0.0,org.osgi.framework.wiring;version=1.0.0,org.osgi.service.packageadmin;version=1.2.0,org.osgi.service.startlevel;version=1.1.0,org.osgi.service.url;version=1.0.0,org.osgi.util.tracker;version=1.5.0,javax.accessibility,
javax.activity, javax.annotation, javax.annotation.processing,
javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.imageio,
javax.imageio.event, javax.imageio.metadata, javax.imageio.plugins.bmp,
javax.imageio.plugins.jpeg, javax.imageio.spi, javax.imageio.stream,
javax.jws, javax.jws.soap, javax.lang.model, javax.lang.model.element,
javax.lang.model.type, javax.lang.model.util, javax.management,
javax.management.loading, javax.management.modelmbean,
javax.management.monitor, javax.management.openmbean,
javax.management.relation, javax.management.remote,
javax.management.remote.rmi, javax.management.timer, javax.naming,
javax.naming.directory, javax.naming.event, javax.naming.ldap,
javax.naming.spi, javax.net, javax.net.ssl, javax.print,
javax.print.attribute, javax.print.attribute.standard,
javax.print.event, javax.rmi, javax.rmi.CORBA, javax.rmi.ssl,
javax.script, javax.security.auth, javax.security.auth.callback,
javax.security.auth.kerberos, javax.security.auth.login,
javax.security.auth.spi, javax.security.auth.x500, javax.security.cert,
javax.security.sasl, javax.sound.midi, javax.sound.midi.spi,
javax.sound.sampled, javax.sound.sampled.spi, javax.sql,
javax.sql.rowset, javax.sql.rowset.serial, javax.sql.rowset.spi,
javax.swing, javax.swing.border, javax.swing.colorchooser,
javax.swing.event, javax.swing.filechooser, javax.swing.plaf,
javax.swing.plaf.basic, javax.swing.plaf.metal, javax.swing.plaf.multi,
javax.swing.plaf.synth, javax.swing.table, javax.swing.text,
javax.swing.text.html, javax.swing.text.html.parser,
javax.swing.text.rtf, javax.swing.tree, javax.swing.undo, javax.tools,
javax.transaction, javax.transaction.xa, javax.xml, javax.xml.bind,
javax.xml.bind.annotation, javax.xml.bind.annotation.adapters,
javax.xml.bind.attachment, javax.xml.bind.helpers, javax.xml.bind.util,
javax.xml.crypto, javax.xml.crypto.dom, javax.xml.crypto.dsig,
javax.xml.crypto.dsig.dom, javax.xml.crypto.dsig.keyinfo,
javax.xml.crypto.dsig.spec, javax.xml.datatype, javax.xml.namespace,
javax.xml.soap, javax.xml.transform, javax.xml.transform.dom,
javax.xml.transform.sax, javax.xml.transform.stax,
javax.xml.transform.stream, javax.xml.validation, javax.xml.ws,
javax.xml.ws.handler, javax.xml.ws.handler.soap, javax.xml.ws.http,
javax.xml.ws.soap, javax.xml.ws.spi, javax.xml.ws.wsaddressing1,
javax.xml.xpath, org.ietf.jgss, org.omg.CORBA, org.omg.CORBA_2_3,
org.omg.CORBA_2_3.portable, org.omg.CORBA.DynAnyPackage,
org.omg.CORBA.ORBPackage, org.omg.CORBA.portable,
org.omg.CORBA.TypeCodePackage, org.omg.CosNaming,
org.omg.CosNaming.NamingContextExtPackage,
org.omg.CosNaming.NamingContextPackage, org.omg.Dynamic,
org.omg.DynamicAny, org.omg.DynamicAny.DynAnyFactoryPackage,
org.omg.DynamicAny.DynAnyPackage, org.omg.IOP,
org.omg.IOP.CodecFactoryPackage, org.omg.IOP.CodecPackage,
org.omg.Messaging, org.omg.PortableInterceptor,
org.omg.PortableInterceptor.ORBInitInfoPackage, org.omg.PortableServer,
org.omg.PortableServer.CurrentPackage,
org.omg.PortableServer.POAManagerPackage,
org.omg.PortableServer.POAPackage, org.omg.PortableServer.portable,
org.omg.PortableServer.ServantLocatorPackage, org.omg.SendingContext,
org.omg.stub.java.rmi

# specs
felix.auto.start.2= \
  .......
  file:${felix.home}/lib/ext/geronimo-activation_1.1_spec-1.1.jar \

# libraries
felix.auto.start.3= \
  ......
  file:${felix.home}/lib/ext/geronimo-javamail_1.4_mail-1.8.3.jar \
  file:${felix.home}/lib/ext/jolokia-osgi-1.0.4.jar


Relevant sections of the pom.xml for our YouTubeDistribution module
looks like:
     <!-- Youtube delivery dependencies -->

     <dependency>
       <groupId>gdata</groupId>
       <artifactId>gdata-client</artifactId>
       <version>1.0</version>
       <classifier>1.45.0</classifier>
     </dependency>

     <dependency>
       <groupId>gdata</groupId>
       <artifactId>gdata-core</artifactId>
       <version>1.0</version>
       <classifier>1.45.0</classifier>
     </dependency>

     <dependency>
       <groupId>gdata</groupId>
       <artifactId>gdata-media</artifactId>
       <version>1.0</version>
       <classifier>1.45.0</classifier>
     </dependency>

     <dependency>
       <groupId>gdata</groupId>
       <artifactId>gdata-youtube</artifactId>
       <version>2.0</version>
       <classifier>1.45.0</classifier>
     </dependency>

     <dependency>
       <groupId>gdata</groupId>
       <artifactId>gdata-youtube-meta</artifactId>
       <version>2.0</version>
       <classifier>1.45.0</classifier>
     </dependency>
..........................
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <version>2.0.1</version>
         <extensions>true</extensions>
         <configuration>
           <instructions>
             <Bundle-SymbolicName> ${project.artifactId}
</Bundle-SymbolicName>
             <Private-Package>
               com.google.*;-split-package:=merge-first,
               org.jdom.*,
               flexjson,
             </Private-Package>
             <Import-Package>
               *;resolution:=optional
             </Import-Package>
             <Export-Package>
org.opencastproject.deliver.youtube.*;version=${project.version},
org.opencastproject.distribution.youtube.*;version=${project.version}
             </Export-Package>
             <Embed-Dependency>
               flexjson;inline=true,
               gdata-client;inline=true,
               gdata-core;inline=true,
               gdata-media;inline=true,
               gdata-youtube;inline=true,
               google-collections;inline=true,
             </Embed-Dependency>
             <Service-Component>
               OSGI-INF/distribution-service-youtube.xml
             </Service-Component>
           </instructions>
         </configuration>
       </plugin>


--
John King
Applications Programmer
Learning Systems Group
Educational Technology Services
9 Dwinelle Hall - Mail
117 Dwinelle Hall - Office
University of California
Berkeley, CA 94720-2535
Phone: 510-529-5074
Email: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



--
John King
Applications Programmer
Learning Systems Group
Educational Technology Services
9 Dwinelle Hall - Mail
117 Dwinelle Hall - Office
University of California
Berkeley, CA 94720-2535
Phone: 510-529-5074
Email: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to