[jboss-user] [EJB/JBoss] - Re: PostConstruct loadClass fails when porting to JBoss 5
do-not-reply at jboss.com
Mon Jul 27 18:48:13 EDT 2009
"jcstaff2" wrote : If obtaining the current classloader is illegal/non-portable, how does one read in a data file from the EJB's classpath? Is there a legal classloader we can access that will have the file Resource that can be read in as a stream?
In general, use of File (and other I/O) resources is frowned upon in EJB because again you've got the issue of application code directly accessing something by bypassing the abstraction provided by the container. This means that nothing is guarding it from concurrent access, providing rollback capabilities, etc.
For *non-mutable* resources, like reading in properties, you can package these inside your EJB JAR and get at them via this.getClass().getResource() in your bean implementation class.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4246306#4246306
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4246306
More information about the jboss-user