Hi im writing my first
EJB, it compiles and
JBoss deploys it without problem, but when i run my client throws an exception:
java.lang.NoClassDefFoundError: Lorg/jboss/tm/TransactionPropagationContextFactory;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:1514)
at java.lang.Class.getDeclaredField(Class.java:1206)
at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1474)
at java.io.ObjectStreamClass.access$400(ObjectStreamClass.java:47)
at java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:335)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:333)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:253)
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:453)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at java.util.HashMap.readObject(HashMap.java:1006)
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:324)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:112)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1686)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1644)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:550)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at examples.HelloClient.main(HelloClient.java:30)
Exception in
thread "main"
the code of the client is the following:
public class HelloClient {
public static void main(
String[] args) throws NamingException, CreateException, RemoteException, RemoveException {
Hashtable environment = new Hashtable();
environment.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
environment.put( Context.PROVIDER_URL, "localhost:1099" );
System.out.println ("Inicio4");
Context ctx = new InitialContext (environment);
System.out.println ("Inicio5");
Object obj = ctx.lookup( "Hello" );
System.out.println ("Inicio6");
HelloHome home = (HelloHome) PortableRemoteObject.narrow( obj, HelloHome.class);
Hello hello = home.create();
System.out.println (hello.hello());
hello.remove();
}
}
the exception is throw in the following line: Object obj = ctx.lookup( "Hello" );
(it doesnt print "Inicio6");
i thought that maybe the problem was the JNDI port (1099) but the config says that its the correct port:
<!-- ==================================================================== -->
<!-- JNDI -->
<!-- ==================================================================== -->
<mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming">
<!-- The listening port for the bootstrap JNP service. Set this to -1
to run the NamingService without the JNP invoker listening port.
-->
<attribute name="Port">1099</attribute>
<!-- The bootstrap JNP server bind address. This also sets the default
RMI service bind address. Empty == all addresses
-->
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<!-- The port of the RMI naming service, 0 == anonymous 1098-->
<attribute name="RmiPort">1098</attribute>
<!-- The RMI service bind address. Empty == all addresses
-->
<attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
</mbean>
<mbean code="org.jboss.naming.JNDIView"
name="jboss:service=JNDIView"
xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
</mbean>
so any idea whats wrong?