This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How to change the Import order of jar files in WAS

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an application where i have 2 jar files a.jar and b.jar in the LIB folder under WEB-INF. Some of the classes in b.jar are the newer version of classes that are present in a.jar. When I trying to run the application a.jar is imported first and hence new classes of b.jar are not called.

How can i change the import order of jar files in WAS5.1 so that b.jar is imported first ?

Any help would be highly appreciated.

Thnx,
Kartik
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why cant you have one final version of the jar? I believe it is not a good way to pack the same classes in two different jars. Instead of trying to solve this symptom, why cannot you try to solve the root cause.

Having said that if you still have to do it your existing way, in the manifest.mf of your war or ejb.jar move the b.jar above in the order than a.jar. This is assuming you have mentioned the classpath of the jars in the manifest.mf.

If you have used shared libraris for defining the class path perform the same procedure there.
 
kartik bansal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thnx for the reply.. actually i am trying to use a separate tool in my existing app for testing purpose so need to do this for time being..

i have not mentioned classpath in manifest.mf file.. but if i just include these 2 files in the order i want in the manifest.mf then will it work or will i have to include all the other jars also..
 
Vijay K Vivek
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes it will work. In the manifest.mf of your war, mention it in the proper order as per my previous post it should work.

Also there is an alternative and I usually do this. I will remove the unwanted classes from the other jar (which have older version) and repack it. This way there will be no confusion as such.

In your case remove the classes from a.jar. This can be done because anyways it is just for your testing purpose and temporary as you have mentioned.
 
author and cow tipper
Posts: 5006
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you might want to look at is the various J2EE classloaders.

There are about 5 core classloaders that work for a J2EE application, and they work on a hierarchy. If you move a.jar into the path of one classloader, and b.jar onto the path of another classloader that is above a on the classloader heirarchy, you will always have consistent classloading behavior.

Still, I don't like having multiple versions on the classpath. It's ugly.

Here's a great article on J2EE classloaders. It might give you some ideas:

How J2EE Classloaders Work - Parent First and Parent Last and Stuff

-Cameron McKenzie
 
You showed up just in time for the waffles! And 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