[jboss-user] [Beginner's Corner] - EAR+WAR+EJB ... cannot find resource ... classloader problem on my side?

zecas zecas do-not-reply at jboss.com
Tue Mar 22 14:38:32 EDT 2011


zecas zecas [http://community.jboss.org/people/zecas] created the discussion

"EAR+WAR+EJB ... cannot find resource ... classloader problem on my side?"

To view the discussion, visit: http://community.jboss.org/message/594878#594878

--------------------------------------------------------------
I'm having a serious problem putting a project to work. It really is hold back my advance in the project, and I'm getting very frustrated with this.


Maybe someone can help me here ... I hope so.


I have the following structure:


project.ear
+- load-api.jar
+- webapp.war
   +- WEB-INF
      +- classes
               +- config.properties
+- myejb.jar




Components:


load-api.jar - jar package that loads stuff, including "config.properties" from classpath.
Uses something like:
OneClass.class.getClassLoader().getResourceAsStream( "config.properties" );


webapp.war - simple war module, the only one that depends on "load-api.jar"
Executes a servlet context listener on startup, that will load "config.properties" through "load-api.jar".


myejb.jar - simple EJB3 project, that has a simple EJB component that does nothing at this time.




Now I need to use from within the EJB project a class that is defined on "load-api.jar". What I did was just to add a dependency to "load-api.jar", and nothing more (manifest.mf gets updated with jar info). Before I even add a line of code, my project stops working.


What happens: the listener executed from within "webapp.war" fails to find the "config.properties" resource.


The "config.properties" resource is still defined inside the "WEB-INF->classes" folder of the "webapp.war", like before. But seems that the classloader fails to find it, as if it searches for it inside the EJB ...


I believe this should be normal ... but why is it? Can I change this behaviour? Is it a manifest.mf classpath problem?


This seems to be a matter of classloading-hell, as I've heard of it. The solution is to pull everything to the EJB? And if it is, will it work the same way in other application server JavaEE compliant?




Thanks
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/594878#594878]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110322/f76173cf/attachment.html 


More information about the jboss-user mailing list