1 Reply Latest reply on Sep 5, 2006 9:00 AM by asack

    Classloading scope during @PostConstruct lifecycle call with

    asack

      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!