File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes maven issue with classloads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "maven issue with classloads" Watch "maven issue with classloads" New topic

maven issue with classloads

Klament J. Kruoghst
Ranch Hand

Joined: Oct 24, 2008
Posts: 37
Hi there,

I'm trying to package under the EAR an EJB and a WAR with maven... it all builds fine and deploys.. when i try to perform any action sitting in my war I get:

java.lang.ClassNotFoundException: at weblogic.utils.classloaders.GenericClassLoader.findLocalClass( at weblogic.utils.classloaders.GenericClassLoader.findClass( at java.lang.ClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at weblogic.utils.classloaders.GenericClassLoader.loadClass( at java.lang.Class.forName0(Native Method) at java.lang.Class.forName( at ....

Here is in my WAR. all my action classes are in my WAR, the GUI where the action is being triggered from obviously is in the WAR also, so why won't these actions be picked up? I also tried setting <prefer-web-inf-classes>true</prefer-web-inf-classes> and rebuild, restarting the server, cleaning cache, it didn't work either. What can i do in maven to get my app finding the class in its own war?.

I also tried using the following on my war pom for struts.jar which is the only lib that has the same dependency on the ear, but that didn't work either.

Why can't my EAR pick up my action classes in the war!

Peter Johnson

Joined: May 14, 2008
Posts: 5852

Exactly where is located within your WAR?

I also tried using the following on my war pom for struts.jar

A scope of provided means that you don't want to package the JAR in the WAR because the JAR is already provided by the servlet container. I suspect that is not the case, thus you shouldn't be using provided.

Why can't my EAR pick up my action classes in the war!

Now this is a completely different question. Classes in the EAR cannot see any classes in the WAR. This is a standard Java EE scoping policy. Unfortunately, you didn't provide the full exception stack trace, so I can't tell exactly which class is trying to load MyActionClass. Did you, by any chance, package struts.jar in your EAR (whether it is in the WAR or not) because if you did and it is those classes that are trying top load your action classes, it won't work.

JBoss In Action
jQuery in Action, 3rd edition
subject: maven issue with classloads
It's not a secret anymore!