[jboss-dev-forums] [Design of EJB 3.0] - Re: Unit Tests for Unbinding References from JNDI in EJB3 Pr
jaikiran
do-not-reply at jboss.com
Mon Jun 16 10:20:15 EDT 2008
Andrew,
I have started work on this. A few questions:
1) I don't see a API which returns me a JndiSessionRegistrarBase, which i can use for calling the unbindEjb. I do see a setJndiRegistrar(JndiSessionRegistrarBase jndiRegistrar) on the SessionContainer. From what i have seen so far, the Ejb3Registrar (which i get from Ejb3RegistrarLocator.locateRegistrar) has an unbind method which will invoke the JndiSessionRegistrarBase.unbindEjb? So the test case should use the Ejb3Registrar for testing the JndiSessionRegistrarBase's unbindEjb?
2) While trying out simple SLSB for this test case, i observed that the @RemoteBinding and the @LocalBinding values are not used for binding the EJBs. The EJBs always get bound to the default jndi names (ex: beanname/remote and beanname/local). Here's the bean definition:
| @Stateless
| @Local(MyStatelessLocal.class)
| @Remote(MyStatelessRemote.class)
| @RemoteBinding (jndiBinding="MyStatelessBeanRemote")
| @LocalBinding (jndiBinding="MyStatelessBeanLocal")
| public class MySLSBean implements MyStatelessLocal, MyStatelessRemote
And here's the logs that i see:
19:47:25,284 DEBUG [Ejb3McRegistrar] Created Ejb3McRegistrar with backing Kernel: org.jboss.kernel.Kernel at d251a3
| 19:47:25,284 DEBUG [Ejb3RegistrarLocator] Bound Ejb3Registrar: org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar at 1f5d386
| 19:47:25,284 DEBUG [EmbeddedTestMcBootstrap] Deploying file:/D:/JBoss/EJB3/proxy/target/tests-classes/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase-beans.xml...
| 19:47:26,284 WARN [BeanAnnotationAdapterFactory] Exception while creating bean annotation adapter instance: java.lang.IllegalAccessException: Class org.jboss.reflect.plugins.introspection.ReflectionUtils can not access a member of class org.jboss.kernel.plugins.annotations.BasicBeanAnnotationAdapter with modifiers "protected"
| 19:47:26,440 DEBUG [JndiSessionRegistrarBase] Using Session EJB JNDI ObjectFactory: org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
| 19:47:26,628 INFO [EmbeddedTestMcBootstrap] Deployed: file:/D:/JBoss/EJB3/proxy/target/tests-classes/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase-beans.xml
| 19:47:26,878 INFO [MetaDataHelper] Business Remote JNDI Name: MySLSBean/remote
| 19:47:26,878 INFO [MetaDataHelper] Business Remote JNDI Name for org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote: MySLSBean/remote-org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote
| 19:47:26,878 INFO [MetaDataHelper] Local JNDI Name: MySLSBean/local
| 19:47:26,878 INFO [MetaDataHelper] Business Local JNDI Name for org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessLocal: MySLSBean/local-org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessLocal
| 19:47:27,253 INFO [SessionContainer] Starting org.jboss.ejb3.test.proxy.common.container.StatelessContainer at 1ba94d
| 19:47:27,253 DEBUG [Ejb3McRegistrar] Returning from name "org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar": org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar at 7cd37a
| 19:47:27,253 DEBUG [JndiSessionRegistrarBase] Found Session Bean: MySLSBean
| 19:47:27,269 DEBUG [JndiStatelessSessionRegistrar] Registering with Remoting Dispatcher under name "MySLSBean/remote/ProxyFactory": org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory at 16dc861
| 19:47:27,269 DEBUG [JndiSessionRegistrarBase] Registering org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory at 16dc861 under key "MySLSBean/remote/ProxyFactory"...
| 19:47:27,284 DEBUG [ProxyFactoryBase] Started: org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory at 16dc861
| 19:47:27,284 DEBUG [SessionProxyFactoryBase] Created Session Bean Business Interface-Specific Proxy Constructor implementing "org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote"
| 19:47:27,284 DEBUG [SessionProxyFactoryBase] Created Session Bean Default EJB3 Business Proxy Constructor implementing [interface org.jboss.ejb3.proxy.intf.EjbProxy, interface org.jboss.ejb3.proxy.intf.SessionProxy, interface org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote]
| 19:47:27,284 DEBUG [Ejb3McRegistrar] Installed in AbstractKernelController at bf053f{} at "MySLSBean/remote/ProxyFactory": org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory at 16dc861
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Adding RefAddr to Default Remote Reference: Type "Remote Business Interface", Content "org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Adding RefAddr to Default Remote Reference: Type "Remoting Host URL", Content "socket://localhost:3874"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Default Remote Business View for EJB MySLSBean to be bound into JNDI at "MySLSBean/remote"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Adding RefAddr to Reference: Type "ProxyFactoryKey", Content "MySLSBean/remote/ProxyFactory"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Adding RefAddr to Reference: Type "EJB Container Name", Content "org.jboss.ejb3.EJBContainer.StatelessSession.MySLSBean/f75a7411-0375-4ab4-aba0-48ea9e818a81"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Bound javax.naming.Reference into JNDI at "MySLSBean/remote"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Remote Business View for org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote of EJB MySLSBean to be bound into JNDI at "MySLSBean/remote-org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Adding RefAddr to Reference: Type "ProxyFactoryKey", Content "MySLSBean/remote/ProxyFactory"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Adding RefAddr to Reference: Type "EJB Container Name", Content "org.jboss.ejb3.EJBContainer.StatelessSession.MySLSBean/f75a7411-0375-4ab4-aba0-48ea9e818a81"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Bound javax.naming.Reference into JNDI at "MySLSBean/remote-org.jboss.ejb3.test.proxy.jndiregistrar.MyStatelessRemote"
| 19:47:27,300 DEBUG [JndiSessionRegistrarBase] Registering org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionLocalProxyFactory at cf829d under key "MySLSBean/local/ProxyFactory"...
| 19:47:27,315 DEBUG [ProxyFactoryBase] Started: org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionLocalProxyFactory at cf829d
|
Is this intentional to neglect the @RemoteBinding and @LocalBinding?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158365#4158365
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4158365
More information about the jboss-dev-forums
mailing list