GeeCON Prague 2014*
The moose likes Websphere and the fly likes How to set different classpath for two different application on WAS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Websphere
Bookmark "How to set different classpath for two different application on WAS" Watch "How to set different classpath for two different application on WAS" New topic
Author

How to set different classpath for two different application on WAS

Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi All,

I have installed two different WAR.. testA.war and testB.war on webspehere -7. I am reading property file from classpath in testB.war. but my application look property file at testA.war
both WAR has been deployed on single jvm.
Can anyone suggest how individual application read file from its own classpath like from ............/ testB.war /WEB-INF/classes.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

If they are sharing a JVM, they are sharing a classpath. Is there a reason you can't deploy them on different JVMs since they are different apps? Or have them use different property file names so there aren't conflicts?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3211
    
    6
Jeanne Boyarsky wrote:If they are sharing a JVM, they are sharing a classpath. Is there a reason you can't deploy them on different JVMs since they are different apps? Or have them use different property file names so there aren't conflicts?


@Jeanne, Application in WebSphere can use multiple classloaders hierarchy (JVM, Application-level, Module-level) and WAS has settings to define which classloader should attempt to load class (or property file in our case) first.

So, if setting parent (JVM) first - the property loaded via JVM's classloader (delegaed to lower level classloaser), and will be loaded only once for both WAR applications.

If setting is parent last (i.e. module first), then each WAR module uses in first turn own classloader, and properties will be loaded from separate files for separate Web modules.

@Harshal, please, refer this redpaper

Best regards,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
 
GeeCON Prague 2014
 
subject: How to set different classpath for two different application on WAS