Start remote container with daemon client API

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Start remote container with daemon client API

bmuschko
Hi Ali,

I was looking at the Daemon client API, specifically the classes "DaemonClient" and "DaemonStart". It seems as if the start operation does not support remote containers, only locally installed container. The reason why I say that is that the method "DaemonStart#setContainer" takes a single parameter of type "org.codehaus.cargo.container.InstalledLocalContainer". Just setting the "handleId" parameter for "DaemonStart" causes a NullPointerException at runtime.

Can you give me some background information on this?

Thanks,

Ben
Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

S. Ali Tokmen
Hi Ben

The daemon is used to start an installed local container on a remote
machine; so it takes the same parameters.

Remote containers are only for remote deployments, which is NOT what the
daemon does.

Thank you

S. Ali Tokmen
http://ali.tokmen.com/

My IM, GSM, PGP and other contact details
are on http://contact.ali.tokmen.com

On 07/03/14 22:22, bmuschko wrote:

> Hi Ali,
>
> I was looking at the Daemon client API, specifically the classes
> "DaemonClient" and "DaemonStart". It seems as if the start operation does
> not support remote containers, only locally installed container. The reason
> why I say that is that the method "DaemonStart#setContainer" takes a single
> parameter of type "org.codehaus.cargo.container.InstalledLocalContainer".
> Just setting the "handleId" parameter for "DaemonStart" causes a
> NullPointerException at runtime.
>
> Can you give me some background information on this?
>
> Thanks,
>
> Ben
>
>
>
> --
> View this message in context: http://cargo.996258.n3.nabble.com/Start-remote-container-with-daemon-client-API-tp18407.html
> Sent from the User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

bmuschko
OK, what is the easiest way to achieve this? DaemonStop#stop makes sense to me. You just have to provide the handle ID. Wouldn't it be enough to have a similar method for DaemonStart in case you don't want to provide any additional configuration?

My current approach looks similar to this:

DaemonStart request = new DaemonStart();
Container container = new DefaultContainerFactory().createContainer("tomcat7x", ContainerType.toType("installed"), null);
request.setContainer(container);
request.setHandleId("tomcat7");

DaemonClient daemonClient = new DaemonClient("http://localhost:18000");
daemonClient.start(request);

Unfortunately, that causes an exception. Can you give me hint what might be wrong here?

Caused by: org.codehaus.cargo.container.ContainerException: Cannot create container. There's no registered container for the parameters (container [id = [tomcat7x]], container type [installed]). Actually there are no valid types registered for this container. Maybe you've made a mistake spelling it?
        at org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.createImplementation(AbstractGenericHintFactory.java:140)
Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

S. Ali Tokmen
Hi Ben

I guess your task might be eased greatly by the testcase we use for the
Java client API:
http://svn.codehaus.org/cargo/extensions/trunk/daemon/itests/client/src/test/java/org/codehaus/cargo/itests/daemon/client/CargoDaemonClientTest.java

Hope this helps

S. Ali Tokmen
http://ali.tokmen.com/

My IM, GSM, PGP and other contact details
are on http://contact.ali.tokmen.com

On 08/03/14 14:56, bmuschko wrote:

> OK, what is the easiest way to achieve this? DaemonStop#stop makes sense to
> me. You just have to provide the handle ID. Wouldn't it be enough to have a
> similar method for DaemonStart in case you don't want to provide any
> additional configuration?
>
> My current approach looks similar to this:
>
> DaemonStart request = new DaemonStart();
> Container container = new
> DefaultContainerFactory().createContainer("tomcat7x",
> ContainerType.toType("installed"), null);
> request.setContainer(container);
> request.setHandleId("tomcat7");
>
> DaemonClient daemonClient = new DaemonClient("http://localhost:18000");
> daemonClient.start(request);
>
> Unfortunately, that causes an exception. Can you give me hint what might be
> wrong here?
>
> Caused by: org.codehaus.cargo.container.ContainerException: Cannot create
> container. There's no registered container for the parameters (container [id
> = [tomcat7x]], container type [installed]). Actually there are no valid
> types registered for this container. Maybe you've made a mistake spelling
> it?
> at
> org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.createImplementation(AbstractGenericHintFactory.java:140)
>
>
>
> --
> View this message in context: http://cargo.996258.n3.nabble.com/Start-remote-container-with-daemon-client-API-tp18407p18411.html
> Sent from the User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

bmuschko
I played around with this but get similar exceptions:

org.codehaus.cargo.container.ContainerException: Cannot create configuration. There's no registered configuration for the parameters (container [id = [tomcat7x], type = [installed]], configuration type [existing]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it?

From my perspective, I don't understand why I should have to provide any configuration (like container ID, configuration directory etc.). This was already configured through the daemon web app. Shouldn't the API be able to look up this information by providing the handle ID? The same is true for the stop operation.

Thanks,

Ben
Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

S. Ali Tokmen
Hi Ben

Assuming the container with identifier test1 is defined in the daemon, the below would work:
DaemonStart start = new DaemonStart();
start.setHandleId("test1");
client.start(start);
Thank you

S. Ali Tokmen
http://ali.tokmen.com/

My IM, GSM, PGP and other contact details
are on http://contact.ali.tokmen.com
On 09/03/14 17:04, bmuschko wrote:
I played around with this but get similar exceptions:

org.codehaus.cargo.container.ContainerException: Cannot create
configuration. There's no registered configuration for the parameters
(container [id = [tomcat7x], type = [installed]], configuration type
[existing]). Actually there are no valid types registered for this
configuration. Maybe you've made a mistake spelling it?

>From my perspective, I don't understand why I should have to provide any
configuration (like container ID, configuration directory etc.). This was
already configured through the daemon web app. Shouldn't the API be able to
look up this information by providing the handle ID? The same is true for
the stop operation.

Thanks,

Ben



--
View this message in context: http://cargo.996258.n3.nabble.com/Start-remote-container-with-daemon-client-API-tp18407p18416.html
Sent from the User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

bmuschko
That's what I had tried at first but it causes an exception.

Caused by: java.lang.NullPointerException
        at org.codehaus.cargo.tools.daemon.DaemonClient.start(DaemonClient.java:214)
        at org.codehaus.cargo.tools.daemon.DaemonClient$start.call(Unknown Source)

Maybe there's a missing null check somewhere on configuration.

Ben
Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

S. Ali Tokmen
Hi Ben

I think this is a bug - it works from the browser.

Can you open a JIRA entry please?

Thank you

S. Ali Tokmen
http://ali.tokmen.com/

My IM, GSM, PGP and other contact details
are on http://contact.ali.tokmen.com

On 11/03/14 02:48, bmuschko wrote:

> That's what I had tried at first but it causes an exception.
>
> Caused by: java.lang.NullPointerException
> at
> org.codehaus.cargo.tools.daemon.DaemonClient.start(DaemonClient.java:214)
> at org.codehaus.cargo.tools.daemon.DaemonClient$start.call(Unknown Source)
>
> Maybe there's a missing null check somewhere on configuration.
>
> Ben
>
>
>
> --
> View this message in context: http://cargo.996258.n3.nabble.com/Start-remote-container-with-daemon-client-API-tp18407p18425.html
> Sent from the User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Start remote container with daemon client API

bmuschko