EJB3 and JBoss 4.0.4 GA

K

Kimba

Hi all,

I have a slight problem, I try to create a reference Stateless
SessionBean but for some reason each time my client tries to access the
Bean after looking it up on JNDI I end up getting the following
exception:

Code:

Exception in thread "main" java.lang.NoClassDefFoundError:
[Lorg/jboss/aop/advice/Interceptor;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2232)
at java.lang.Class.getDeclaredField(Class.java:1852)
at
java.io_ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1555)
at java.io_ObjectStreamClass.access$600(ObjectStreamClass.java:47)
at java.io_ObjectStreamClass$2.run(ObjectStreamClass.java:381)
at java.security.AccessController.doPrivileged(Native Method)
at java.io_ObjectStreamClass.<init>(ObjectStreamClass.java:373)
at java.io_ObjectStreamClass.lookup(ObjectStreamClass.java:268)
at java.io_ObjectStreamClass.initNonProxy(ObjectStreamClass.java:504)
at
java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at
java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at
java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at
java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at
java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at
java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at
org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.kimbasoft.reference.ejb.client.MyClient.main(MyClient.java:28)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)






Here is my source:

Remote Interface:
Code:

package com.kimbasoft.reference.ejb.session;

public interface TestRemote {

public String sayHelloRemote();

}




Local Interface:
Code:

package com.kimbasoft.reference.ejb.session;

public interface TestLocal {

public String sayHelloLocal();

}





Bean Implementation:
Code:

package com.kimbasoft.reference.ejb.session;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.Local;

@Stateless
@Local({TestLocal.class })
@Remote({TestRemote.class})
public class TestBean implements TestRemote {

public String sayHelloRemote() {
return "Hello Remote World!!!";
}

public String sayHelloLocal() {
return "Hello Local World!!!";
}

}




Client Implementation:
Code:

package com.kimbasoft.reference.ejb.client;

import com.kimbasoft.reference.ejb.session.TestRemote;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class MyClient {

public static void main(String[] args) {

Context ctx;

try {
ctx = new InitialContext();
TestRemote obj = (TestRemote) ctx.lookup("TestBean/remote");
System.out.println(">>" + obj.sayHelloRemote());
} catch (NamingException e) {
System.out.println("ERROR");
e.printStackTrace();
}
}
}





First I compile everything and package it into a JAR file. Then I
deploy it on JBoss. After deploying I check the JNDI content and can
see my TestBean and it's remote and local interface. Now I start the
client (I have the client JARs of JBoss in the path) on my local pc out
of a local copy of the JAR file I deployed on the server and then I get
the above mentioned exception. Can anybody help me and tell me what I'm
doing wrong???

Thanks,

Kimba


Configuration:
JBoss 4.0.4 GA
jboss-EJB-3.0_RC8-FD
JDK 1.5.0
 
J

jlp

JBoss 4.0.4 comes with EJB3, there is no need to install other thing.
Perhaps that is your problem...
Kimba said:
Hi all,

I have a slight problem, I try to create a reference Stateless
SessionBean but for some reason each time my client tries to access the
Bean after looking it up on JNDI I end up getting the following
exception:

Code:

Exception in thread "main" java.lang.NoClassDefFoundError:
[Lorg/jboss/aop/advice/Interceptor;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2232)
at java.lang.Class.getDeclaredField(Class.java:1852)
at
java.io_ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1555)
at java.io_ObjectStreamClass.access$600(ObjectStreamClass.java:47)
at java.io_ObjectStreamClass$2.run(ObjectStreamClass.java:381)
at java.security.AccessController.doPrivileged(Native Method)
at java.io_ObjectStreamClass.<init>(ObjectStreamClass.java:373)
at java.io_ObjectStreamClass.lookup(ObjectStreamClass.java:268)
at java.io_ObjectStreamClass.initNonProxy(ObjectStreamClass.java:504)
at
java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at
java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at
java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at
java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at
java.io_ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at
java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at
java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at
org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.kimbasoft.reference.ejb.client.MyClient.main(MyClient.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)






