users@glassfish.java.net

Help calling EJB3 session bean from Custom MBean...

From: <glassfish_at_javadesktop.org>
Date: Tue, 29 Jan 2008 07:56:38 PST

I've started developing a very simple custom MBean, it deployed in Glassfish V2Ur1without any problem. Next step I've introduced code to lookup for a JMS ConnectionFactory with success. Final step was introducing code to access a EJB3 stateless session bean that was deployed within an EAR, but I have no luck. I've added traces and I can see that the lookup seemed to work, but when I do the necessary cast to the remote interface an Exception is thrown. I'm doing the lookup of the bean the usual way (that works in a stand alone client):

InitialContext ctx = new InitialContext();
Object obj=contexto.lookup("TesterFacadeBean");
TesterFacadeRemote tfr=(TesterFacadeRemote)obj; <--------------- EXCEPTION :

[#|2008-01-29T15:46:22.570+0100|SEVERE|sun-appserver9.1|com.inelcom.icor.borrador.gsmjmx.testaction.TestAction|_ThreadID=13;_ThreadName=Thread-30;_RequestID=70a7b514-278a-45fd-9756-6ca9cfd57e09;|ejb ref resolution error for remote business interfacecom.inelcom.icor.adif.ejb.tester.TesterFacadeRemote
javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.inelcom.icor.adif.ejb.tester.TesterFacadeRemote [Root exception is java.lang.ClassNotFoundException: com.inelcom.icor.adif.ejb.tester.TesterFacadeRemote]
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.inelcom.icor.borrador.gsmjmx.testaction.TestAction$InitResources.lookup(TestAction.java:186)
        at com.inelcom.icor.borrador.gsmjmx.testaction.TestAction$InitResources.run(TestAction.java:147)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.inelcom.icor.adif.ejb.tester.TesterFacadeRemote
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:679)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:348)
        ... 7 more
|#]

[#|2008-01-29T15:46:22.570+0100|SEVERE|sun-appserver9.1|com.inelcom.icor.borrador.gsmjmx.testaction.TestAction|_ThreadID=13;_ThreadName=Thread-30;_RequestID=70a7b514-278a-45fd-9756-6ca9cfd57e09;|ejb ref resolution error for remote business interfacecom.inelcom.icor.adif.ejb.tester.TesterFacadeRemote|#]

Please help.
Thanks!
[Message sent by forum member 'abelmj' (abelmj)]

http://forums.java.net/jive/thread.jspa?messageID=256359