Hi,
(I use glassfish 3.1, GA build)
I have a ServiceListener class that needs to access EJB bean located in the
same bundle. I noticed that it works only if ServiceListener makes EJB lookup
in serviceChanged function (on event).
If I lookup EJB in ServiceListener constructor, when I try to access it in
serviceChanged(), I get an exception "Attempt to invoke when container is in
Undeployed."
Here is the working version of code: public class MyServiceListener
implements ServiceListener { private MyServiceBean adminService; public
synchronized void serviceChanged(ServiceEvent event) { switch
(event.getType()) { case ServiceEvent.REGISTERED: try {
adminService = (MyServiceBean)
new InitialContext().lookup("java:global/com.ex.test-war/adminServiceBean");
} catch (NamingException e) {
logger.error("exception: ",e);
}
... do something
adminService.installService(serviceName);
break; }
} }
If I move the try-catch code to ServiceListener constructor, I get an
exception in serviceChanged.
Is it a known bug? Am I doing something wrong?
thanks
--
[Message sent by forum member 'okna2000']
View Post: http://forums.java.net/node/808455