Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

WSAD 5.1.2 and JDOM

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to use JDOM on my project. On the the server, I have WAS 5.1. I found jdom.jar in $WAS_HOME/lib.

In my WSAD project, I added a reference to jdom.jar on my development machine.

1. Window > Preferences > Java > Classpath Variables, created a new variable, JDOM that points to c:\jdom-1.0\build\jdom.jar

2. Project > Properties > Java Build Path > Libraries > Add Variable..., JDOM

This allows WSAD to properly resolve all references to org.jdom.*. However, when I build the EAR and deploy it to the server, it cannot locate the jdom.jar file during deployment. I get this error in SystemOut.log:

[7/17/06 15:37:16:140 EDT] 1ea2c28f EJBContainerI E WSVR0040E: addEjbModule failed for queueMdbEJB.jar [class com.ibm.ws.runtime.com
ponent.DeployedModuleImpl]
java.lang.NoClassDefFoundError: org/jdom/Content

Does that mean it cannot locat the jdom.jar file?

What is the proper way to resolve this? Since There is a jdom.jar on the server, I would prefer to use it as opposed to embedding one in my EAR.

Thanks!
Andrew
 
Marshal
Posts: 25671
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The normal procedure is to put any external jar files your application needs into its WEB-INF/lib directory and export that in the WAR or EAR file. It may also be possible to configure them into your Websphere server's classpath, but that can lead to strange behaviour and it isn't normally recommended.
 
andrew pierce
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul, thanks for replying. Since this happens to be an EJB project (only containing one MDB), I don't have a WEB-INF/lib directory.

I tried creating a lib directory in the EJB project and importing the jar into it. I redployed the EAR witout any errror. When I start the application, it thows that exception : java.lang.NoClassDefFoundError: org/jdom/Content.

I left the jdom.jar file in the project and commented all the code references to jdom. When I deployed and started this version, it worked. That is, there were no errors; it didn't do any of the JDom stuff of course.

So should the lib/jdom.jar go under the "ejbModule" folder in WSAD? Or am I just missing something?

Thanks again.
Andrew
 
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to use JDOM in Websphere, you need to use PARENT_LAST classloading instead of PARENT_FIRST
 
andrew pierce
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean, thanks for the reply. I changed the Classloader mode on the application to PARENT_LAST instead of PARENT_FIRST. However, when I try to start the app, I still get this:

[7/18/06 21:47:41:776 EDT] 7e8f5177 ApplicationMg A WSVR0200I: Starting application: queueMdb
[7/18/06 21:47:41:818 EDT] 7e8f5177 EJBContainerI I WSVR0207I: Preparing to start EJB jar: queueMdbEJB.jar
[7/18/06 21:47:41:839 EDT] 7e8f5177 EJBContainerI I WSVR0037I: Starting EJB jar: queueMdbEJB.jar
[7/18/06 21:47:41:854 EDT] 7e8f5177 EJBContainerI E WSVR0040E: addEjbModule failed for queueMdbEJB.jar [class com.ibm.ws.runtime.component.DeployedModuleImpl]
java.lang.NoClassDefFoundError: org/jdom/Content

Thanks again for the help. Any more ideas?
Andrew
 
Paul Clapham
Marshal
Posts: 25671
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't ever used EJBs, so what I say may not be useful in your context. I recall at one point I had some jars in my EAR file, and my WAR file could use those jars with no problem. But I took them out and moved them to the WAR (basically for aesthetic reasons). I believe they were in the root of the EAR project in WSAD, not in a lib directory, and there must have been some configuration in my WAR project, but I don't remember exactly.
 
andrew pierce
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have figured this out with the help of a co-worker. The utility jar (jdom.jar) needed to be added to the META-INF/MANIFEST.MF file in my EJB project. Right mouse click on that file and select Open with... > JAR Dependency Editor and put a check mark next to it in the Dependencies table.

Export and redeploy and it worked.

One caveat, I was getting another error, this time something about "Incompatible argument to method..." I change the Classloader Mode on the application to PARENT_LAST and it worked. I suppose this is because WAS is using a different version of JDOM and there are some differences in the method signatures between versions. Changing the Classloader Mode to look in my app first to resolve classes fixed the problem.
 
Yup, yup, yup. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic