[jboss-user] [EJB 3.0] - Eclipse RCP connect to JBoss EJB 3.0

jensmcramer do-not-reply at jboss.com
Mon Jul 24 08:19:19 EDT 2006


Hi all!

I know that this forum is not really the right place for my question because my problem is more an eclipse / RCP / classloader problem, but I hope that someone here can point me to the right direction. My searches on google gave me some results but none of them bring me a working solution.

I'm a beginner with EJB and Eclipse RCP. Thanks to EJB 3.0 I got managed to deploy a set of Entity-Beans and a Stateless Session Bean to my JBoss. I've written a small test-client with that I can succsessfully connect to my session bean which then creates some entities.

The project I'm now working on is an Eclipse Rich Client Project which should use the EJBs discribed above. After days of testing there are only problems... 

So far I've tried the following:

1. "The novice solution"
I've created 2 Plugins, one containing the RCP-application and the other one contains the jboss-all.jar. The app-plugin depends on the jboss-plugin and has the same ejb-jar as deployed to JBoss on it's build-path. In the Application.java I try to run this code (which worked in my standalone test-client):


  | Properties properties = new Properties();
  | 		properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
  | 		properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
  | 		properties.put("java.naming.provider.url","localhost:1099");
  | 	
  | 		
  | 		Context context;
  | 		try {
  | 			 context = new InitialContext(properties);
  | 			 TestOrderRemote beanRemote = (TestOrderRemote) context.lookup(TestOrderBean.RemoteJNDIName);
  | 			 beanRemote.createTest();
  |         } catch.....
  | 

This brings this error:
java.lang.NoClassDefFoundError: de/gastroseller/manager/sbeans/TestOrderRemote
  | at java.lang.Class.getDeclaredConstructors0(Native Method)
  | at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
  | ...

As far as I can see the jboss-plugin is unable to find my domain-classes. OK, searching google brought me to the next version:

2. "Buddy ClassLoading"
As stated on http://www.hibernate.org/311.html, I appended to line "Eclipse-BuddyPolicy: registered" to the MANIFEST.MF of the jboss-plugin and "Eclipse-RegisterBuddy: org.jboss.smallclient" to my app-plugin. Same error:
java.lang.NoClassDefFoundError: de/gastroseller/manager/sbeans/TestOrderRemote
  | at java.lang.Class.getDeclaredConstructors0(Native Method)
  | at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
  | ...

3. "setContextClassLoader"
Somewhere on the web someone mentioned to surround the "new InitialContext" with something like 
 Thread.currentThread().setContextClassLoader(
  |          this.getClass().getClassLoader());
         
Some error as above.

:(

Please, can someone point me to the right direction? Or maybe publish an example / working plugin?

Thanks in advance for any help!

Regards,
Jens


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960332#3960332

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960332



More information about the jboss-user mailing list