views:

221

answers:

1

Dear all,

I do the following steps with eclipse 3.5 ,JBoss 4.2 ,EJB3 but I face class not found exception

1.compiling this code to foo.jar file

package mypackage.foo;
import myejbpackage.ejb.fooInterface; 
class foo implements fooInterface{
 @override
 void helloWorld(){System.out.print("HelloWorld");}
     }

Note that fooInterface interface in is written inside the used EJB

2.using reflection , I take an instance from this class, also with the same ejb

package myejbpackage.ejb;
class fooCaller{
    void call(){
     Class foo=  Class.forName("mypackage.foo.foo");

fooInterface iDataBackupWriter =(fooInterface) foo.newInstance(); fooInterface.helloWorld(); } }

3.then calling it within stateless ejb3

package myejbpackage.ejb;
test(){        
  System.Out.Write("before calling");
   new fooCaller().call();
    }

4.then deploying to Jboss 4.2 and and puting foo.jar in default/lib

5.then calling the ejb 3 method.using simple client

it print :

 "before calling"

and the following exception occurs in eclipse console

  javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError:                       myejbpackage/ejb/fooInterface; nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: myejbpackage/ejb/fooInterface
 java.lang.RuntimeException: java.lang.NoClassDefFoundError:myejbpackage/ejb/fooInterface

Any suggestion ? 1.Is this exception from JBOOS, why ? 1.Where I should put the foo.jar to bee seen with the ejb3 jar ?

thanks in advance

A: 

there was a circular dependency which generate this problem

worldpython