[jboss-user] [EJB 3.0] - Classloading scope during @PostConstruct lifecycle call with

asack do-not-reply at jboss.com
Fri Sep 1 16:18:18 EDT 2006


404GA, CallByValue/Scoped EArs was selected during install, XP SP2

I have a SLSB and I'm trying to grab a resource using the getResourceAsStream call (at least indirectly within a JAR packaged in my EAR via a Class-Path MANIFEST entry).

I noticed that unless I set the ContextClassLoader to the loader of the class, it can't find the resource.

Let me explain:

EAR:
my.jar
resource.file
lib/my-lib.jar

my.jar
ClassPath: lib/my-lib.jar

my-lib.jar has a function that call that sets the current classloader to the thread and tries to load the resource name passed in.

If I execute this function within a @PostConstruct lifecycle call, the resources within my EAR aren't visisble.

This seems like a bug.  Is the classloader different during lifecycle calls?

Thanks!

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

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



More information about the jboss-user mailing list