Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

maven issue with classloads

 
Ranch Hand
Posts: 37
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Onion rings are vegetable donuts. Taste this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic