[jboss-user] [Beginners Corner] - Stateful SessionBeans
Frankster
do-not-reply at jboss.com
Sun Oct 22 03:42:48 EDT 2006
Hello!
I´m a totaly newbie in programming with EJB3.0
So I tried a very easy tutorial for Stateful SessionBeans.
I always get an "Exception in thread "main" java.lang.NoClassDefFoundError: Lorg/jboss/invocation/Invoker"
| Exception in thread "main" java.lang.NoClassDefFoundError: Lorg/jboss/invocation/Invoker;
| at java.lang.Class.getDeclaredFields0(Native Method)
| at java.lang.Class.privateGetDeclaredFields(Unknown Source)
| at java.lang.Class.getDeclaredField(Unknown Source)
| at java.io.ObjectStreamClass.getDeclaredSUID(Unknown Source)
| at java.io.ObjectStreamClass.access$700(Unknown Source)
| at java.io.ObjectStreamClass$2.run(Unknown Source)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.io.ObjectStreamClass.<init>(Unknown Source)
| at java.io.ObjectStreamClass.lookup(Unknown Source)
| at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
| at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
| at java.io.ObjectInputStream.readClassDesc(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.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:107)
| 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:41)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
| at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:34)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
| at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:46)
| 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)
| 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 client.calcClient.main(calcClient.java:16)
|
Here are my codes:
CalculatorSession
| package calculator;
| import java.io.Serializable;
|
| @javax.ejb.Stateful
| public class CalculatorSession implements ICalculator, Serializable {
| static final long serialVersionUID = 7422574264557894633L;
| public int last;
|
| public CalculatorSession(){
| last = 0;
| }
| public int add(int a, int b) {
| last = a+b;
| return a+b;
| }
|
| public int last() {
| return last;
| }
| }
|
ICalculator
| package calculator;
|
| @javax.ejb.Remote
| public interface ICalculator{
| public int add(int a, int b);
|
| public int last();
| }
|
calcClient
| package client;
|
| import java.util.Properties;
| import javax.naming.InitialContext;
| import calculator.*;
|
| public class calcClient {
|
| public static void main(String[] args) throws Exception {
|
| Properties p = new Properties();
| p.put("java.naming.factory.inition","org.jnp.interfaces.NamingContextFactory");
| p.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
| p.put("java.naming.provider.url","jnp://localhost:1099");
| InitialContext ctx = new InitialContext(p);
| ICalculator calc = (ICalculator) ctx.lookup("CalculatorSession/remote");
|
| System.out.println("2 + 1 = " + calc.add(2,1));
| System.out.println("LAST: " + calc.last());
|
| System.out.println("2 + 4 = " + calc.add(2,4));
| System.out.println("LAST: " + calc.last());
| }
| }
|
I installed:
JBOSS AS 4.0.4
JBossIDE 2.0.0.Beta2
Eclipse 3.2.1
Many Thanks
Frankster
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979870#3979870
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979870
More information about the jboss-user
mailing list