I'm using Geronimo 2.2 which uses OpenEJB 3.1.2. I have a client
application
which retrieves a remote EJB reference and makes a remote EJB method
call.
I'm seeing the following message being logged by the OpenEJB
client on
the
client side...
Oct 28, 2009 3:36:03 PM
org.apache.openejb.client.StickyConnectionStrategy
connect
WARNING: Failover: Cannot connect to server(s): ejbd://0.0.0.0:4201
Exception: Cannot connect to server 'ejbd://0.0.0.0:4201'. Check
that
the
server is started and that the specified serverURL is correct..
Trying
next.
Well, the serverURL is not correct, and it's also not the one I
provided.
Here's a snippet of the client code...
final URI serverURI = new URI( "ejbd", null, "192.168.0.1", 4201,
null,
null, null );
final Properties contextProperties = new Properties( );
contextProperties.put( Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory" );
contextProperties.put( Context.PROVIDER_URL,
serverURI.toString( ) );
final InitialContext ctx = new InitialContext( contextProperties );
final MyEjbService remote = (MyEjbService)ctx.lookup("MyEjbRemote");
final String serverTime = remote.getServerTime();
In
org
.apache
.openejb.client.StickyConnectionStrategy.connect(ClusterMetaData
cluster, ServerMetaData server), the ctx.lookup("MyEjbRemote")
call is
successful, but the next call to remote.getServerTime() produces the
error
message indicated above, yet still succeeds. Further calls to
remote.getServerTime() work fine and do not produce any error
messages.
I debugged enough to find the cause. I'll try to explain... The
first
client-server communication involves a handshake where
ClusterRequest and
ClusterResponse objects are exchanged. During this handshake the
server
returns a URI of "ejbd://0.0.0.0:4201". On the next communication
to the
server, for the remote.getServerTime() method call, the
org
.apache
.openejb.client.StickyConnectionStrategy.connect(ClusterMetaData
cluster, ServerMetaData server) code attempts to use the URI
returned by
the
server, which obviously fails, resulting in the message, then it
falls
back
to the original, correct URI, which is successful.
My question: What is the reason for the ClusterRequest/
ClusterResponse
handshake, and why does the OpenEJB client try to connect using an
invalid
URI provided by server?
--
View this message in context:
http://www.nabble.com/OpenEJB-3.1.2---%22Cannot-connect-to-server%22-WARNING-message-tp26103713p26103713.html
Sent from the OpenEJB User mailing list archive at Nabble.com.