• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set different classpath for two different application on WAS

 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34202
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mikalai Zaikin
Ranch Hand
Posts: 3332
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic