Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

EJB3 and JBoss 4.0.4 GA

Thread view: 
Kimba - 08 Jun 2006 13:41 GMT
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
jlp - 08 Jun 2006 14:00 GMT
JBoss 4.0.4 comes with EJB3, there is no need to install other thing.
Perhaps that is your problem...
> Hi all,
>
[quoted text clipped - 50 lines]
> 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)
[quoted text clipped - 91 lines]
> jboss-EJB-3.0_RC8-FD
> JDK 1.5.0
Kimba - 08 Jun 2006 14:43 GMT
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!

> JBoss 4.0.4 comes with EJB3, there is no need to install other thing.
> Perhaps that is your problem...
JScoobyCed - 09 Jun 2006 02:14 GMT
> Hi all,
> Exception in thread "main" java.lang.NoClassDefFoundError:
[quoted text clipped - 3 lines]
>     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/ )

Signature

JSC

Kimba - 11 Jun 2006 20:37 GMT
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
Danno - 12 Jun 2006 02:06 GMT
Hey Kimba, where did the exception occur on the client or on the server?
Kimba - 12 Jun 2006 04:20 GMT
Hi Danno,

it occured at the client side.

> Hey Kimba, where did the exception occur on the client or on the server?
Danno - 12 Jun 2006 06:27 GMT
> Hi Danno,
>
> it occured at the client side.
>
> > Hey Kimba, where did the exception occur on the client or on the server?

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. ;)
Kimba - 12 Jun 2006 13:16 GMT
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.

> > Hi Danno,
> >
[quoted text clipped - 7 lines]
> application clients classpath.  That should get you past this error
> message. ;)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.