Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven issue with classloads

 
Klament J. Kruoghst
Ranch Hand
Posts: 37
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic