Skip to main content

Remote Client connects ok to Glassfish. But NOT from Eclipse RCP.

2 replies [Last post]
natg
Offline
Joined: 2007-08-01
Points: 0

I have no problem calling remote session beans in a Glassfish 2 server from my "fat" client.
But the exact same code from an eclipse 3.3/3.4 plugin gives me errors. This might be due to Eclipse's class loader tricks, and hopefully there is a way to make it work.

EITHER of the following lookups works ok in a standalone jface/swt client, but not when inside an Eclipse plugin.

(The try-catch is removed in this post.)
*************************************************************
InitialContext ctx;
ctx = new InitialContext();
//EITHER of the following 2 lines work. But not when part of a plugin.
TestingSLRemote testingSLRemote = (TestingSLRemote) ctx.lookup("ejb/TestingBean");
TestingSLRemote testingSLRemote = ic.lookup("test.session.interfaces.TestingSLRemote");
testingSLRemote.sayHello();
************************************************************
And here is the bean/annotation:
@Stateless(mappedName="ejb/TestingBean")
public class TestingSLBean implements TestingSLRemote {
....
}
I have the following 4 jars defined as a plugin
1. javaee
2. appserv-rt
3. appserv-ext
4. appserv-deployment-client
and my plugin project depending on it.

The error I get is:
"naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial"

I have been googling a few days now trying all kinds of things to no avail.
Please advise.
nat

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gnorph
Offline
Joined: 2009-04-14
Points: 0

Hi,

I have the very same problem. I could not make it work by specifying the jndi properties directly either.

Did you find any solution for it?

gnorph
Offline
Joined: 2009-04-14
Points: 0

OK, stupid me ... while I had added the various appserv-*.jar files, I did not add them (manually!) to the runtime classpath in the configuration. That fixed it!