0 Replies Latest reply on Dec 12, 2019 1:03 AM by kumarlalit758

    Classloader getting changed when invoking remote EJB methods.

    kumarlalit758

      We are migrating our EJB 2.0 application from Jboss 5 to Jboss EAP 7.2 and thus we are changing the invocation process of EJB as well.

      Previously, we used JNP protocol for remote invocation but since JNP is no longer supported we're using remoting as the protocol now.

       

      Once we're done with the lookup of EJB, we invoke create method on the ejbHome object which returns us the proxy of our stateless EJB which can further be used for invoking the remote methods of EJB. Using this proxy, we invoke the remote methods and while invoking it we receive a call at the ejbCreate() method of EJB bean class. Once the ejbCreate() method is called, we call method of our Singleton class which was initialized during server startup and we call it from inside of ejbCreate() method. But I am unable to get the instance of this Singleton class as I think that the classloader has been changed and thus a new instance of this class is created. Due to this new instance, when the call returns to our remote EJB method from the ejbCreate() method, the previous values of singleton class are not there and thus the remote method invocation fails because of those missing value.

       

      I have both client and server inside the same EAR deployed on same JVM instance in Jboss EAP 7.2.

       

      Please suggest how can I avoid instantiation of my singleton class again.