I'm using Jboss 3.2.2RC4. I have two enterprise application. A.ear has a servlet and B.ear has some EJBs and JSPs. My servlet code (in A.ear) is similar to (UserEJB is in B.ear):
// inside doGet .... //MainFormBean is a JavaBean
jndiContext = new InitialContext();
Object ref = jndiContext.lookup("UserEJB");
UserEJBHome home = (UserEJBHome) PortableRemoteObject.narrow (ref,UserEJBHome.class);
UserEJB user = home.create();
MainFormBean response = (MainFormBean) user.addUser("test");
I need to deploy A.ear separetely (before B.ear). All works fine if i deploy A.ear and B.ear at the same time, but it fails (PortableRemoteObject.narrow - ClassCastException) if i try to undeploy and redeploy B.ear without to do the same with A.ear (servlet continues running).
My questions are: After call the EJB, servlet maintains some information about it? Should i close (destroy) something after method invocation? Why do i receive that exception?
The exception occurs at jndiContext.lookup("UserEJB"). After i redeploy B.ear, ref is not an instance of UserEJBHome, but i can not discover which type it is. Please, help me!!
Thanks in advance!