[jboss-user] [EJB 3.0] - EJB 2.1 client adapters not working
stfkbf
do-not-reply at jboss.com
Tue Jan 8 03:24:36 EST 2008
Hi
I have attempted to create an EJB with a remote home interface as follows:
public interface TestBeanRemote extends EJBObject {
| public int getId();
| }
|
| public interface TestBeanRemoteHome extends EJBHome {
| public TestBeanRemote create() throws CreateException, RemoteException;
| }
|
| public interface TestBeanEJB3 {
| public int getId();
| }
|
| @Stateful(name="TestBean")
| @Remote(TestBeanEJB3.class)
| @RemoteHome(TestBeanRemoteHome.class)
| public class TestBean implements TestBeanEJB3{
|
| private int id = 5;
|
| @Init
| public void create() throws CreateException, RemoteException{}
|
| public int getId() {
| return id;
| }
|
|
| }
Basically following the tutorials here:
https://glassfish.dev.java.net/javaee5/ejb/examples/Adapted.html
and here:
http://docs.jboss.org/ejb3/app-server/tutorial/ejb21_client_adaptors/ejb21_client_adaptors.html
This however results in the following exception (using JBoss 4.2.0.GA_CP01):
09:15:56,642 ERROR [STDERR] java.lang.IllegalStateException: Container null is not registered
| 09:15:56,642 ERROR [STDERR] at org.jboss.ejb3.Ejb3Registry.getContainer(Ejb3Registry.java:149)
| 09:15:56,642 ERROR [STDERR] at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
| 09:15:56,642 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 09:15:56,642 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulHomeRemoteProxy.invoke(StatefulHomeRemoteProxy.java:110)
| 09:15:56,642 ERROR [STDERR] at $Proxy105.create(Unknown Source)
| 09:15:56,642 ERROR [STDERR] at dk.services.TestService.test(TestService.java:36)
The code used to invoke the bean looks as follows:
TestBeanRemoteHome t;
| Context context = new InitialContext();
| t = (TestBeanRemoteHome) context.lookup("TestBean/home");
| tr = t.create();
The line that fails is the create call.
Am i doing something obvious wrong?
The reason for using EJB2.1 instead of EJB3 is that i need to obtain a EJB handle that can be returned by a web service. Serializing the EJB3 remote interface does not seem to work (see http://www.jboss.org/index.html?module=bb&op=viewtopic&t=73311).
Hope someone can help :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117808#4117808
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117808
More information about the jboss-user
mailing list