Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

WebLogic, Jersey, @FormDataParam

SandersTheSoftwarerNov 25 2011 — edited Feb 29 2012
Hi, guys, I'm glad to see you and I would gladmost if you'll help with a little trouble.

I'm started with RESTful application built with Jersey (1.6) & deployed into WebLogic (from Fusion Middleware 11.1.1.4.0). Application developed & deployed using JDeveloper (from this Fusion Middleware too). Application works fine.

My current task is to add file upload service. As of many guides, I had downloaded jersey-multipart & mimepull jars and developed service like this:

@Path("/file/load")
public class LoadFileService {

@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(
@FormDataParam("file") InputStream file,
@FormDataParam("file") FormDataContentDisposition fileDetail)
{
String fileName = fileDetail.getFileName();
...

After this WebLogic failed to load new application. I tried several ways, generally it isn't working. More precise:

1. If application doesn't contain @FormDataParam annonation, WebLogic accepts it.

2. If application contains @FormDataParam (no other changes made), deployment fails with ClassNotFound exception:

[01:50:55 PM] [Deployer:149193]Operation 'deploy' on application 'metansi' has failed on 'AdminServer'
[01:50:55 PM] [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application metansi on ReliableWseeJaxwsSAFAgent,AdminServer,WseeJaxwsJmsServer.: java.lang.NoClassDefFoundError: com/sun/jersey/spi/inject/Errors$1.
[01:50:55 PM] Weblogic Server Exception: java.lang.ClassNotFoundException: com.sun.jersey.spi.inject.Errors$1
[01:50:55 PM] See server logs or server console for more details.
[01:50:55 PM] java.lang.ClassNotFoundException: com.sun.jersey.spi.inject.Errors$1

Server logs give no any interesing tips, primary exception is

java.lang.ClassNotFoundException: com.sun.jersey.spi.inject.Errors$1 at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270) at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179) at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43) at java.lang.Class.getDeclaringClass(Native Method) at java.lang.Class.getEnclosingClass(Class.java:1085) at java.lang.Class.getCanonicalName(Class.java:1169) at weblogic.deploy.internal.targetserver.DeployHelper.handleUnTranferableCause(DeployHelper.java:469) at

Sure, I checked whether /jersey/spi/inject/Errors$1.class exists in my war file. It exists & looks fine.

I tried to use <container-descriptor><prefer-web-inf-classes>true</prefer-web-inf-classes></container-descriptor> for ensuring that my jars really used. There were several other issues, at last I got the same error.

Now I'm going to try several Jersey versions, maybe one of them would work. But it would fine if you tip something about this issue or resolving such issues in general.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 28 2012
Added on Nov 25 2011
4 comments
4,268 views