Home » Modeling » EMF » [CDO] Launching a CDO server and connecting immediately to it from the client fails...
| | |
Re: [CDO] Launching a CDO server and connecting immediately to it from the client fails... [message #429348 is a reply to message #429343] |
Tue, 21 April 2009 07:27 |
Stefan Winkler Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Anders,
is there a particular reason why you are using the TCP connection CDO
server on the same machine instead of strating the CDO Server in the
same JVM using the IPluginContainer as discussed in the "[CDO] Starting
a CDO server programatically" thread? With the IPluginContainer, startup
and communication should be faster than with starting a new Process and
talking over TCP...
But regarding your question: With TCP you usually get a "connection
refused" error on the networking layer if you try to contact a port
which is not open.
So you have to wait until the port is open before you try to connect.
What you could do is to follow the messages of the child process running
the server and wait for the message saying that the server has been
started, before you connect.
Cheers,
Stefan
> The client is first editing a model using an XMLResource. Then the
> client starts a new CDO server/repository (if necessary) so that the
> model can be moved to it. Thus the client need to wait until the
> server is up and running. I thought that I could let the client try to
> connect immediately after launching the server process, but it turned
> out that doing so generated the exception below. Strangely enough the
> client needs to wait for a few seconds before trying to connect, then
> it works...
>
> ---
> Anders
>
> Simon Mc Duff wrote:
>>
>> hi Anders,
>> Anders Forsell wrote:
>>
>>> I am launching a CDO repository from my Java application using
>>> "ProcessBuilder.start()" with a port number as argument, but when
>>> trying to connect to the same port from the Client it fails after 10
>>> seconds with a TimeoutRuntimeException (see stack below).
>>
>> how many time do you allow your server to bootstrap before starting
>> your client ? basically does your server is ready before starting
>> your client ?
>>
>>> If the client waits by sleeping a couple of seconds before
>>> connecting it succeeds.
>>> Why is this so and, how can I handle this without Thread.sleep from
>>> the client ?
>>
>> Don`t know yet. :-)
>>
>> Simon
>>
>>
>>> ---
>>> Anders
>>
>>> org.eclipse.net4j.channel.ChannelException:
>>> org.eclipse.net4j.util.concurrent.TimeoutRuntimeException:
>>> Registration timeout after 10000 milliseconds
>>> at
>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:171)
>>
>>> at
>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:1)
>>
>>> at
>> org.eclipse.net4j.signal.failover.NOOPFailOverStrategy.handl eOpen(NOOPFailOverStrategy.java:53)
>>
>>> at
>>> org.eclipse.net4j.signal.SignalProtocol.open(SignalProtocol. java:165)
>>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.openSession(CDOClientProtocol.java:76)
>>
>>> at
>> org.eclipse.emf.internal.cdo.session.CDOSessionImpl.doActiva te(CDOSessionImpl.java:619)
>>
>>> at
>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionImpl.doAct ivate(CDONet4jSessionImpl.java:82)
>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycl e.java:62)
>>> at
>> org.eclipse.emf.internal.cdo.session.CDOSessionConfiguration Impl.openSession(CDOSessionConfigurationImpl.java:125)
>>
>>> at
>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionConfigurat ionImpl.openSession(CDONet4jSessionConfigurationImpl.java:62 )
>>
>>
>>
|
|
|
Re: [CDO] Launching a CDO server and connecting immediately to it from the client fails... [message #429351 is a reply to message #429348] |
Tue, 21 April 2009 09:05 |
Anders Forsell Messages: 127 Registered: July 2009 |
Senior Member |
|
|
Hi Stefan,
See below
Stefan Winkler wrote:
> Anders,
>
> is there a particular reason why you are using the TCP connection CDO
> server on the same machine instead of strating the CDO Server in the
> same JVM using the IPluginContainer as discussed in the "[CDO] Starting
> a CDO server programatically" thread? With the IPluginContainer, startup
> and communication should be faster than with starting a new Process and
> talking over TCP...
Yes, I have thought about that but prefer different processes so that
the repository would be alive even if the client crashes.
>
> But regarding your question: With TCP you usually get a "connection
> refused" error on the networking layer if you try to contact a port
> which is not open.
> So you have to wait until the port is open before you try to connect.
Ok, I see.
>
> What you could do is to follow the messages of the child process running
> the server and wait for the message saying that the server has been
> started, before you connect.
I'll try that, thanks!
>
> Cheers,
> Stefan
>
>> The client is first editing a model using an XMLResource. Then the
>> client starts a new CDO server/repository (if necessary) so that the
>> model can be moved to it. Thus the client need to wait until the
>> server is up and running. I thought that I could let the client try to
>> connect immediately after launching the server process, but it turned
>> out that doing so generated the exception below. Strangely enough the
>> client needs to wait for a few seconds before trying to connect, then
>> it works...
>
>> ---
>> Anders
>>
>> Simon Mc Duff wrote:
>>> hi Anders,
>>> Anders Forsell wrote:
>>>
>>>> I am launching a CDO repository from my Java application using
>>>> "ProcessBuilder.start()" with a port number as argument, but when
>>>> trying to connect to the same port from the Client it fails after 10
>>>> seconds with a TimeoutRuntimeException (see stack below).
>>> how many time do you allow your server to bootstrap before starting
>>> your client ? basically does your server is ready before starting
>>> your client ?
>>>
>>>> If the client waits by sleeping a couple of seconds before
>>>> connecting it succeeds.
>>>> Why is this so and, how can I handle this without Thread.sleep from
>>>> the client ?
>>> Don`t know yet. :-)
>>>
>>> Simon
>>>
>>>
>>>> ---
>>>> Anders
>>>> org.eclipse.net4j.channel.ChannelException:
>>>> org.eclipse.net4j.util.concurrent.TimeoutRuntimeException:
>>>> Registration timeout after 10000 milliseconds
>>>> at
>>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:171)
>>>
>>>> at
>>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:1)
>>>
>>>> at
>>> org.eclipse.net4j.signal.failover.NOOPFailOverStrategy.handl eOpen(NOOPFailOverStrategy.java:53)
>>>
>>>> at
>>>> org.eclipse.net4j.signal.SignalProtocol.open(SignalProtocol. java:165)
>>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.openSession(CDOClientProtocol.java:76)
>>>
>>>> at
>>> org.eclipse.emf.internal.cdo.session.CDOSessionImpl.doActiva te(CDOSessionImpl.java:619)
>>>
>>>> at
>>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionImpl.doAct ivate(CDONet4jSessionImpl.java:82)
>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycl e.java:62)
>>>> at
>>> org.eclipse.emf.internal.cdo.session.CDOSessionConfiguration Impl.openSession(CDOSessionConfigurationImpl.java:125)
>>>
>>>> at
>>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionConfigurat ionImpl.openSession(CDONet4jSessionConfigurationImpl.java:62 )
>>>
>>>
>>>
|
|
|
Re: [CDO] Launching a CDO server and connecting immediately to it from the client fails... [message #429498 is a reply to message #429351] |
Fri, 24 April 2009 08:59 |
|
Anders,
I don't really understand what you're trying to achieve, or better: why.
Maybe the problem is just that you start the TCPConnector asynchronously
and don't call waitForConnection()?
I have no clue what a ProcessBuilder is. Is it a question of how to
synchronize on it's progress?
Cheers
/Eike
----
http://thegordian.blogspot.com
Anders Forsell schrieb:
> Hi Stefan,
>
> See below
>
> Stefan Winkler wrote:
>> Anders,
>>
>> is there a particular reason why you are using the TCP connection CDO
>> server on the same machine instead of strating the CDO Server in the
>> same JVM using the IPluginContainer as discussed in the "[CDO] Starting
>> a CDO server programatically" thread? With the IPluginContainer, startup
>> and communication should be faster than with starting a new Process and
>> talking over TCP...
> Yes, I have thought about that but prefer different processes so that
> the repository would be alive even if the client crashes.
>>
>> But regarding your question: With TCP you usually get a "connection
>> refused" error on the networking layer if you try to contact a port
>> which is not open.
>> So you have to wait until the port is open before you try to connect.
> Ok, I see.
>>
>> What you could do is to follow the messages of the child process running
>> the server and wait for the message saying that the server has been
>> started, before you connect.
> I'll try that, thanks!
>>
>> Cheers,
>> Stefan
>>
>>> The client is first editing a model using an XMLResource. Then the
>>> client starts a new CDO server/repository (if necessary) so that the
>>> model can be moved to it. Thus the client need to wait until the
>>> server is up and running. I thought that I could let the client try to
>>> connect immediately after launching the server process, but it turned
>>> out that doing so generated the exception below. Strangely enough the
>>> client needs to wait for a few seconds before trying to connect, then
>>> it works...
>>
>>> ---
>>> Anders
>>>
>>> Simon Mc Duff wrote:
>>>> hi Anders,
>>>> Anders Forsell wrote:
>>>>
>>>>> I am launching a CDO repository from my Java application using
>>>>> "ProcessBuilder.start()" with a port number as argument, but when
>>>>> trying to connect to the same port from the Client it fails after 10
>>>>> seconds with a TimeoutRuntimeException (see stack below).
>>>> how many time do you allow your server to bootstrap before starting
>>>> your client ? basically does your server is ready before starting
>>>> your client ?
>>>>
>>>>> If the client waits by sleeping a couple of seconds before
>>>>> connecting it succeeds.
>>>>> Why is this so and, how can I handle this without Thread.sleep from
>>>>> the client ?
>>>> Don`t know yet. :-)
>>>>
>>>> Simon
>>>>
>>>>
>>>>> ---
>>>>> Anders
>>>>> org.eclipse.net4j.channel.ChannelException:
>>>>> org.eclipse.net4j.util.concurrent.TimeoutRuntimeException:
>>>>> Registration timeout after 10000 milliseconds
>>>>> at
>>>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:171)
>>>>
>>>>
>>>>> at
>>>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:1)
>>>>
>>>>
>>>>> at
>>>> org.eclipse.net4j.signal.failover.NOOPFailOverStrategy.handl eOpen(NOOPFailOverStrategy.java:53)
>>>>
>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalProtocol.open(SignalProtocol. java:165)
>>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.openSession(CDOClientProtocol.java:76)
>>>>
>>>>
>>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDOSessionImpl.doActiva te(CDOSessionImpl.java:619)
>>>>
>>>>
>>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionImpl.doAct ivate(CDONet4jSessionImpl.java:82)
>>>>
>>>>
>>>>> at
>>>>> org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycl e.java:62)
>>>>>
>>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDOSessionConfiguration Impl.openSession(CDOSessionConfigurationImpl.java:125)
>>>>
>>>>
>>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionConfigurat ionImpl.openSession(CDONet4jSessionConfigurationImpl.java:62 )
>>>>
>>>>
>>>>
>>>>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Launching a CDO server and connecting immediately to it from the client fails... [message #429706 is a reply to message #429498] |
Thu, 30 April 2009 06:01 |
Anders Forsell Messages: 127 Registered: July 2009 |
Senior Member |
|
|
Hi Eike,
ProcessBuilder is a Java class used to launch child processes.
From my client application I am launching the CDO Server repository
process. When trying to connect to the repository immediately after
launching the child process using...
container = ContainerUtil.createContainer();
Net4jUtil.prepareContainer(container);
TCPUtil.prepareContainer(container);
CDOUtil.prepareContainer(container);
container.activate();
connector = TCPUtil.getConnector(container, "localhost:2036");
connector.waitForConnection(10000);
CDOSessionConfiguration configuration =
CDONet4jUtil.createSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName("repo1");
session = configuration.openSession();
.... it fails with the "org.eclipse.net4j.channel.ChannelException:
org.eclipse.net4j.util.concurrent.TimeoutRuntimeException: Registration
timeout after 10000 milliseconds".
Stefan indicated that the port must be open so I solved this right now
by waiting for until a java.net.Socket.Socket class can be created on
the port without exception. A better solution would be to listen to the
output of the repository process as Stefan suggested.
Or, do you have an even better solution for this?
Thanks,
---
Anders
Eike Stepper wrote:
> Anders,
>
> I don't really understand what you're trying to achieve, or better: why.
> Maybe the problem is just that you start the TCPConnector asynchronously
> and don't call waitForConnection()?
> I have no clue what a ProcessBuilder is. Is it a question of how to
> synchronize on it's progress?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
>
>
> Anders Forsell schrieb:
>> Hi Stefan,
>>
>> See below
>>
>> Stefan Winkler wrote:
>>> Anders,
>>>
>>> is there a particular reason why you are using the TCP connection CDO
>>> server on the same machine instead of strating the CDO Server in the
>>> same JVM using the IPluginContainer as discussed in the "[CDO] Starting
>>> a CDO server programatically" thread? With the IPluginContainer, startup
>>> and communication should be faster than with starting a new Process and
>>> talking over TCP...
>> Yes, I have thought about that but prefer different processes so that
>> the repository would be alive even if the client crashes.
>>> But regarding your question: With TCP you usually get a "connection
>>> refused" error on the networking layer if you try to contact a port
>>> which is not open.
>>> So you have to wait until the port is open before you try to connect.
>> Ok, I see.
>>> What you could do is to follow the messages of the child process running
>>> the server and wait for the message saying that the server has been
>>> started, before you connect.
>> I'll try that, thanks!
>>> Cheers,
>>> Stefan
>>>
>>>> The client is first editing a model using an XMLResource. Then the
>>>> client starts a new CDO server/repository (if necessary) so that the
>>>> model can be moved to it. Thus the client need to wait until the
>>>> server is up and running. I thought that I could let the client try to
>>>> connect immediately after launching the server process, but it turned
>>>> out that doing so generated the exception below. Strangely enough the
>>>> client needs to wait for a few seconds before trying to connect, then
>>>> it works...
>>>> ---
>>>> Anders
>>>>
>>>> Simon Mc Duff wrote:
>>>>> hi Anders,
>>>>> Anders Forsell wrote:
>>>>>
>>>>>> I am launching a CDO repository from my Java application using
>>>>>> "ProcessBuilder.start()" with a port number as argument, but when
>>>>>> trying to connect to the same port from the Client it fails after 10
>>>>>> seconds with a TimeoutRuntimeException (see stack below).
>>>>> how many time do you allow your server to bootstrap before starting
>>>>> your client ? basically does your server is ready before starting
>>>>> your client ?
>>>>>
>>>>>> If the client waits by sleeping a couple of seconds before
>>>>>> connecting it succeeds.
>>>>>> Why is this so and, how can I handle this without Thread.sleep from
>>>>>> the client ?
>>>>> Don`t know yet. :-)
>>>>>
>>>>> Simon
>>>>>
>>>>>
>>>>>> ---
>>>>>> Anders
>>>>>> org.eclipse.net4j.channel.ChannelException:
>>>>>> org.eclipse.net4j.util.concurrent.TimeoutRuntimeException:
>>>>>> Registration timeout after 10000 milliseconds
>>>>>> at
>>>>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:171)
>>>>>
>>>>>
>>>>>> at
>>>>> org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(Channel Multiplexer.java:1)
>>>>>
>>>>>
>>>>>> at
>>>>> org.eclipse.net4j.signal.failover.NOOPFailOverStrategy.handl eOpen(NOOPFailOverStrategy.java:53)
>>>>>
>>>>>
>>>>>> at
>>>>>> org.eclipse.net4j.signal.SignalProtocol.open(SignalProtocol. java:165)
>>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.openSession(CDOClientProtocol.java:76)
>>>>>
>>>>>
>>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDOSessionImpl.doActiva te(CDOSessionImpl.java:619)
>>>>>
>>>>>
>>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionImpl.doAct ivate(CDONet4jSessionImpl.java:82)
>>>>>
>>>>>
>>>>>> at
>>>>>> org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycl e.java:62)
>>>>>>
>>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDOSessionConfiguration Impl.openSession(CDOSessionConfigurationImpl.java:125)
>>>>>
>>>>>
>>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionConfigurat ionImpl.openSession(CDONet4jSessionConfigurationImpl.java:62 )
>>>>>
>>>>>
>>>>>
>>>>>
|
|
| |
Goto Forum:
Current Time: Mon May 06 00:58:15 GMT 2024
Powered by FUDForum. Page generated in 0.03034 seconds
|