aspose file tools*
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
Author

maven issue with classloads

Klament J. Kruoghst
Ranch Hand

Joined: Oct 24, 2008
Posts: 37
    
    1
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: this.is.MyActionClass1 at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at ....

Here this.is.MyActionClass1 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.
<type>pom</type>
<scope>provided</scope>

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

Thanks,
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

Exactly where is this.is.MyActionClass1 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: maven issue with classloads