hi, can you have a try doing a client with openejb-client-3.1.4?
- Romain 2011/5/11 edward <[email protected]> > 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<[email protected]> >> >> 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 >>> >>> >>> >>> >
