Re: Geronimo 2 EJB3 Remote Access Example

2008-01-24 Thread xypher

Hi,

I tried this example and it works. But this is example is with a web client.
I'd like to have a fat  client and wants to access the session bean (over
RMI-IIOP ? I'm not sure). 

But I don't know the right JNDI lookup string? This is my problem. Any
solutions?

Thanks



vhnguy2 wrote:
 
 There are some sample applications on our wiki. For a session bean
 sample, you might want to take a look at this:
 http://cwiki.apache.org/GMOxDOC20/very-simple-session-ejb-example.html.
 
 There are other samples there too if you're interested.
 
 Thanks,
 Viet
 
 On Jan 23, 2008 5:14 PM, xypher [EMAIL PROTECTED] wrote:

 Hi,

 I'm relatively new to Geroimo 2 and EJB3. I googled a lot, but I found no
 simple example for my request. I'd like to develop an Session Bean and to
 access this bean from an remote client over JNDI lookup. Can anybody give
 my
 an simple example or tell my where I can find something like this.

 I tried a lot, but I'm not sure what I have to configure in the
 deployment
 descriptors and what is the correct jndi lookup name.

 Thanks.
 --
 View this message in context:
 http://www.nabble.com/Geronimo-2-EJB3-Remote-Access-Example-tp15053984s134p15053984.html
 Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


 
 

-- 
View this message in context: 
http://www.nabble.com/Geronimo-2-EJB3-Remote-Access-Example-tp15053984s134p15060525.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: Geronimo 2 EJB3 Remote Access Example

2008-01-24 Thread Jonathan Chen
On Thu, Jan 24, 2008 at 12:20:07AM -0800, xypher wrote:
 
 Hi,
 
 I tried this example and it works. But this is example is with a web client.
 I'd like to have a fat  client and wants to access the session bean (over
 RMI-IIOP ? I'm not sure). 
 
 But I don't know the right JNDI lookup string? This is my problem. Any
 solutions?

This wiki entry explains remote JNDI naming:

http://cwiki.apache.org/GMOxDEV/client-jndi-names.html

So in the default installation, if you have a @Stateless(name=MyBean),
your JNDI name would be MyBeanRemote.

HTH.
-- 
Jonathan Chen [EMAIL PROTECTED]
--
Only the meek get pinched. The bold survive.
  - Ferris Bueller


Re: Geronimo 2 EJB3 Remote Access Example

2008-01-24 Thread xypher

Hi, 

thanks a lot, now it works. But not completely 

When I'm trying the following code:

public class TestClient {

public static void main(String[] args) {

Context context;
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
org.apache.openejb.client.RemoteInitialContextFactory);
properties.setProperty(Context.PROVIDER_URL,
ejbd://localhost:4201);
properties.put(java.naming.security.principal, system);
properties.put(java.naming.security.credentials, manager);

try {
context = new InitialContext(properties);

IProjectDSP projectDSP = (IProjectDSP)
context.lookup(ProjectDSPRemote);
//  Project p1 = new Project();
//  p1.setName(Test);
//  projectDSP.createProject(p1);
} catch (NamingException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}

I'm getting this exception:

javax.naming.AuthenticationException: This principle is not authorized.
at 
org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
at
org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:122)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at TestClient.main(TestClient.java:24)
Exception in thread main java.lang.RuntimeException:
javax.naming.AuthenticationException: This principle is not authorized.
at TestClient.main(TestClient.java:32)
Caused by: javax.naming.AuthenticationException: This principle is not
authorized.
at 
org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
at
org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:122)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at TestClient.main(TestClient.java:24)

When I don't use a principal, I'm getting this error:

Exception in thread main java.lang.RuntimeException:
javax.naming.NamingException: Cannot lookup '/ProjectDSPRemote'. [Root
exception is java.rmi.RemoteException: Cannot read the response from the
server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local class
incompatible: stream classdesc serialVersionUID = 2128092884552388429, local
class serialVersionUID = -7734383756981201981; nested exception is: 
java.io.InvalidClassException: 
org.apache.openejb.client.EJBMetaDataImpl;
local class incompatible: stream classdesc serialVersionUID =
2128092884552388429, local class serialVersionUID = -7734383756981201981]
at TestClient.main(TestClient.java:32)
Caused by: javax.naming.NamingException: Cannot lookup '/ProjectDSPRemote'.
[Root exception is java.rmi.RemoteException: Cannot read the response from
the server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local
class incompatible: stream classdesc serialVersionUID = 2128092884552388429,
local class serialVersionUID = -7734383756981201981; nested exception is: 
java.io.InvalidClassException: 
org.apache.openejb.client.EJBMetaDataImpl;
local class incompatible: stream classdesc serialVersionUID =
2128092884552388429, local class serialVersionUID = -7734383756981201981]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:203)
at javax.naming.InitialContext.lookup(Unknown Source)
at TestClient.main(TestClient.java:26)
Caused by: java.rmi.RemoteException: Cannot read the response from the
server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local class
incompatible: stream classdesc serialVersionUID = 2128092884552388429, local
class serialVersionUID = -7734383756981201981; nested exception is: 
java.io.InvalidClassException: 
org.apache.openejb.client.EJBMetaDataImpl;
local class incompatible: stream classdesc serialVersionUID =
2128092884552388429, local class serialVersionUID = -7734383756981201981
at org.apache.openejb.client.Client.processRequest(Client.java:197)
at org.apache.openejb.client.Client.request(Client.java:43)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:74)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:197)
... 2 more
Caused by: java.io.InvalidClassException:
org.apache.openejb.client.EJBMetaDataImpl; local class incompatible: stream
classdesc serialVersionUID = 

Re: Geronimo 2 EJB3 Remote Access Example

2008-01-24 Thread Viet Nguyen
Maybe ProjectDSP has some security settings on it. Try adding this line to it

properties.setProperty(openejb.authentication.realmName, geronimo-admin);

--Viet

On Jan 24, 2008 7:48 AM, xypher [EMAIL PROTECTED] wrote:

 Hi,

 thanks a lot, now it works. But not completely 

 When I'm trying the following code:

 public class TestClient {

 public static void main(String[] args) {

 Context context;
 Properties properties = new Properties();
 properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
 org.apache.openejb.client.RemoteInitialContextFactory);
 properties.setProperty(Context.PROVIDER_URL,
 ejbd://localhost:4201);
 properties.put(java.naming.security.principal, system);
 properties.put(java.naming.security.credentials, manager);

 try {
 context = new InitialContext(properties);

 IProjectDSP projectDSP = (IProjectDSP)
 context.lookup(ProjectDSPRemote);
 //  Project p1 = new Project();
 //  p1.setName(Test);
 //  projectDSP.createProject(p1);
 } catch (NamingException e) {
 e.printStackTrace();
 throw new RuntimeException(e);
 }
 }
 }

 I'm getting this exception:

 javax.naming.AuthenticationException: This principle is not authorized.
 at 
 org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
 at
 org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:122)
 at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
 at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at TestClient.main(TestClient.java:24)
 Exception in thread main java.lang.RuntimeException:
 javax.naming.AuthenticationException: This principle is not authorized.
 at TestClient.main(TestClient.java:32)
 Caused by: javax.naming.AuthenticationException: This principle is not
 authorized.
 at 
 org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
 at
 org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:122)
 at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
 at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at TestClient.main(TestClient.java:24)

 When I don't use a principal, I'm getting this error:

 Exception in thread main java.lang.RuntimeException:
 javax.naming.NamingException: Cannot lookup '/ProjectDSPRemote'. [Root
 exception is java.rmi.RemoteException: Cannot read the response from the
 server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local class
 incompatible: stream classdesc serialVersionUID = 2128092884552388429, local
 class serialVersionUID = -7734383756981201981; nested exception is:
 java.io.InvalidClassException: 
 org.apache.openejb.client.EJBMetaDataImpl;
 local class incompatible: stream classdesc serialVersionUID =
 2128092884552388429, local class serialVersionUID = -7734383756981201981]
 at TestClient.main(TestClient.java:32)
 Caused by: javax.naming.NamingException: Cannot lookup '/ProjectDSPRemote'.
 [Root exception is java.rmi.RemoteException: Cannot read the response from
 the server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local
 class incompatible: stream classdesc serialVersionUID = 2128092884552388429,
 local class serialVersionUID = -7734383756981201981; nested exception is:
 java.io.InvalidClassException: 
 org.apache.openejb.client.EJBMetaDataImpl;
 local class incompatible: stream classdesc serialVersionUID =
 2128092884552388429, local class serialVersionUID = -7734383756981201981]
 at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:203)
 at javax.naming.InitialContext.lookup(Unknown Source)
 at TestClient.main(TestClient.java:26)
 Caused by: java.rmi.RemoteException: Cannot read the response from the
 server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local class
 incompatible: stream classdesc serialVersionUID = 2128092884552388429, local
 class serialVersionUID = -7734383756981201981; nested exception is:
 java.io.InvalidClassException: 
 org.apache.openejb.client.EJBMetaDataImpl;
 local class incompatible: stream classdesc serialVersionUID =
 2128092884552388429, local class serialVersionUID = -7734383756981201981
 at org.apache.openejb.client.Client.processRequest(Client.java:197)
 at org.apache.openejb.client.Client.request(Client.java:43)
 at 

Re: Geronimo 2 EJB3 Remote Access Example

2008-01-24 Thread xypher

Hi,

this was not the problem, but I found the solution.

I had a different openejb JAR File in the build path than the server was
working with.

So the serial version id was different and this was the problem.

Thanks @all for your help. Now its working.



vhnguy2 wrote:
 
 Maybe ProjectDSP has some security settings on it. Try adding this line to
 it
 
 properties.setProperty(openejb.authentication.realmName,
 geronimo-admin);
 
 --Viet
 
 On Jan 24, 2008 7:48 AM, xypher [EMAIL PROTECTED] wrote:

 Hi,

 thanks a lot, now it works. But not completely 

 When I'm trying the following code:

 public class TestClient {

 public static void main(String[] args) {

 Context context;
 Properties properties = new Properties();
 properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
 org.apache.openejb.client.RemoteInitialContextFactory);
 properties.setProperty(Context.PROVIDER_URL,
 ejbd://localhost:4201);
 properties.put(java.naming.security.principal,
 system);
 properties.put(java.naming.security.credentials,
 manager);

 try {
 context = new InitialContext(properties);

 IProjectDSP projectDSP = (IProjectDSP)
 context.lookup(ProjectDSPRemote);
 //  Project p1 = new Project();
 //  p1.setName(Test);
 //  projectDSP.createProject(p1);
 } catch (NamingException e) {
 e.printStackTrace();
 throw new RuntimeException(e);
 }
 }
 }

 I'm getting this exception:

 javax.naming.AuthenticationException: This principle is not authorized.
 at
 org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
 at
 org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:122)
 at javax.naming.spi.NamingManager.getInitialContext(Unknown
 Source)
 at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at TestClient.main(TestClient.java:24)
 Exception in thread main java.lang.RuntimeException:
 javax.naming.AuthenticationException: This principle is not authorized.
 at TestClient.main(TestClient.java:32)
 Caused by: javax.naming.AuthenticationException: This principle is not
 authorized.
 at
 org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
 at
 org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:122)
 at javax.naming.spi.NamingManager.getInitialContext(Unknown
 Source)
 at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at javax.naming.InitialContext.init(Unknown Source)
 at TestClient.main(TestClient.java:24)

 When I don't use a principal, I'm getting this error:

 Exception in thread main java.lang.RuntimeException:
 javax.naming.NamingException: Cannot lookup '/ProjectDSPRemote'. [Root
 exception is java.rmi.RemoteException: Cannot read the response from the
 server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local
 class
 incompatible: stream classdesc serialVersionUID = 2128092884552388429,
 local
 class serialVersionUID = -7734383756981201981; nested exception is:
 java.io.InvalidClassException:
 org.apache.openejb.client.EJBMetaDataImpl;
 local class incompatible: stream classdesc serialVersionUID =
 2128092884552388429, local class serialVersionUID = -7734383756981201981]
 at TestClient.main(TestClient.java:32)
 Caused by: javax.naming.NamingException: Cannot lookup
 '/ProjectDSPRemote'.
 [Root exception is java.rmi.RemoteException: Cannot read the response
 from
 the server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local
 class incompatible: stream classdesc serialVersionUID =
 2128092884552388429,
 local class serialVersionUID = -7734383756981201981; nested exception is:
 java.io.InvalidClassException:
 org.apache.openejb.client.EJBMetaDataImpl;
 local class incompatible: stream classdesc serialVersionUID =
 2128092884552388429, local class serialVersionUID = -7734383756981201981]
 at
 org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:203)
 at javax.naming.InitialContext.lookup(Unknown Source)
 at TestClient.main(TestClient.java:26)
 Caused by: java.rmi.RemoteException: Cannot read the response from the
 server (OEJP/2.0) : org.apache.openejb.client.EJBMetaDataImpl; local
 class
 incompatible: stream classdesc serialVersionUID = 2128092884552388429,
 local
 class serialVersionUID = -7734383756981201981; nested exception is:
 java.io.InvalidClassException:
 org.apache.openejb.client.EJBMetaDataImpl;
 local class incompatible: stream classdesc 

Re: Geronimo 2 EJB3 Remote Access Example

2008-01-23 Thread Viet Nguyen
There are some sample applications on our wiki. For a session bean
sample, you might want to take a look at this:
http://cwiki.apache.org/GMOxDOC20/very-simple-session-ejb-example.html.

There are other samples there too if you're interested.

Thanks,
Viet

On Jan 23, 2008 5:14 PM, xypher [EMAIL PROTECTED] wrote:

 Hi,

 I'm relatively new to Geroimo 2 and EJB3. I googled a lot, but I found no
 simple example for my request. I'd like to develop an Session Bean and to
 access this bean from an remote client over JNDI lookup. Can anybody give my
 an simple example or tell my where I can find something like this.

 I tried a lot, but I'm not sure what I have to configure in the deployment
 descriptors and what is the correct jndi lookup name.

 Thanks.
 --
 View this message in context: 
 http://www.nabble.com/Geronimo-2-EJB3-Remote-Access-Example-tp15053984s134p15053984.html
 Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.