You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by edward <ja...@gmail.com> on 2011/05/10 04:00:20 UTC

standalone EJB client, failed

Hi, ALL,

I am trying to write a standalone EJB client, but failed.

I have a standalone OpenEJB in C drive, I place simple-stateless-1.0.jar 
into its app folder. This jar is from OpenEjb example. It works, from 
log I can see,

///////////////
2011-05-09 21:07:30,825 - INFO  - Jndi(name=CalculatorImplLocal) --> 
Ejb(deployment-id=CalculatorImpl)
2011-05-09 21:07:30,827 - INFO  - Jndi(name=CalculatorImplRemote) --> 
Ejb(deployment-id=CalculatorImpl)
2011-05-09 21:07:30,856 - INFO  - Created 
Ejb(deployment-id=CalculatorImpl, ejb-name=CalculatorImpl, container=My 
Stateless Container)
2011-05-09 21:07:30,856 - INFO  - Deployed 
Application(path=C:\openejb-3.1.4\apps\simple-stateless-1.0.jar)
///////////////

Now the clinent is
//////////////////////
Properties properties = new Properties();
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
"org.apache.openejb.client.RemoteInitialContextFactory");
         //properties.put("java.naming.provider.url", 
"ejbd://localhost:4201");
         properties.put("java.naming.provider.url", 
"http://localhost:4204/ejb");

         InitialContext initialContext = new InitialContext(properties);

         Object object = initialContext.lookup("CalculatorImplRemote");
/////////////////////////////
It always give me error:

/////////////////
Exception in thread "main" javax.naming.NamingException: Cannot lookup 
'/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: 
Cannot open object input stream to server (OEJP/3.1) : null; nested 
exception is:
     java.io.EOFException]
     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
     at javax.naming.InitialContext.lookup(Unknown Source)
     at com.Test.main(Test.java:20)
Caused by: java.rmi.RemoteException: Cannot open object input stream to 
server (OEJP/3.1) : null; nested exception is:
     java.io.EOFException
     at org.apache.openejb.client.Client.processRequest(Client.java:159)
     at org.apache.openejb.client.Client.request(Client.java:42)
     at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
     ... 2 more
Caused by: java.io.EOFException
     at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
     at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown 
Source)
     at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
     at java.io.ObjectInputStream.<init>(Unknown Source)
     at 
org.apache.openejb.client.EjbObjectInputStream.<init>(EjbObjectInputStream.java:31)
     at org.apache.openejb.client.Client.processRequest(Client.java:156)
     ... 5 more

////////
I am using  openejb-itests-standalone-client-3.0.jar as its reference api.

Please help me on this.

Thanks
Edward



Re: standalone EJB client, failed

Posted by edward <ja...@gmail.com>.
finally I made it work.

The lib includes :
javaee-api-5.0-3.jar
openejb-client-3.1.4.jar
simple-stateless-1.0.jar

Properties properties = new Properties();
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
"org.apache.openejb.client.RemoteInitialContextFactory");
         properties.put(Context.PROVIDER_URL, "ejbd://localhost:4201");

         InitialContext initialContext = new InitialContext(properties);

         Object object = initialContext.lookup("CalculatorImplRemote");

Thanks for your help.
Edward


On 5/12/2011 12:49 AM, David Blevins wrote:
> On May 11, 2011, at 7:51 PM, edward wrote:
>
>> Hi, what do you mean "openejb-client-3.1.4 " ? and how ?
> Seemed like from the earlier comment on using the itest 3.0 client as a reference that maybe you might also be using the openejb-client-3.0.jar file.  The client/sever versions need to match.  The first email also had the ejbd connection url commented out and the http being used, that's probably where Tomcat got pulled into the discussion.
>
> How are you building&  executing the client and which libraries&  versions are you including?
>
>
> -David
>
>> On 5/11/2011 1:03 AM, Romain Manni-Bucau wrote:
>>> hi,
>>>
>>> can you have a try doing a client with openejb-client-3.1.4?
>>>
>>> - Romain
>>>
>>> 2011/5/11 edward<ja...@gmail.com>
>>>
>>>> Hi, Romain,
>>>> I am not using Tomcat, just openEJB 3.1.4,  ejb jar is copied into app
>>>> folder. I tried : properties.put(Context.PROVIDER_URL,
>>>> "ejbd://localhost:4201"), still doesn't work.
>>>>
>>>> //////////////
>>>> C:\openejb-3.1.4\bin>openejb start
>>>> Apache OpenEJB 3.1.4    build: 20101112-03:32
>>>> http://openejb.apache.org/
>>>> log4j:WARN No appenders could be found for logger
>>>> (org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).
>>>> log4j:WARN Please initialize the log4j system properly.
>>>> [init] OpenEJB Remote Server
>>>>   ** Starting Services **
>>>>   NAME                 IP              PORT
>>>>   httpejbd             127.0.0.1       4204
>>>>   admin thread         127.0.0.1       4200
>>>>   ejbd                 127.0.0.1       4201
>>>>   ejbd                 127.0.0.1       4203
>>>>   hsql                 127.0.0.1       9001
>>>>   telnet               127.0.0.1       4202
>>>> -------
>>>> Ready!
>>>> ///////////////////
>>>>
>>>> error message is
>>>> ///////////
>>>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>>>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: Cannot
>>>> deternmine server protocol version: Received null/0.0; nested exception is:
>>>>     java.io.IOException: Unable to read protocol version.  Reached the end
>>>> of the stream.]
>>>>
>>>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>>>     at javax.naming.InitialContext.lookup(Unknown Source)
>>>>     at com.Test.main(Test.java:20)
>>>> Caused by: java.rmi.RemoteException: Cannot deternmine server protocol
>>>> version: Received null/0.0; nested exception is:
>>>>     java.io.IOException: Unable to read protocol version.  Reached the end
>>>> of the stream.
>>>>     at org.apache.openejb.client.Client.processRequest(Client.java:151)
>>>>
>>>>     at org.apache.openejb.client.Client.request(Client.java:42)
>>>>     at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>>>     ... 2 more
>>>> Caused by: java.io.IOException: Unable to read protocol version.  Reached
>>>> the end of the stream.
>>>>     at
>>>> org.apache.openejb.client.ProtocolMetaData.readExternal(ProtocolMetaData.java:89)
>>>>     at org.apache.openejb.client.Client.processRequest(Client.java:148)
>>>>     ... 5 more
>>>>
>>>> ///////////////////
>>>>
>>>> Thanks.
>>>> Edward
>>>>
>>>>
>>>>
>>>>
>>>> On 5/10/2011 1:20 AM, Romain Manni-Bucau wrote:
>>>>
>>>>> Hi Edward,
>>>>>
>>>>> i guess yo are trying to lookup an object in tomcat (because of the http
>>>>> url), if tomcat is on the 4204 port the url should be
>>>>> http://localhost:4204/<openejb
>>>>> context name>/ejb, it is often http://localhost/openejb/ejb.
>>>>>
>>>>> If you are not using tomcat can you please explain us how you run your
>>>>> server.
>>>>>
>>>>> - Romain
>>>>>
>>>>> 2011/5/10 edward<ja...@gmail.com>
>>>>>
>>>>>   Hi, ALL,
>>>>>> I am trying to write a standalone EJB client, but failed.
>>>>>>
>>>>>> I have a standalone OpenEJB in C drive, I place simple-stateless-1.0.jar
>>>>>> into its app folder. This jar is from OpenEjb example. It works, from log
>>>>>> I
>>>>>> can see,
>>>>>>
>>>>>> ///////////////
>>>>>> 2011-05-09 21:07:30,825 - INFO  - Jndi(name=CalculatorImplLocal) -->
>>>>>> Ejb(deployment-id=CalculatorImpl)
>>>>>> 2011-05-09 21:07:30,827 - INFO  - Jndi(name=CalculatorImplRemote) -->
>>>>>> Ejb(deployment-id=CalculatorImpl)
>>>>>> 2011-05-09 21:07:30,856 - INFO  - Created
>>>>>> Ejb(deployment-id=CalculatorImpl,
>>>>>> ejb-name=CalculatorImpl, container=My Stateless Container)
>>>>>> 2011-05-09 21:07:30,856 - INFO  - Deployed
>>>>>> Application(path=C:\openejb-3.1.4\apps\simple-stateless-1.0.jar)
>>>>>> ///////////////
>>>>>>
>>>>>> Now the clinent is
>>>>>> //////////////////////
>>>>>> Properties properties = new Properties();
>>>>>>         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>>>>>> "org.apache.openejb.client.RemoteInitialContextFactory");
>>>>>>         //properties.put("java.naming.provider.url",
>>>>>> "ejbd://localhost:4201");
>>>>>>         properties.put("java.naming.provider.url", "
>>>>>> http://localhost:4204/ejb");
>>>>>>
>>>>>>         InitialContext initialContext = new InitialContext(properties);
>>>>>>
>>>>>>         Object object = initialContext.lookup("CalculatorImplRemote");
>>>>>> /////////////////////////////
>>>>>> It always give me error:
>>>>>>
>>>>>> /////////////////
>>>>>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>>>>>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException:
>>>>>> Cannot
>>>>>> open object input stream to server (OEJP/3.1) : null; nested exception
>>>>>> is:
>>>>>>     java.io.EOFException]
>>>>>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>>>>>     at javax.naming.InitialContext.lookup(Unknown Source)
>>>>>>     at com.Test.main(Test.java:20)
>>>>>> Caused by: java.rmi.RemoteException: Cannot open object input stream to
>>>>>> server (OEJP/3.1) : null; nested exception is:
>>>>>>     java.io.EOFException
>>>>>>     at org.apache.openejb.client.Client.processRequest(Client.java:159)
>>>>>>     at org.apache.openejb.client.Client.request(Client.java:42)
>>>>>>     at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>>>>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>>>>>     ... 2 more
>>>>>> Caused by: java.io.EOFException
>>>>>>     at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
>>>>>>     at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown
>>>>>> Source)
>>>>>>     at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
>>>>>>     at java.io.ObjectInputStream.<init>(Unknown Source)
>>>>>>     at
>>>>>>
>>>>>> org.apache.openejb.client.EjbObjectInputStream.<init>(EjbObjectInputStream.java:31)
>>>>>>     at org.apache.openejb.client.Client.processRequest(Client.java:156)
>>>>>>     ... 5 more
>>>>>>
>>>>>> ////////
>>>>>> I am using  openejb-itests-standalone-client-3.0.jar as its reference
>>>>>> api.
>>>>>>
>>>>>> Please help me on this.
>>>>>>
>>>>>> Thanks
>>>>>> Edward
>>>>>>
>>>>>>
>>>>>>
>>>>>>


Re: standalone EJB client, failed

Posted by David Blevins <da...@gmail.com>.
On May 11, 2011, at 7:51 PM, edward wrote:

> Hi, what do you mean "openejb-client-3.1.4 " ? and how ?

Seemed like from the earlier comment on using the itest 3.0 client as a reference that maybe you might also be using the openejb-client-3.0.jar file.  The client/sever versions need to match.  The first email also had the ejbd connection url commented out and the http being used, that's probably where Tomcat got pulled into the discussion.

How are you building & executing the client and which libraries & versions are you including?


-David

> 
> On 5/11/2011 1:03 AM, Romain Manni-Bucau wrote:
>> hi,
>> 
>> can you have a try doing a client with openejb-client-3.1.4?
>> 
>> - Romain
>> 
>> 2011/5/11 edward<ja...@gmail.com>
>> 
>>> Hi, Romain,
>>> I am not using Tomcat, just openEJB 3.1.4,  ejb jar is copied into app
>>> folder. I tried : properties.put(Context.PROVIDER_URL,
>>> "ejbd://localhost:4201"), still doesn't work.
>>> 
>>> //////////////
>>> C:\openejb-3.1.4\bin>openejb start
>>> Apache OpenEJB 3.1.4    build: 20101112-03:32
>>> http://openejb.apache.org/
>>> log4j:WARN No appenders could be found for logger
>>> (org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).
>>> log4j:WARN Please initialize the log4j system properly.
>>> [init] OpenEJB Remote Server
>>>  ** Starting Services **
>>>  NAME                 IP              PORT
>>>  httpejbd             127.0.0.1       4204
>>>  admin thread         127.0.0.1       4200
>>>  ejbd                 127.0.0.1       4201
>>>  ejbd                 127.0.0.1       4203
>>>  hsql                 127.0.0.1       9001
>>>  telnet               127.0.0.1       4202
>>> -------
>>> Ready!
>>> ///////////////////
>>> 
>>> error message is
>>> ///////////
>>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: Cannot
>>> deternmine server protocol version: Received null/0.0; nested exception is:
>>>    java.io.IOException: Unable to read protocol version.  Reached the end
>>> of the stream.]
>>> 
>>>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>>    at javax.naming.InitialContext.lookup(Unknown Source)
>>>    at com.Test.main(Test.java:20)
>>> Caused by: java.rmi.RemoteException: Cannot deternmine server protocol
>>> version: Received null/0.0; nested exception is:
>>>    java.io.IOException: Unable to read protocol version.  Reached the end
>>> of the stream.
>>>    at org.apache.openejb.client.Client.processRequest(Client.java:151)
>>> 
>>>    at org.apache.openejb.client.Client.request(Client.java:42)
>>>    at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>>    ... 2 more
>>> Caused by: java.io.IOException: Unable to read protocol version.  Reached
>>> the end of the stream.
>>>    at
>>> org.apache.openejb.client.ProtocolMetaData.readExternal(ProtocolMetaData.java:89)
>>>    at org.apache.openejb.client.Client.processRequest(Client.java:148)
>>>    ... 5 more
>>> 
>>> ///////////////////
>>> 
>>> Thanks.
>>> Edward
>>> 
>>> 
>>> 
>>> 
>>> On 5/10/2011 1:20 AM, Romain Manni-Bucau wrote:
>>> 
>>>> Hi Edward,
>>>> 
>>>> i guess yo are trying to lookup an object in tomcat (because of the http
>>>> url), if tomcat is on the 4204 port the url should be
>>>> http://localhost:4204/<openejb
>>>> context name>/ejb, it is often http://localhost/openejb/ejb.
>>>> 
>>>> If you are not using tomcat can you please explain us how you run your
>>>> server.
>>>> 
>>>> - Romain
>>>> 
>>>> 2011/5/10 edward<ja...@gmail.com>
>>>> 
>>>>  Hi, ALL,
>>>>> I am trying to write a standalone EJB client, but failed.
>>>>> 
>>>>> I have a standalone OpenEJB in C drive, I place simple-stateless-1.0.jar
>>>>> into its app folder. This jar is from OpenEjb example. It works, from log
>>>>> I
>>>>> can see,
>>>>> 
>>>>> ///////////////
>>>>> 2011-05-09 21:07:30,825 - INFO  - Jndi(name=CalculatorImplLocal) -->
>>>>> Ejb(deployment-id=CalculatorImpl)
>>>>> 2011-05-09 21:07:30,827 - INFO  - Jndi(name=CalculatorImplRemote) -->
>>>>> Ejb(deployment-id=CalculatorImpl)
>>>>> 2011-05-09 21:07:30,856 - INFO  - Created
>>>>> Ejb(deployment-id=CalculatorImpl,
>>>>> ejb-name=CalculatorImpl, container=My Stateless Container)
>>>>> 2011-05-09 21:07:30,856 - INFO  - Deployed
>>>>> Application(path=C:\openejb-3.1.4\apps\simple-stateless-1.0.jar)
>>>>> ///////////////
>>>>> 
>>>>> Now the clinent is
>>>>> //////////////////////
>>>>> Properties properties = new Properties();
>>>>>        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>>>>> "org.apache.openejb.client.RemoteInitialContextFactory");
>>>>>        //properties.put("java.naming.provider.url",
>>>>> "ejbd://localhost:4201");
>>>>>        properties.put("java.naming.provider.url", "
>>>>> http://localhost:4204/ejb");
>>>>> 
>>>>>        InitialContext initialContext = new InitialContext(properties);
>>>>> 
>>>>>        Object object = initialContext.lookup("CalculatorImplRemote");
>>>>> /////////////////////////////
>>>>> It always give me error:
>>>>> 
>>>>> /////////////////
>>>>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>>>>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException:
>>>>> Cannot
>>>>> open object input stream to server (OEJP/3.1) : null; nested exception
>>>>> is:
>>>>>    java.io.EOFException]
>>>>>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>>>>    at javax.naming.InitialContext.lookup(Unknown Source)
>>>>>    at com.Test.main(Test.java:20)
>>>>> Caused by: java.rmi.RemoteException: Cannot open object input stream to
>>>>> server (OEJP/3.1) : null; nested exception is:
>>>>>    java.io.EOFException
>>>>>    at org.apache.openejb.client.Client.processRequest(Client.java:159)
>>>>>    at org.apache.openejb.client.Client.request(Client.java:42)
>>>>>    at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>>>>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>>>>    ... 2 more
>>>>> Caused by: java.io.EOFException
>>>>>    at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
>>>>>    at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown
>>>>> Source)
>>>>>    at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
>>>>>    at java.io.ObjectInputStream.<init>(Unknown Source)
>>>>>    at
>>>>> 
>>>>> org.apache.openejb.client.EjbObjectInputStream.<init>(EjbObjectInputStream.java:31)
>>>>>    at org.apache.openejb.client.Client.processRequest(Client.java:156)
>>>>>    ... 5 more
>>>>> 
>>>>> ////////
>>>>> I am using  openejb-itests-standalone-client-3.0.jar as its reference
>>>>> api.
>>>>> 
>>>>> Please help me on this.
>>>>> 
>>>>> Thanks
>>>>> Edward
>>>>> 
>>>>> 
>>>>> 
>>>>> 
> 


Re: standalone EJB client, failed

Posted by edward <ja...@gmail.com>.
Hi, what do you mean "openejb-client-3.1.4 " ? and how ?

Thanks.
Edward

On 5/11/2011 1:03 AM, Romain Manni-Bucau wrote:
> hi,
>
> can you have a try doing a client with openejb-client-3.1.4?
>
> - Romain
>
> 2011/5/11 edward<ja...@gmail.com>
>
>> Hi, Romain,
>> I am not using Tomcat, just openEJB 3.1.4,  ejb jar is copied into app
>> folder. I tried : properties.put(Context.PROVIDER_URL,
>> "ejbd://localhost:4201"), still doesn't work.
>>
>> //////////////
>> C:\openejb-3.1.4\bin>openejb start
>> Apache OpenEJB 3.1.4    build: 20101112-03:32
>> http://openejb.apache.org/
>> log4j:WARN No appenders could be found for logger
>> (org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).
>> log4j:WARN Please initialize the log4j system properly.
>> [init] OpenEJB Remote Server
>>   ** Starting Services **
>>   NAME                 IP              PORT
>>   httpejbd             127.0.0.1       4204
>>   admin thread         127.0.0.1       4200
>>   ejbd                 127.0.0.1       4201
>>   ejbd                 127.0.0.1       4203
>>   hsql                 127.0.0.1       9001
>>   telnet               127.0.0.1       4202
>> -------
>> Ready!
>> ///////////////////
>>
>> error message is
>> ///////////
>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: Cannot
>> deternmine server protocol version: Received null/0.0; nested exception is:
>>     java.io.IOException: Unable to read protocol version.  Reached the end
>> of the stream.]
>>
>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>     at javax.naming.InitialContext.lookup(Unknown Source)
>>     at com.Test.main(Test.java:20)
>> Caused by: java.rmi.RemoteException: Cannot deternmine server protocol
>> version: Received null/0.0; nested exception is:
>>     java.io.IOException: Unable to read protocol version.  Reached the end
>> of the stream.
>>     at org.apache.openejb.client.Client.processRequest(Client.java:151)
>>
>>     at org.apache.openejb.client.Client.request(Client.java:42)
>>     at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>     ... 2 more
>> Caused by: java.io.IOException: Unable to read protocol version.  Reached
>> the end of the stream.
>>     at
>> org.apache.openejb.client.ProtocolMetaData.readExternal(ProtocolMetaData.java:89)
>>     at org.apache.openejb.client.Client.processRequest(Client.java:148)
>>     ... 5 more
>>
>> ///////////////////
>>
>> Thanks.
>> Edward
>>
>>
>>
>>
>> On 5/10/2011 1:20 AM, Romain Manni-Bucau wrote:
>>
>>> Hi Edward,
>>>
>>> i guess yo are trying to lookup an object in tomcat (because of the http
>>> url), if tomcat is on the 4204 port the url should be
>>> http://localhost:4204/<openejb
>>> context name>/ejb, it is often http://localhost/openejb/ejb.
>>>
>>> If you are not using tomcat can you please explain us how you run your
>>> server.
>>>
>>> - Romain
>>>
>>> 2011/5/10 edward<ja...@gmail.com>
>>>
>>>   Hi, ALL,
>>>> I am trying to write a standalone EJB client, but failed.
>>>>
>>>> I have a standalone OpenEJB in C drive, I place simple-stateless-1.0.jar
>>>> into its app folder. This jar is from OpenEjb example. It works, from log
>>>> I
>>>> can see,
>>>>
>>>> ///////////////
>>>> 2011-05-09 21:07:30,825 - INFO  - Jndi(name=CalculatorImplLocal) -->
>>>> Ejb(deployment-id=CalculatorImpl)
>>>> 2011-05-09 21:07:30,827 - INFO  - Jndi(name=CalculatorImplRemote) -->
>>>> Ejb(deployment-id=CalculatorImpl)
>>>> 2011-05-09 21:07:30,856 - INFO  - Created
>>>> Ejb(deployment-id=CalculatorImpl,
>>>> ejb-name=CalculatorImpl, container=My Stateless Container)
>>>> 2011-05-09 21:07:30,856 - INFO  - Deployed
>>>> Application(path=C:\openejb-3.1.4\apps\simple-stateless-1.0.jar)
>>>> ///////////////
>>>>
>>>> Now the clinent is
>>>> //////////////////////
>>>> Properties properties = new Properties();
>>>>         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>>>> "org.apache.openejb.client.RemoteInitialContextFactory");
>>>>         //properties.put("java.naming.provider.url",
>>>> "ejbd://localhost:4201");
>>>>         properties.put("java.naming.provider.url", "
>>>> http://localhost:4204/ejb");
>>>>
>>>>         InitialContext initialContext = new InitialContext(properties);
>>>>
>>>>         Object object = initialContext.lookup("CalculatorImplRemote");
>>>> /////////////////////////////
>>>> It always give me error:
>>>>
>>>> /////////////////
>>>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>>>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException:
>>>> Cannot
>>>> open object input stream to server (OEJP/3.1) : null; nested exception
>>>> is:
>>>>     java.io.EOFException]
>>>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>>>     at javax.naming.InitialContext.lookup(Unknown Source)
>>>>     at com.Test.main(Test.java:20)
>>>> Caused by: java.rmi.RemoteException: Cannot open object input stream to
>>>> server (OEJP/3.1) : null; nested exception is:
>>>>     java.io.EOFException
>>>>     at org.apache.openejb.client.Client.processRequest(Client.java:159)
>>>>     at org.apache.openejb.client.Client.request(Client.java:42)
>>>>     at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>>>     ... 2 more
>>>> Caused by: java.io.EOFException
>>>>     at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
>>>>     at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown
>>>> Source)
>>>>     at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
>>>>     at java.io.ObjectInputStream.<init>(Unknown Source)
>>>>     at
>>>>
>>>> org.apache.openejb.client.EjbObjectInputStream.<init>(EjbObjectInputStream.java:31)
>>>>     at org.apache.openejb.client.Client.processRequest(Client.java:156)
>>>>     ... 5 more
>>>>
>>>> ////////
>>>> I am using  openejb-itests-standalone-client-3.0.jar as its reference
>>>> api.
>>>>
>>>> Please help me on this.
>>>>
>>>> Thanks
>>>> Edward
>>>>
>>>>
>>>>
>>>>


Re: standalone EJB client, failed

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hi,

can you have a try doing a client with openejb-client-3.1.4?

- Romain

2011/5/11 edward <ja...@gmail.com>

> Hi, Romain,
> I am not using Tomcat, just openEJB 3.1.4,  ejb jar is copied into app
> folder. I tried : properties.put(Context.PROVIDER_URL,
> "ejbd://localhost:4201"), still doesn't work.
>
> //////////////
> C:\openejb-3.1.4\bin>openejb start
> Apache OpenEJB 3.1.4    build: 20101112-03:32
> http://openejb.apache.org/
> log4j:WARN No appenders could be found for logger
> (org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).
> log4j:WARN Please initialize the log4j system properly.
> [init] OpenEJB Remote Server
>  ** Starting Services **
>  NAME                 IP              PORT
>  httpejbd             127.0.0.1       4204
>  admin thread         127.0.0.1       4200
>  ejbd                 127.0.0.1       4201
>  ejbd                 127.0.0.1       4203
>  hsql                 127.0.0.1       9001
>  telnet               127.0.0.1       4202
> -------
> Ready!
> ///////////////////
>
> error message is
> ///////////
> Exception in thread "main" javax.naming.NamingException: Cannot lookup
> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: Cannot
> deternmine server protocol version: Received null/0.0; nested exception is:
>    java.io.IOException: Unable to read protocol version.  Reached the end
> of the stream.]
>
>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>    at javax.naming.InitialContext.lookup(Unknown Source)
>    at com.Test.main(Test.java:20)
> Caused by: java.rmi.RemoteException: Cannot deternmine server protocol
> version: Received null/0.0; nested exception is:
>    java.io.IOException: Unable to read protocol version.  Reached the end
> of the stream.
>    at org.apache.openejb.client.Client.processRequest(Client.java:151)
>
>    at org.apache.openejb.client.Client.request(Client.java:42)
>    at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>    ... 2 more
> Caused by: java.io.IOException: Unable to read protocol version.  Reached
> the end of the stream.
>    at
> org.apache.openejb.client.ProtocolMetaData.readExternal(ProtocolMetaData.java:89)
>    at org.apache.openejb.client.Client.processRequest(Client.java:148)
>    ... 5 more
>
> ///////////////////
>
> Thanks.
> Edward
>
>
>
>
> On 5/10/2011 1:20 AM, Romain Manni-Bucau wrote:
>
>> Hi Edward,
>>
>> i guess yo are trying to lookup an object in tomcat (because of the http
>> url), if tomcat is on the 4204 port the url should be
>> http://localhost:4204/<openejb
>> context name>/ejb, it is often http://localhost/openejb/ejb.
>>
>> If you are not using tomcat can you please explain us how you run your
>> server.
>>
>> - Romain
>>
>> 2011/5/10 edward<ja...@gmail.com>
>>
>>  Hi, ALL,
>>>
>>> I am trying to write a standalone EJB client, but failed.
>>>
>>> I have a standalone OpenEJB in C drive, I place simple-stateless-1.0.jar
>>> into its app folder. This jar is from OpenEjb example. It works, from log
>>> I
>>> can see,
>>>
>>> ///////////////
>>> 2011-05-09 21:07:30,825 - INFO  - Jndi(name=CalculatorImplLocal) -->
>>> Ejb(deployment-id=CalculatorImpl)
>>> 2011-05-09 21:07:30,827 - INFO  - Jndi(name=CalculatorImplRemote) -->
>>> Ejb(deployment-id=CalculatorImpl)
>>> 2011-05-09 21:07:30,856 - INFO  - Created
>>> Ejb(deployment-id=CalculatorImpl,
>>> ejb-name=CalculatorImpl, container=My Stateless Container)
>>> 2011-05-09 21:07:30,856 - INFO  - Deployed
>>> Application(path=C:\openejb-3.1.4\apps\simple-stateless-1.0.jar)
>>> ///////////////
>>>
>>> Now the clinent is
>>> //////////////////////
>>> Properties properties = new Properties();
>>>        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>>> "org.apache.openejb.client.RemoteInitialContextFactory");
>>>        //properties.put("java.naming.provider.url",
>>> "ejbd://localhost:4201");
>>>        properties.put("java.naming.provider.url", "
>>> http://localhost:4204/ejb");
>>>
>>>        InitialContext initialContext = new InitialContext(properties);
>>>
>>>        Object object = initialContext.lookup("CalculatorImplRemote");
>>> /////////////////////////////
>>> It always give me error:
>>>
>>> /////////////////
>>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException:
>>> Cannot
>>> open object input stream to server (OEJP/3.1) : null; nested exception
>>> is:
>>>    java.io.EOFException]
>>>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>>    at javax.naming.InitialContext.lookup(Unknown Source)
>>>    at com.Test.main(Test.java:20)
>>> Caused by: java.rmi.RemoteException: Cannot open object input stream to
>>> server (OEJP/3.1) : null; nested exception is:
>>>    java.io.EOFException
>>>    at org.apache.openejb.client.Client.processRequest(Client.java:159)
>>>    at org.apache.openejb.client.Client.request(Client.java:42)
>>>    at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>>    ... 2 more
>>> Caused by: java.io.EOFException
>>>    at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
>>>    at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown
>>> Source)
>>>    at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
>>>    at java.io.ObjectInputStream.<init>(Unknown Source)
>>>    at
>>>
>>> org.apache.openejb.client.EjbObjectInputStream.<init>(EjbObjectInputStream.java:31)
>>>    at org.apache.openejb.client.Client.processRequest(Client.java:156)
>>>    ... 5 more
>>>
>>> ////////
>>> I am using  openejb-itests-standalone-client-3.0.jar as its reference
>>> api.
>>>
>>> Please help me on this.
>>>
>>> Thanks
>>> Edward
>>>
>>>
>>>
>>>
>

Re: standalone EJB client, failed

Posted by edward <ja...@gmail.com>.
Hi, Romain,
I am not using Tomcat, just openEJB 3.1.4,  ejb jar is copied into app 
folder. I tried : properties.put(Context.PROVIDER_URL, 
"ejbd://localhost:4201"), still doesn't work.

//////////////
C:\openejb-3.1.4\bin>openejb start
Apache OpenEJB 3.1.4    build: 20101112-03:32
http://openejb.apache.org/
log4j:WARN No appenders could be found for logger 
(org.apache.openejb.resource.activemq.ActiveMQResourceAdapter).
log4j:WARN Please initialize the log4j system properly.
[init] OpenEJB Remote Server
   ** Starting Services **
   NAME                 IP              PORT
   httpejbd             127.0.0.1       4204
   admin thread         127.0.0.1       4200
   ejbd                 127.0.0.1       4201
   ejbd                 127.0.0.1       4203
   hsql                 127.0.0.1       9001
   telnet               127.0.0.1       4202
-------
Ready!
///////////////////

error message is
///////////
Exception in thread "main" javax.naming.NamingException: Cannot lookup 
'/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: 
Cannot deternmine server protocol version: Received null/0.0; nested 
exception is:
     java.io.IOException: Unable to read protocol version.  Reached the 
end of the stream.]
     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
     at javax.naming.InitialContext.lookup(Unknown Source)
     at com.Test.main(Test.java:20)
Caused by: java.rmi.RemoteException: Cannot deternmine server protocol 
version: Received null/0.0; nested exception is:
     java.io.IOException: Unable to read protocol version.  Reached the 
end of the stream.
     at org.apache.openejb.client.Client.processRequest(Client.java:151)
     at org.apache.openejb.client.Client.request(Client.java:42)
     at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
     ... 2 more
Caused by: java.io.IOException: Unable to read protocol version.  
Reached the end of the stream.
     at 
org.apache.openejb.client.ProtocolMetaData.readExternal(ProtocolMetaData.java:89)
     at org.apache.openejb.client.Client.processRequest(Client.java:148)
     ... 5 more

///////////////////

Thanks.
Edward



On 5/10/2011 1:20 AM, Romain Manni-Bucau wrote:
> Hi Edward,
>
> i guess yo are trying to lookup an object in tomcat (because of the http
> url), if tomcat is on the 4204 port the url should be
> http://localhost:4204/<openejb
> context name>/ejb, it is often http://localhost/openejb/ejb.
>
> If you are not using tomcat can you please explain us how you run your
> server.
>
> - Romain
>
> 2011/5/10 edward<ja...@gmail.com>
>
>> Hi, ALL,
>>
>> I am trying to write a standalone EJB client, but failed.
>>
>> I have a standalone OpenEJB in C drive, I place simple-stateless-1.0.jar
>> into its app folder. This jar is from OpenEjb example. It works, from log I
>> can see,
>>
>> ///////////////
>> 2011-05-09 21:07:30,825 - INFO  - Jndi(name=CalculatorImplLocal) -->
>> Ejb(deployment-id=CalculatorImpl)
>> 2011-05-09 21:07:30,827 - INFO  - Jndi(name=CalculatorImplRemote) -->
>> Ejb(deployment-id=CalculatorImpl)
>> 2011-05-09 21:07:30,856 - INFO  - Created Ejb(deployment-id=CalculatorImpl,
>> ejb-name=CalculatorImpl, container=My Stateless Container)
>> 2011-05-09 21:07:30,856 - INFO  - Deployed
>> Application(path=C:\openejb-3.1.4\apps\simple-stateless-1.0.jar)
>> ///////////////
>>
>> Now the clinent is
>> //////////////////////
>> Properties properties = new Properties();
>>         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>> "org.apache.openejb.client.RemoteInitialContextFactory");
>>         //properties.put("java.naming.provider.url",
>> "ejbd://localhost:4201");
>>         properties.put("java.naming.provider.url", "
>> http://localhost:4204/ejb");
>>
>>         InitialContext initialContext = new InitialContext(properties);
>>
>>         Object object = initialContext.lookup("CalculatorImplRemote");
>> /////////////////////////////
>> It always give me error:
>>
>> /////////////////
>> Exception in thread "main" javax.naming.NamingException: Cannot lookup
>> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: Cannot
>> open object input stream to server (OEJP/3.1) : null; nested exception is:
>>     java.io.EOFException]
>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>>     at javax.naming.InitialContext.lookup(Unknown Source)
>>     at com.Test.main(Test.java:20)
>> Caused by: java.rmi.RemoteException: Cannot open object input stream to
>> server (OEJP/3.1) : null; nested exception is:
>>     java.io.EOFException
>>     at org.apache.openejb.client.Client.processRequest(Client.java:159)
>>     at org.apache.openejb.client.Client.request(Client.java:42)
>>     at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>>     ... 2 more
>> Caused by: java.io.EOFException
>>     at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
>>     at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown
>> Source)
>>     at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
>>     at java.io.ObjectInputStream.<init>(Unknown Source)
>>     at
>> org.apache.openejb.client.EjbObjectInputStream.<init>(EjbObjectInputStream.java:31)
>>     at org.apache.openejb.client.Client.processRequest(Client.java:156)
>>     ... 5 more
>>
>> ////////
>> I am using  openejb-itests-standalone-client-3.0.jar as its reference api.
>>
>> Please help me on this.
>>
>> Thanks
>> Edward
>>
>>
>>


Re: standalone EJB client, failed

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Edward,

i guess yo are trying to lookup an object in tomcat (because of the http
url), if tomcat is on the 4204 port the url should be
http://localhost:4204/<openejb
context name>/ejb, it is often http://localhost/openejb/ejb.

If you are not using tomcat can you please explain us how you run your
server.

- Romain

2011/5/10 edward <ja...@gmail.com>

> Hi, ALL,
>
> I am trying to write a standalone EJB client, but failed.
>
> I have a standalone OpenEJB in C drive, I place simple-stateless-1.0.jar
> into its app folder. This jar is from OpenEjb example. It works, from log I
> can see,
>
> ///////////////
> 2011-05-09 21:07:30,825 - INFO  - Jndi(name=CalculatorImplLocal) -->
> Ejb(deployment-id=CalculatorImpl)
> 2011-05-09 21:07:30,827 - INFO  - Jndi(name=CalculatorImplRemote) -->
> Ejb(deployment-id=CalculatorImpl)
> 2011-05-09 21:07:30,856 - INFO  - Created Ejb(deployment-id=CalculatorImpl,
> ejb-name=CalculatorImpl, container=My Stateless Container)
> 2011-05-09 21:07:30,856 - INFO  - Deployed
> Application(path=C:\openejb-3.1.4\apps\simple-stateless-1.0.jar)
> ///////////////
>
> Now the clinent is
> //////////////////////
> Properties properties = new Properties();
>        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
>        //properties.put("java.naming.provider.url",
> "ejbd://localhost:4201");
>        properties.put("java.naming.provider.url", "
> http://localhost:4204/ejb");
>
>        InitialContext initialContext = new InitialContext(properties);
>
>        Object object = initialContext.lookup("CalculatorImplRemote");
> /////////////////////////////
> It always give me error:
>
> /////////////////
> Exception in thread "main" javax.naming.NamingException: Cannot lookup
> '/CalculatorImplRemote'. [Root exception is java.rmi.RemoteException: Cannot
> open object input stream to server (OEJP/3.1) : null; nested exception is:
>    java.io.EOFException]
>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
>    at javax.naming.InitialContext.lookup(Unknown Source)
>    at com.Test.main(Test.java:20)
> Caused by: java.rmi.RemoteException: Cannot open object input stream to
> server (OEJP/3.1) : null; nested exception is:
>    java.io.EOFException
>    at org.apache.openejb.client.Client.processRequest(Client.java:159)
>    at org.apache.openejb.client.Client.request(Client.java:42)
>    at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
>    ... 2 more
> Caused by: java.io.EOFException
>    at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
>    at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown
> Source)
>    at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
>    at java.io.ObjectInputStream.<init>(Unknown Source)
>    at
> org.apache.openejb.client.EjbObjectInputStream.<init>(EjbObjectInputStream.java:31)
>    at org.apache.openejb.client.Client.processRequest(Client.java:156)
>    ... 5 more
>
> ////////
> I am using  openejb-itests-standalone-client-3.0.jar as its reference api.
>
> Please help me on this.
>
> Thanks
> Edward
>
>
>