1 2 Previous Next 19 Replies Latest reply on Dec 21, 2006 5:13 PM by bill.burke Go to original post
      • 15. Re: java:comp.ejb3 versus java:comp
        bill.burke

        Carlo, that actually will cause problems specifically when you have nested EJB 2/3 invocations

        • 16. Re: java:comp.ejb3 versus java:comp
          bill.burke

          the logic is simple. If there is no tag on the stack, then use the context classloader. EJB containers push/pop their ENC ID on the stack.

          • 17. Re: java:comp.ejb3 versus java:comp
            wolfc

            But what happens then if I make an EJB2 call from an EJB3 session bean?

            • 18. Re: java:comp.ejb3 versus java:comp
              bill.burke

              I will modify EJB2 container to work the same as EJB3.

              • 19. Re: java:comp.ejb3 versus java:comp
                bill.burke

                Ok, I finished this. EJB 2.1 and EJB 3.0 are now unified. WAR still has to implement push/pop of ENC ID, but EJB invoking on a servlet in the same thread should be impossible right now.

                so the way it works is EJB(2 or 3) pushes its ID (ObjectName) onto a stack stored in a ThreadLocal before it does an invocation (callback, whatever). It pops this ID from the stack when finished.

                java:comp ObjectFactory looks to see if there is something pushed onto the stack, if there isn't, then it uses the old classloader way.

                Ran EJB ENC test, seems to work ok. What I did was search for setContextClassLoader calls in the EJB codebase and added push/pop where appropriate. (destroyService also cleans up the ENC).

                1 2 Previous Next