[jboss-user] [EJB 3.0] - Re: xml configuration file for application

ALRubinger do-not-reply at jboss.com
Tue Feb 19 23:54:37 EST 2008


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130607#4130607

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130607



More information about the jboss-user mailing list