Andrew,
I tested this with jboss-metadata 1.0.0.Beta36. My test cases which work on Remote beans
are failing. The ones working with Local beans pass. Here's the exception, i see for
all my remote bean test cases:
| testRemoteBindingForSlsb(org.jboss.ejb3.test.proxy.binding.unit.JNDIBindingTestCase)
Time elapsed: 1.016 sec <<< ERROR!
| javax.naming.NamingException: Could not dereference object [Root exception is
java.lang.RuntimeException: Could not create the EJB3 Business Proxy implementing
"org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote" for
MyStatelessBeanWithBindings]
| at
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1337)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:765)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at
org.jboss.ejb3.test.proxy.binding.unit.JNDIBindingTestCase.testRemoteBindingForSlsb(JNDIBindingTestCase.java:184)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
| at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
| at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
| at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
| at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
| at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
| at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
| at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
| at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
| at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
| at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
| at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
| at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
| at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
| at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
| at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
| at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:993)
| Caused by: java.lang.RuntimeException: Could not create the EJB3 Business Proxy
implementing "org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote" for
MyStatelessBeanWithBindings
| at
org.jboss.ejb3.proxy.factory.session.SessionProxyFactoryBase.createProxyBusiness(SessionProxyFactoryBase.java:235)
| at
org.jboss.ejb3.proxy.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129)
| at
org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
| at
org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161)
| at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
| at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1312)
| at
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1329)
| ... 30 more
| Caused by: java.lang.AssertionError: Could not find Advice Stack with name:
StatelessSessionClientInterceptors
| at
org.jboss.ejb3.proxy.factory.ProxyFactoryBase.getInterceptors(ProxyFactoryBase.java:185)
| at
org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory.createInvocationHandler(StatelessSessionRemoteProxyFactory.java:147)
| at
org.jboss.ejb3.proxy.factory.session.SessionProxyFactoryBase.createProxyBusiness(SessionProxyFactoryBase.java:227)
| ... 36 more
And this exception happens when i lookup the bean using the remote jndi name:
|
| @Test
| public void testRemoteBindingForSlsb() throws Throwable
| {
| // create the bean
| this.sessionContainer = Utils.createSlsb(MyStatelessBeanWithBindings.class);
|
| // bind it to JNDI
| Ejb3RegistrarLocator.locateRegistrar().bind(sessionContainer.getName(),
sessionContainer);
|
| List<RemoteBindingMetaData> remoteBindingsMetadata =
sessionContainer.getMetaData().getRemoteBindings();
|
| assertNotNull("No RemoteBindingMetadata available",
remoteBindingsMetadata);
| // make sure that the remotebinding metadata list has 1 @RemoteBinding
information
| assertEquals("RemoteBindingMetadata does not have any RemoteBinding
information available", remoteBindingsMetadata.size(), 1);
|
| // Ensure that the RemoteBindingMetaData is created properly with the specified
jndiBinding name.
| Iterator<RemoteBindingMetaData> remoteBindingsMetadataIterator =
remoteBindingsMetadata.iterator();
| RemoteBindingMetaData remoteBindingMetadata =
remoteBindingsMetadataIterator.next();
|
| assertEquals("RemoteBinding JNDI name does not match " +
MyStatelessBeanWithBindings.REMOTE_JNDI_NAME,
MyStatelessBeanWithBindings.REMOTE_JNDI_NAME, remoteBindingMetadata
| .getJndiName());
|
| // Now ensure that the RemoteBindingMetaData is used for binding the
| // remote interface of the bean.
| Context ctx = new InitialContext();
| String rJndiName = remoteBindingMetadata.getJndiName();
|
| Object remoteBean = ctx.lookup(rJndiName); // fails here with exception
|
| assertNotNull("Remote bean returned from JNDI lookup is null",
remoteBean);
| assertTrue("Remote bean returned from JNDI lookup is NOT an instance of
" + MyStatelessRemote.class, (remoteBean instanceof MyStatelessRemote));
|
| }
Looks like there's some change related to EJBTHREE-1345 as part of which now atleast
one interceptor is mandatory for remote beans?
Let me know, if you want me to update the JIRA (EJBTHREE-1423) with this updated test
case. Actually, there hasn't been much changes in these test cases.
A couple of related questions:
1) What exactly are these client interceptors that is being checked for?
2) Why do we mandate these interceptors only for remote proxy and not for local proxy?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171019#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...