aspose file tools*
The moose likes Websphere and the fly likes property file with same name in two jars gets confused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "property file with same name in two jars gets confused" Watch "property file with same name in two jars gets confused" New topic
Author

property file with same name in two jars gets confused

Irene Loos
Ranch Hand

Joined: Apr 15, 2002
Posts: 78
Hi,
We have two J2EE applications running on WAS 6.1. Application use library of jars that setup thru classpath. There is a property file with the same name but under different folder structure in two different jars. Application 1 points to file from first jar, application 2 points to a file from jar 2, but sometimes, application 1 pulls the file from jar 2 - how is that possible? The behavior is random.

Thank you


Irene Loos
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Irene,
How you are loading the property file? By file name or path? For example, A.properties vs b/c/A.properties?


[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
Irene Loos
Ranch Hand

Joined: Apr 15, 2002
Posts: 78
Hi Jeanne,
The java class in the applciation that class it has an import statement to a class in reusbale jar that is linked thru shared libraries. Shared jars all located in the same folder.

The applciation has xml properties. The file that we need to use i specified here:
<resource
name="datasource.n1n.validate_buffers"
basepath="projects/transactions"
startpath="projects/transactions"
pattern="validate_buffers.properties">
</resource>

Once it is in the reusbale jar, the clas has following:

ResourceManager serverResources = ResourceRegistry.getInstance().get("datasource.n1n.server");
ResourceManager transactionResources = ResourceRegistry.getInstance().get("datasource.n1n.validate");
ResourceBundle transactionProperties = transactionResources.asResourceBundle();
ResourceBundle bufferProperties = ResourceRegistry.getInstance().get("datasource.cics.validate_buffers").asResourceBundle();

from there it will attempt to use property file and randonly will go to file that is called from another application that has following in xml properties:
<resource
name="datasource.n1n.validate_buffers"
basepath="projects/components/bproject/finder"
startpath="projects/components/bproject/finder"
pattern="properties/validate_buffers.properties">
</resource>


Irene
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Hmm. Those files clearly have different paths in the XML. I'm not familiar with that tag though.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Have you tried using different names for the resources? Given them the same name is bound to cause confusion at the least.


Ping & DNS - my free Android networking tools app
Irene Loos
Ranch Hand

Joined: Apr 15, 2002
Posts: 78
Thank you for all replies. We wil lbe changing the name of property file to be unique in each application.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: property file with same name in two jars gets confused