Here is my source:

Remote Interface:
Code:

package com.kimbasoft.reference.ejb.session;

public interface TestRemote {

public String sayHelloRemote();

}




Local Interface:
Code:

package com.kimbasoft.reference.ejb.session;

public interface TestLocal {

public String sayHelloLocal();

}





Bean Implementation:
Code:

package com.kimbasoft.reference.ejb.session;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.Local;

@Stateless
@Local({TestLocal.class })
@Remote({TestRemote.class})
public class TestBean implements TestRemote {

public String sayHelloRemote() {
return "Hello Remote World!!!";
}

public String sayHelloLocal() {
return "Hello Local World!!!";
}

}




Client Implementation:
Code:

package com.kimbasoft.reference.ejb.client;

import com.kimbasoft.reference.ejb.session.TestRemote;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class MyClient {

public static void main(String[] args) {

Context ctx;

try {
ctx = new InitialContext();
TestRemote obj = (TestRemote) ctx.lookup("TestBean/remote");
System.out.println(">>" + obj.sayHelloRemote());
} catch (NamingException e) {
System.out.println("ERROR");
e.printStackTrace();
}
}
}





First I compile everything and package it into a JAR file. Then I
deploy it on JBoss. After deploying I check the JNDI content and can
see my TestBean and it's remote and local interface. Now I start the
client (I have the client JARs of JBoss in the path) on my local pc out
of a local copy of the JAR file I deployed on the server and then I get
the above mentioned exception. Can anybody help me and tell me what I'm
doing wrong???

Thanks,

Kimba


Configuration:
JBoss 4.0.4 GA
jboss-EJB-3.0_RC8-FD
JDK 1.5.0
 
K

Kimba

JBoss 4.0.4 ONLY comes with EJB3 when you use the installer and only
when you select it to be installed. When you use the ZIP file as I did
you have to manually install EJB3 afterwards. JBoss 5 will come with
EJB3 preinstalled!
 
J

JScoobyCed

Kimba said:
Hi all,
Exception in thread "main" java.lang.NoClassDefFoundError:
[Lorg/jboss/aop/advice/Interceptor;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2232)
at java.lang.Class.getDeclaredField(Class.java:1852)
at

Do you need the AOP interceptor? If you don't you can eventually remove
the ejb3-interceptors-aop.xml from the deployment folder
(<jboss-folder>/server/<server-config>/deploy/ )
 
K

Kimba

Hi JScoobyCed,

I tried that but JBoss doesn't like it at all when I take away that
XML. It throws an exception when bringing the server up. Besides, it
shouldn't matter if I need them or not, right? I mean I should be able
to leave them in and still access the SessionBean or am I mistaken?
Do you need the AOP interceptor? If you don't you can eventually remove
the ejb3-interceptors-aop.xml from the deployment folder
(<jboss-folder>/server/<server-config>/deploy/ )

Thanks,

Kimba
 
D

Danno

Kimba said:
Hi Danno,

it occured at the client side.

OK. Do a me a favor and copy
[JBOSS_HOME]\client\jboss-aop-jdk50-client.jar where [JBOSS_HOME] is
your jboss directory and make sure that that jar is available in your
application clients classpath. That should get you past this error
message. ;)
 
K

Kimba

Hi Danno,

Thanks!! That was it, now it is working fine!! Can't believe that JBoss
doesn't mention that in their install guide for the EJB3 container.
Another problem is, they did not include ANY client jar into the EJB3
zip file so you have no other option than using their installer.

But thanks again for your help. I should have figured out myself that
there is a client JAR missing but I just didn't think about it!!

Kimba.
Kimba said:
Hi Danno,

it occured at the client side.

OK. Do a me a favor and copy
[JBOSS_HOME]\client\jboss-aop-jdk50-client.jar where [JBOSS_HOME] is
your jboss directory and make sure that that jar is available in your
application clients classpath. That should get you past this error
message. ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top