Hi,
I have a similar problem in the case of standalone client without client
container.
When I run the remote client with the folloing jndi properties:
-----
$ java -classpath 'javaee.jar;appserv-rt.jar;.' \
-Djava.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
\
-Djava.naming.provider.url=iiop://192.168.0.1:3700 \
-Djava.naming.factory.url.pkgs=com.sun.enterprise.naming \
-Djava.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
\
Client
-----
(where 192.168.0.1 is remote host)
I got the exception like this:
-----
WARN: "IOP00410201: (COMM_FAILURE) Connection failure: socketType:
IIOP_CLEAR_TEXT; hostname: localhost; port: 3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2348)
at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2369)
at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:212)
at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:225)
at
com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:104)
at
com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:159)
at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:156)
at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:296)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at
org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
at
com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:110)
at
com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:164)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at Client.main(Client2.java:11)
Caused by: java.lang.RuntimeException: java.net.ConnectException:
Connection refused: connect
at
com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:356)
at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:195)
... 12 more
-----
The client unexpectedly tries to connect localhost:3700.
Glassfish runtime ignores property 'java.naming.provider.url'?
I tested with the latest gf ur1-b04.
I know it works with the following property settings, as FAQ said:
-----
$ java -classpath 'javaee.jar;appserv-rt.jar;.' \
-Dorg.omg.CORBA.ORBInitialHost=192.168.0.1 \
-Dorg.omg.CORBA.ORBInitialPort=3700 \
Client
-----
But I like to use jndi.properties with standard way.
Takashi Nishigaya
Kenneth Saks wrote:
> AKostylev wrote:
>
>>Thank you for your answer. It helped a lot.
>>So I've done all that is written in the page
>>http://www.caucho.com/resin-3.0/ejb/corba-client.xtp.
>>To make it work I needed:
>>
>>appserv-deployment-client.jar
>>appserv-launch.jar
>>appserv-rt.jar
>>j2ee.jar
>>javaee.jar.
>>
>>I put
>> <jndi-link>
>> <jndi-name>java:comp/env/ejb</jndi-name>
>> <factory>com.sun.enterprise.naming.SerialInitContextFactory</factory>
>> <init-param org.omg.CORBA.ORBInitialHost="localhost"/>
>> <init-param org.omg.CORBA.ORBInitialPort="3700"/>
>> </jndi-link>
>>
> To bootstrap the appserver's naming service this way you'll need to
> ensure that all the properties that are contained within our
> jndi.properties file are set in your InitialContext. Here's what our
> jndi.properties looks like :
>
> ---------
> java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
> java.naming.factory.url.pkgs=com.sun.enterprise.naming
> # Required to add a javax.naming.spi.StateFactory for CosNaming that
> # supports dynamic RMI-IIOP.
> java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactor
> yImpl
> ---------
>
> You've already got the SerialInitContextFactory set, so try adding :
>
> <init-param java.naming.factory.url.pkgs="com.sun.enterprise.naming"/>
> <init-param
> java.naming.factory.state="com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"/>
>
>>
>>in resin.conf.
>>And then I created a context:
>>Context ic = (Context)new InitialContext().lookup("java:comp/env/ejb");
>>
>>So when I made
>>
>><%
>> NamingEnumeration<NameClassPair> values = ic.list("");
>> while (values.hasMore())
>> {
>> %>
>> <%=values.next().getName()%>
>> <%
>> }
>>%>
>>
>>I got:
>>
>>"ejb env ru.amfitel.j2ee5.ejbtest.Converter
>>ru.amfitel.j2ee5.ejbtest.Converter#ru.amfitel.j2ee5.ejbtest.Converter UserTransaction __SYSTEM jdbc ru.amfitel.j2ee5.ejbtest.Converter__3_x_Internal_RemoteBusinessHome__"
>>
>>So ru.amfitel.j2ee5.ejbtest.Converter was what I need.
>>But when I made
>>
>>Object object = ic.lookup(Converter.class.getName());
>>
>>I got such exception:
>>
>>java.lang.NullPointerException
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:305)
>> at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:61)
>> at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
>> at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
>> at _jsp._test__jsp._jspService(test.jsp:30)
>> at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
>> at com.caucho.jsp.Page.pageservice(Page.java:570)
>> at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:175)
>> at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
>> at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
>> at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
>> at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
>> at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:507)
>> at com.caucho.util.ThreadPool.run(ThreadPool.java:433)
>> at java.lang.Thread.run(Thread.java:595)
>>
>>
>>What is a problem, what do you think?
>>Thank you.
>>
>>
>>
>>>Hi,
>>>
>>>
>>
>>
>>
>>>Recently I saw something on the Resin website concerning J2EE Reference
>>>implementation from Sun and I believe it works fine to do the same with
>>>glassfish.
>>>The fact that it does not work from within glassfish is probably that
>>>Resin itself also has its JNDI properties loaded. So it does the lookup
>>>in its own JNDI server, not the one from glassfish.
>>>
>>>
>>
>>
>>
>>>Anyway I searched the url and here it is using corba for communication:
>>>
>>>
>>
>>
>>
>>>http://www.caucho.com/resin-3.0/ejb/corba-client.xtp
>>>
>>>
>>
>>
>>
>>>Correct me if it should be done in a different way (knowing Resin also
>>>has its own stuff via JNDI, so that has precedence I suppose if you give
>>>no properties to the InitialContext constructor).
>>>
>>>
>>
>>
>>
>>>Just let me know if this solved your problem.
>>>
>>>
>>
>>
>>
>>>Best regards,
>>>
>>>
>>
>>
>>
>>>Christof
>>>
>>>
>>
>>
>>
>>
>>>AKostylev wrote:
>>>
>>>
>>>>I put appserv-rt.jar at web-inf/lib and there is no other
>>>>appserv-rt.jar at web server. So problem is that when using:
>>>>
>>>>Context ic = (Context)new InitialContext();
>>>>
>>>>Object object = ic.lookup(Converter.class.getName());
>>>>
>>>>
>>>>object is null reference.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>Hello,
>>>>
>>>>
>>>>Is appserv-rt.jar still in your classpath? The no-arg constructor for
>>>>InitialContext works because of a jndi.properties file within
>>>>appserv-rt.jar, do you possible have another one that is getting
>>>>picked up? Not sure what would happen if that's the case.
>>>>
>>>>
>>>>What is the stack trace your are getting?
>>>>
>>>>
>>>>-Chase
>>>>
>>>>
>>>>
>>>>AKostylev wrote:
>>>>
>>>>Hello, Kenneth. Thank you for your answer. I'm trying to connect to
>>>>Session bean placed at Glassfish from Resin. So those stand-alone
>>>>client steps fro FAQ are working for console application, but not for
>>>>web application placed at Resin web container. So what I'm trying to
>>>>do: Context ic = (Context)new InitialContext(); Object object =
>>>>ic.lookup(Converter.class.getName()); So as I said, this code is
>>>>working when launching at standalone console application but not at
>>>>jsp page at Resin web container. What should I do
>>>>
>>>>AKostylev wrote:
>>>>
>>>>
>>>>
>>>>Hello. How should I connect to Session bean at Glasshfish from remote
>>>>web container (for example. Resin)? Methods for standalone client are
>>>>not workin for this case.
>>>>
>>>>Do you mean you tried the stand-alone client steps outlined in the EJB
>>>>FAQ and encountered an error? If so, can you post the details. Thanks.
>>>>
>>>>
>>>>
>>>>--ken
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>--
>>>>
>>>>С уважением,
>>>>
>>>> AKostylev mailto:akostylev_at_ipian.kazan.ru
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net For
>>>>additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>>>>
>>>>
>>
>>
>>
>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>>>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>>>
>>>
>>
>>
>>
>>
>>
>
>