• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

.properties files in the root of the .ear

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I asked this question in the EJB and J2EE forum but couldn't get an appropriate answer. This forum is more EJB spec oriented, so I try again.
If I deploy .properties files in the root of my .ear file. My classes can find them via getResource() or getResourceAsStream() as they where on the class path (at least on WebSphere).
But I don't know if this is according to the EJB / J2EE spec. I couldn't find a statement if files in the root of the .ear are automatically included in the classpath and available to the ejb and web modules within the enterprise project.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,
I guess that ear root must be in the classpath regardless of the appserver because otherwise how would it find classes?
Now, if my above statement is correct then it would not matter what appserver you are using, if you put properties file in the ear root it is going to work via getResourceAsStream() thing.
Any other ideas?
Regards
Maulin
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not surprised that the spec does not mention files, because they are banned:

An enterprise bean must not use the java.io package to attempt to access files and directories in the file system.


Although it may be too late to change things now, a solution consistent with the spec would be to store such data in a database for subsequent loading into a Properties or HashMap, or to use the bean's java:comp/env context.
 
Peter Storch
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Maulin Vasavada:
I guess that ear root must be in the classpath regardless of the appserver because otherwise how would it find classes?


I could've guessed that too, because it works for me. But I still don't know if this is just WebSpher magic or is this according to the specs?
 
Evacuate the building! Here, take this tiny ad with you:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic