This discussion is archived
4 Replies Latest reply: Feb 29, 2012 7:25 AM by 920864 RSS

WebLogic, Jersey, @FormDataParam

SandersTheSoftwarer Newbie
Currently Being Moderated
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.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points