@Stateful / @Stateless - Probleme

janpaet

Grünschnabel
Hallo,
ich beschäftige mich gerade mit EJB 3.0

Folgende, ganz einfache Stateful Session Bean bekomme ich lauffähig:

package test.server;
import javax.ejb.*;

@Stateful
public class ImportBean implements ImportRemote {
public int add(){
return 5 + 4;
}
}

Das Remote-Interface dazu sieht entsprechend aus:

package test.server;
import javax.ejb.*;

@Remote
public interface ImportRemote {
public int add();
}

Und hier noch der Client:

package test.client;
import java.util.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import test.server.*;

public class ImportClient {
public static void main (String[] args){
try{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:eek:rg.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
Context ctx = new InitialContext(p);
Object ref = ctx.lookup("ImportBean/remote");
ImportRemote ir = (ImportRemote)PortableRemoteObject.narrow(ref, ImportRemote.class);

System.out.println(ir.add());
}
catch(NamingException ne){ne.printStackTrace();}
}
}


Mein Problem ist, wenn ich die Annotation @Stateless in @Stateful ändere, erhalte ich beim Ausführen folgenden Fehlermeldung:

Weiß jemand, was mir diese Fehlermeldung sagt und wie ich es korrigieren kann?

Vielen Dank
Gruß Jan

javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1150)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(Unknown Source)
at de.bonprix.kundenbetreuung.vollretouren.client.ImportClient.main(ImportClient.java:16)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy0.createProxy(Unknown Source)
at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:52)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
... 4 more
Caused by: java.lang.ClassNotFoundException: [Lorg.jboss.aop.advice.Interceptor;
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)
at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:139)
at java.io_ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io_ObjectInputStream.readClassDesc(Unknown Source)
at java.io_ObjectInputStream.readArray(Unknown Source)
at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.defaultReadFields(Unknown Source)
at java.io_ObjectInputStream.readSerialData(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.defaultReadFields(Unknown Source)
at java.io_ObjectInputStream.readSerialData(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.readObject(Unknown Source)
at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
at java.io_ObjectInputStream.readExternalData(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.defaultReadFields(Unknown Source)
at java.io_ObjectInputStream.readSerialData(Unknown Source)
at java.io_ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io_ObjectInputStream.readObject0(Unknown Source)
at java.io_ObjectInputStream.readObject(Unknown Source)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:48)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
... 9 more
 

Neue Beiträge

Zurück