users@jersey.java.net

Re: [Jersey] problem uploading file

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Fri, 30 Jul 2010 15:41:16 +0200

Hi,

Are you including the JavaMail API in the war? And there might be a
version conflict between the one in the war and one distributed with
JBoss? If so you might try to remove the one in the war it.

Alternatively you can upgrade Jersey because later versions (i cannot
recall which version specifically) changed from using JavaMail to
MimePull.

Paul.

On Jul 14, 2010, at 11:29 AM, captainbob wrote:

>
> Hi,
>
> i have a hard time trying to upload a file on my jersey server. I've
> followed instruction from several sources without any succes.
> My source code:
>
> Client side:
> <form action="http://localhost:8080/spiral-ws/assessment/uploadFile"
> method="post" enctype="multipart/form-data">
> <input type="file" name="file"/>
> <button type="submit">Upload</button>
> </form>
>
> Server side:
> @POST @Path("/uploadFile")
> @Consumes(MediaType.MULTIPART_FORM_DATA)
> @Produces(MediaType.TEXT_PLAIN)
> public String upload(@FormDataParam("file") InputStream fileInpStr)
> throws
> IOException {
> FileOutputStream fos = new FileOutputStream("myfile.tgz");
> IOUtils.copy(fileInpStr, fos);
> return "Done.";
> }
>
> Im using maven for this project, so according to
> https://jersey.dev.java.net/nonav/documentation/latest/user-
> guide.html#d4e1636
> the jersey guide ,
> I added the jersey-multipart dependency to my pom.xml.
>
> But when my client contact my server im getting this error:
>
> "java.lang.LinkageError: loader constraint violation: when resolving
> method
> "javax.mail.internet.MimeMultipart.<init>(Ljavax/activation/
> DataSource;)V"
> the class loader (instance of
> org/jboss/classloader/spi/base/BaseClassLoader) of the current class,
> com/sun/jersey/core/impl/provider/entity/MimeMultipartProvider, and
> the
> class loader (instance of org/jboss/classloader/spi/base/
> BaseClassLoader)
> for resolved class, javax/mail/internet/MimeMultipart, have
> different Class
> objects for the type javax/activation/DataSource used in the
> signature"
>
> It seems there is a conflict on MimeMultipart but I have really no
> clue what
> to do to resolve it.
> If someone had the solution and would be kind enough to share it. ^^
> Thx.
>
>
>
>
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/problem-uploading-file-tp5291752p5291752.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>