-
1. Re: xml configuration file for application
alrubinger Feb 19, 2008 11:54 PM (in response to bfach)Looks like the real issue you're asking is "How do I access the ClassLoader for a given XML file?"
This would enable you to do cl.getResourceAsStream("whatever.xml");
However, the JEE spec leaves room for vendors to plug in their own custom classloading strategies to enable features such as hot deployment. So you've got no hook to access the CL you need.
Since classes are linked to the CL that defined them, you might try packaging your XML in an EJB JAR, and then attempting to get to it by saying something like:MyBeanRemote.class.getClassLoader().getResourceAsStream("whatever.xml")
...but this would assume that the same CL was used for all resources in your EJB JAR.
I think a better question to ask is: what are you doing that requires you to access something packaged in your application's deployable units? Surely there's a more elegant way for you to get at this configuration?
S,
ALR -
2. Re: xml configuration file for application
bfach Feb 20, 2008 1:02 PM (in response to bfach)Andrew,
Thanks for the reply. What I am attempting to do is get a few small pieces of information to a MDB packaged in an ear file. This information is bootstrap for the application and therefore needs to be given someone prior to deployment.
I have packaged the XML in the .ear file however this has not solved the problem. Is there a better way to approach this?
I attempted to configure using the deployment descriptor xml as you would do it with a .sar however this did not seem to work.
Am I going about this the wrong way?
Thanks,
Brad