• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.properties files in the root of the .ear

 
Peter Storch
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • 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.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • 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
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic