You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Oleg Nitz <on...@ibis.ua> on 2007/08/07 11:07:43 UTC

IOException during JNDI lookup()

David, the original ClassCastException has gone once I removed
the second instance of EJBNetworkService. Probably I should rename the 
subject... done :)

The current exception has two variants:

Caused by: javax.naming.AuthenticationException: 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.openejb.client.JNDIContext.authenticate(JNDIContext.java:196)
         at 
org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181)
         at 
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
         at 
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:175)
         at 
ua.odessa.ibis.core.user.registry.UserRegistryClient.<init>(UserRegistryClient.java:81)

and

Caused by: javax.naming.AuthenticationException: Cannot open object 
output stream to server: ; nested exception is:
         java.net.SocketException: Broken pipe
         at 
org.openejb.client.JNDIContext.authenticate(JNDIContext.java:196)
         at 
org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181)
         at 
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
         at 
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:175)
         at 
ua.odessa.ibis.core.user.registry.UserRegistryClient.<init>(UserRegistryClient.java:81)

The first one is what I get during normal run, the second is what I get 
under debugger.

Still hoping for new guidelines from you,
Oleg

David Jencks wrote:
> Going back to your original stack trace:
> java.lang.ClassCastException: org.openejb.GenericEJBContainer
>         at 
> org.openejb.EJBContainer$$EnhancerByCGLIB$$964163d7.getUnmanagedReference(<generated>) 
> 
>         at org.openejb.ContainerIndex.doStart(ContainerIndex.java:123)
> 
> 
> I think you will need to debug ContainerIndex line 123 and find out what 
> classloaders are involved.  I'm pretty sure the GenericEJBContainer from 
> your application is being loaded from a different copy of openejb than 
> the one ContainerIndex is in.
> 
> It's hard for me to imagine how this could happen unless you had a 
> combination of factors including <inverse-classloading/> set in the 
> environment element of you geronimo plan.  Showing what your geronimo 
> plan is could be helpful.
> 
> thanks
> david jencks
> 
> On Aug 6, 2007, at 7:14 AM, Oleg Nitz wrote:
> 
>> Hi David, I'm back :)
>>
>> I was mistaken about JAAS login. First JAAS login succeeds in a usual 
>> way. Then JNDI lookup() is performed and it fails.
>> Trace info: class org.openejb.client.Client, method request(),
>> conn = ConnectionManager.getConnection( server ); - OK
>> out = conn.getOuputStream(); - OK
>> PROTOCOL_VERSION.writeExternal(out); - OK
>> out.write( req.getRequestType() ); - OK
>> objectOut = new ObjectOutputStream( out ); - FAILS
>> with IOException("Broken pipe");
>>
>> Hoping for new guidelines from you,
>> Oleg
>>
>> Oleg Nitz wrote:
>>> More info: client request reaches server, server (during JNDI lookup) 
>>> performs JAAS login (I have configured my own LoginModule, but of 
>>> course something can be wrong there), login succeeds. I don't know 
>>> what happens then. I guess some unexpected exception happens there, 
>>> and it isn't transferred to client correctly, but leads to 
>>> "unexpected EOF"-like error.
>>> Okay, David, thank you again, conversation with you was really helpful,
>>> it cleared the picture for me, so I think for now I will better stop 
>>> taking more of you time and continue my investigation and experiments.
>>> I'll be back ;)
>>> Oleg
>>> Oleg Nitz wrote:
>>>> No, this is not the case. Client and server take jars from the same
>>>> place, and both use OpenEJB 2.1.1 which comes with Geronimo 1.1.1.
>>>>
>>>> Thanks for you time,
>>>> Oleg
>>>>
>>>> David Jencks wrote:
>>>>> The first thing that comes to mind is that perhaps you are trying 
>>>>> to use incompatible openejb client and server jars?  IIUC geronimo 
>>>>> 1.1.1 needs openejb2 client jars and geronimo 2 needs openejb3 
>>>>> client jars and they are not interoperable.  However I am not the 
>>>>> most expert on this subject.  Knowing exactly which openejb jar 
>>>>> versions are in your client classpath  would definitely be helpful 
>>>>> though.
>>>>>
>>>>> thanks
>>>>> david jencks
>>>>>
>>>>> On Aug 3, 2007, at 9:00 AM, Oleg Nitz wrote:
>>>>>
>>>>>> Thank you for your answer, David. You are right, I already had 
>>>>>> EJBNetworkService and have installed the second one. The idea to 
>>>>>> do this came to me when I got the following exception during JNDI 
>>>>>> lookup of my bean from standalone client app:
>>>>>>
>>>>>> 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.openejb.client.JNDIContext.authenticate(JNDIContext.java:196)
>>>>>>         at 
>>>>>> org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181) 
>>>>>>
>>>>>>         at 
>>>>>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667) 
>>>>>>
>>>>>>         at 
>>>>>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247) 
>>>>>>
>>>>>>         at javax.naming.InitialContext.init(InitialContext.java:223)
>>>>>>         at 
>>>>>> javax.naming.InitialContext.<init>(InitialContext.java:175)
>>>>>>         at 
>>>>>> ua.odessa.ibis.core.user.registry.UserRegistryClient.<init>(UserRegistryClient.java:81) 
>>>>>>
>>>>>>
>>>>>> Then I found this message
>>>>>> http://mail-archives.apache.org/mod_mbox/geronimo-user/200512.mbox/%3C97d040ba7193938d5e1ae6817476d29b@yahoo.com%3E 
>>>>>>
>>>>>> but didn't understand where to put "allowHosts" and decided to add 
>>>>>> a new EJBNetworkService for that :-/
>>>>>> Okay, now I've got it: I've added
>>>>>>      <attribute name="allowHosts">0.0.0.0</attribute>
>>>>>> to EJBNetworkService gbean in config.xml, now it looks this way:
>>>>>>   <module name="geronimo/openejb/1.1.1/car">
>>>>>>     <gbean name="EJBNetworkService">
>>>>>>       <attribute name="host">0.0.0.0</attribute>
>>>>>>       <attribute name="port">4201</attribute>
>>>>>>       <attribute name="allowHosts">0.0.0.0</attribute>
>>>>>>     </gbean>
>>>>>>   </module>
>>>>>> But nothing changes, I get the same exception during lookup().
>>>>>> Please, advise me the next step.
>>>>>>
>>>>>> Thank you for your help,
>>>>>> Oleg
>>>>>>
>>>>>>
>>>>>> David Jencks wrote:
>>>>>>> I don't understand what you are saying about needing to deploy 
>>>>>>> the EJBNetworkService... I can see needing to change the port or 
>>>>>>> host but there's one already started out of the box.
>>>>>>> Your error is caused by having 2 classloaders that load the 
>>>>>>> openejb classes independently.  There should be only one such 
>>>>>>> classloader per jvm, the one from the openejb config (module).  
>>>>>>> Can you figure out what the other one is?  If you really need 
>>>>>>> another listener you should be sure that the openejb 
>>>>>>> configuration (car) is a parent (dependency) of the configuration 
>>>>>>> you put it in.  Openejb is extremely unlikely to work if you have 
>>>>>>> more than one ContainerIndex running since most references to it 
>>>>>>> are through a static variable.
>>>>>>> hope this helps
>>>>>>> david jencks
>>>>>>> On Aug 3, 2007, at 5:35 AM, Oleg Nitz wrote:
>>>>>>>> Hello all,
>>>>>>>>
>>>>>>>> First I have successfully deployed my EJB, but couldn't connect 
>>>>>>>> to it from standalone application. Then I found that I also need 
>>>>>>>> to deploy EJBNetworkService/EJBServer stuff. Okay, did that and got
>>>>>>>>
>>>>>>>> java.lang.ClassCastException: org.openejb.GenericEJBContainer
>>>>>>>>         at 
>>>>>>>> org.openejb.EJBContainer$$EnhancerByCGLIB$$964163d7.getUnmanagedReference(<generated>) 
>>>>>>>>
>>>>>>>>         at 
>>>>>>>> org.openejb.ContainerIndex.doStart(ContainerIndex.java:123)
>>>>>>>>
>>>>>>>> Then I undeployed my EJB and successfully deployed 
>>>>>>>> EJBNetworkService. Now deployment of the EJB causes the same error.
>>>>>>>> I've found such error in the mail archives:
>>>>>>>> http://mail-archives.apache.org/mod_mbox/geronimo-user/200605.mbox/%3C3da992810605180835o38e2dd22i9a93012d6b939ce6@mail.gmail.com%3E 
>>>>>>>>
>>>>>>>> but that message left unanswered.
>>>>>>>> Did anyone have such problems?
>>>>>>>> Any guidelines for me on what to do next?
>>>>>>>>
>>>>>>>> Thanks in advance,
>>>>>>>> Oleg
>>>>>>>>
>>>>>>>> P.S. Geronimo 1.1.1 (actually, WAS CE)
>>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
> 
> 
> 



Re: IOException during JNDI lookup()

Posted by Oleg Nitz <on...@ibis.ua>.
David, I am dumb, I set JNDI port on client to 1099 instead of 4201.
Now lookup works, I'm moving forward.
Thank you very much for your patience!
Regards,
Oleg

Oleg Nitz wrote:
> David, the original ClassCastException has gone once I removed
> the second instance of EJBNetworkService. Probably I should rename the 
> subject... done :)
> 
> The current exception has two variants:
> 
> Caused by: javax.naming.AuthenticationException: 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.openejb.client.JNDIContext.authenticate(JNDIContext.java:196)
>         at 
> org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181)
>         at 
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>         at 
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>         at javax.naming.InitialContext.<init>(InitialContext.java:175)
>         at 
> ua.odessa.ibis.core.user.registry.UserRegistryClient.<init>(UserRegistryClient.java:81) 
> 
> 
> and
> 
> Caused by: javax.naming.AuthenticationException: Cannot open object 
> output stream to server: ; nested exception is:
>         java.net.SocketException: Broken pipe
>         at 
> org.openejb.client.JNDIContext.authenticate(JNDIContext.java:196)
>         at 
> org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181)
>         at 
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>         at 
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>         at javax.naming.InitialContext.<init>(InitialContext.java:175)
>         at 
> ua.odessa.ibis.core.user.registry.UserRegistryClient.<init>(UserRegistryClient.java:81) 
> 
> 
> The first one is what I get during normal run, the second is what I get 
> under debugger.
> 
> Still hoping for new guidelines from you,
> Oleg
> 
> David Jencks wrote:
>> Going back to your original stack trace:
>> java.lang.ClassCastException: org.openejb.GenericEJBContainer
>>         at 
>> org.openejb.EJBContainer$$EnhancerByCGLIB$$964163d7.getUnmanagedReference(<generated>) 
>>
>>         at org.openejb.ContainerIndex.doStart(ContainerIndex.java:123)
>>
>>
>> I think you will need to debug ContainerIndex line 123 and find out 
>> what classloaders are involved.  I'm pretty sure the 
>> GenericEJBContainer from your application is being loaded from a 
>> different copy of openejb than the one ContainerIndex is in.
>>
>> It's hard for me to imagine how this could happen unless you had a 
>> combination of factors including <inverse-classloading/> set in the 
>> environment element of you geronimo plan.  Showing what your geronimo 
>> plan is could be helpful.
>>
>> thanks
>> david jencks
>>
>> On Aug 6, 2007, at 7:14 AM, Oleg Nitz wrote:
>>
>>> Hi David, I'm back :)
>>>
>>> I was mistaken about JAAS login. First JAAS login succeeds in a usual 
>>> way. Then JNDI lookup() is performed and it fails.
>>> Trace info: class org.openejb.client.Client, method request(),
>>> conn = ConnectionManager.getConnection( server ); - OK
>>> out = conn.getOuputStream(); - OK
>>> PROTOCOL_VERSION.writeExternal(out); - OK
>>> out.write( req.getRequestType() ); - OK
>>> objectOut = new ObjectOutputStream( out ); - FAILS
>>> with IOException("Broken pipe");
>>>
>>> Hoping for new guidelines from you,
>>> Oleg
>>>
>>> Oleg Nitz wrote:
>>>> More info: client request reaches server, server (during JNDI 
>>>> lookup) performs JAAS login (I have configured my own LoginModule, 
>>>> but of course something can be wrong there), login succeeds. I don't 
>>>> know what happens then. I guess some unexpected exception happens 
>>>> there, and it isn't transferred to client correctly, but leads to 
>>>> "unexpected EOF"-like error.
>>>> Okay, David, thank you again, conversation with you was really helpful,
>>>> it cleared the picture for me, so I think for now I will better stop 
>>>> taking more of you time and continue my investigation and experiments.
>>>> I'll be back ;)
>>>> Oleg
>>>> Oleg Nitz wrote:
>>>>> No, this is not the case. Client and server take jars from the same
>>>>> place, and both use OpenEJB 2.1.1 which comes with Geronimo 1.1.1.
>>>>>
>>>>> Thanks for you time,
>>>>> Oleg
>>>>>
>>>>> David Jencks wrote:
>>>>>> The first thing that comes to mind is that perhaps you are trying 
>>>>>> to use incompatible openejb client and server jars?  IIUC geronimo 
>>>>>> 1.1.1 needs openejb2 client jars and geronimo 2 needs openejb3 
>>>>>> client jars and they are not interoperable.  However I am not the 
>>>>>> most expert on this subject.  Knowing exactly which openejb jar 
>>>>>> versions are in your client classpath  would definitely be helpful 
>>>>>> though.
>>>>>>
>>>>>> thanks
>>>>>> david jencks
>>>>>>
>>>>>> On Aug 3, 2007, at 9:00 AM, Oleg Nitz wrote:
>>>>>>
>>>>>>> Thank you for your answer, David. You are right, I already had 
>>>>>>> EJBNetworkService and have installed the second one. The idea to 
>>>>>>> do this came to me when I got the following exception during JNDI 
>>>>>>> lookup of my bean from standalone client app:
>>>>>>>
>>>>>>> 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.openejb.client.JNDIContext.authenticate(JNDIContext.java:196)
>>>>>>>         at 
>>>>>>> org.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:181) 
>>>>>>>
>>>>>>>         at 
>>>>>>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667) 
>>>>>>>
>>>>>>>         at 
>>>>>>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247) 
>>>>>>>
>>>>>>>         at javax.naming.InitialContext.init(InitialContext.java:223)
>>>>>>>         at 
>>>>>>> javax.naming.InitialContext.<init>(InitialContext.java:175)
>>>>>>>         at 
>>>>>>> ua.odessa.ibis.core.user.registry.UserRegistryClient.<init>(UserRegistryClient.java:81) 
>>>>>>>
>>>>>>>
>>>>>>> Then I found this message
>>>>>>> http://mail-archives.apache.org/mod_mbox/geronimo-user/200512.mbox/%3C97d040ba7193938d5e1ae6817476d29b@yahoo.com%3E 
>>>>>>>
>>>>>>> but didn't understand where to put "allowHosts" and decided to 
>>>>>>> add a new EJBNetworkService for that :-/
>>>>>>> Okay, now I've got it: I've added
>>>>>>>      <attribute name="allowHosts">0.0.0.0</attribute>
>>>>>>> to EJBNetworkService gbean in config.xml, now it looks this way:
>>>>>>>   <module name="geronimo/openejb/1.1.1/car">
>>>>>>>     <gbean name="EJBNetworkService">
>>>>>>>       <attribute name="host">0.0.0.0</attribute>
>>>>>>>       <attribute name="port">4201</attribute>
>>>>>>>       <attribute name="allowHosts">0.0.0.0</attribute>
>>>>>>>     </gbean>
>>>>>>>   </module>
>>>>>>> But nothing changes, I get the same exception during lookup().
>>>>>>> Please, advise me the next step.
>>>>>>>
>>>>>>> Thank you for your help,
>>>>>>> Oleg
>>>>>>>
>>>>>>>
>>>>>>> David Jencks wrote:
>>>>>>>> I don't understand what you are saying about needing to deploy 
>>>>>>>> the EJBNetworkService... I can see needing to change the port or 
>>>>>>>> host but there's one already started out of the box.
>>>>>>>> Your error is caused by having 2 classloaders that load the 
>>>>>>>> openejb classes independently.  There should be only one such 
>>>>>>>> classloader per jvm, the one from the openejb config (module).  
>>>>>>>> Can you figure out what the other one is?  If you really need 
>>>>>>>> another listener you should be sure that the openejb 
>>>>>>>> configuration (car) is a parent (dependency) of the 
>>>>>>>> configuration you put it in.  Openejb is extremely unlikely to 
>>>>>>>> work if you have more than one ContainerIndex running since most 
>>>>>>>> references to it are through a static variable.
>>>>>>>> hope this helps
>>>>>>>> david jencks
>>>>>>>> On Aug 3, 2007, at 5:35 AM, Oleg Nitz wrote:
>>>>>>>>> Hello all,
>>>>>>>>>
>>>>>>>>> First I have successfully deployed my EJB, but couldn't connect 
>>>>>>>>> to it from standalone application. Then I found that I also 
>>>>>>>>> need to deploy EJBNetworkService/EJBServer stuff. Okay, did 
>>>>>>>>> that and got
>>>>>>>>>
>>>>>>>>> java.lang.ClassCastException: org.openejb.GenericEJBContainer
>>>>>>>>>         at 
>>>>>>>>> org.openejb.EJBContainer$$EnhancerByCGLIB$$964163d7.getUnmanagedReference(<generated>) 
>>>>>>>>>
>>>>>>>>>         at 
>>>>>>>>> org.openejb.ContainerIndex.doStart(ContainerIndex.java:123)
>>>>>>>>>
>>>>>>>>> Then I undeployed my EJB and successfully deployed 
>>>>>>>>> EJBNetworkService. Now deployment of the EJB causes the same 
>>>>>>>>> error.
>>>>>>>>> I've found such error in the mail archives:
>>>>>>>>> http://mail-archives.apache.org/mod_mbox/geronimo-user/200605.mbox/%3C3da992810605180835o38e2dd22i9a93012d6b939ce6@mail.gmail.com%3E 
>>>>>>>>>
>>>>>>>>> but that message left unanswered.
>>>>>>>>> Did anyone have such problems?
>>>>>>>>> Any guidelines for me on what to do next?
>>>>>>>>>
>>>>>>>>> Thanks in advance,
>>>>>>>>> Oleg
>>>>>>>>>
>>>>>>>>> P.S. Geronimo 1.1.1 (actually, WAS CE)
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
>>
>>
> 
> 
> 
>