users@jersey.java.net

Re: [Jersey] Client API: Missing Dependency on Java Mail API?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 21 Oct 2008 10:00:44 +0200

Hi Jorge,

Thanks for catching this. The same will apply on the server side as
well. The DataSource provider is depending on a JavaMail utility
class. I can probably remove this dependency.

https://jersey.dev.java.net/issues/show_bug.cgi?id=131

Paul.

On Oct 20, 2008, at 9:34 PM, Jorge L Williams wrote:

>
> Just FYI,
>
> I looked here for guidance on dependencies when building a client
> application:
>
> https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0/jersey/dependencies.html
>
> The page suggested I add jersey-bundle.jar and jsr311-api.jar to my
> classpath which I did. When running my app I received this error...
>
> [java] Exception in thread "main"
> java.lang.NoClassDefFoundError: javax/mail/util/ByteArrayDataSource
> [java] at
> com
> .sun
> .jersey
> .impl
> .provider.entity.DataSourceProvider.readFrom(DataSourceProvider.java:
> 71)
> [java] at
> com
> .sun
> .jersey
> .impl
> .provider.entity.DataSourceProvider.readFrom(DataSourceProvider.java:
> 54)
> [java] at
> com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler
> $URLConnectionResponse.getEntity(URLConnectionClientHandler.java:156)
> [java] at
> com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler
> $URLConnectionResponse.getEntity(URLConnectionClientHandler.java:138)
> [java] at
> com.sun.jersey.api.client.WebResource.handle(WebResource.java:466)
> [java] at com.sun.jersey.api.client.WebResource.access
> $200(WebResource.java:64)
> [java] at com.sun.jersey.api.client.WebResource
> $Builder.post(WebResource.java:404)
>
> Adding the mail.jar from the Java MAIL API to my classpath resolved
> the issue. I understand the dependency page states that java-mail
> should be included when using MimeMultippart, but I didn't
> explicitly use this class in my code. I simply requested a
> DataSource as output when making a POST request.
>
> -jOrGe W.