You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yiannis Mavroukakis <yi...@jaguarfreight.com> on 2007/01/21 18:25:11 UTC

Embedded Tomcat and application communication

Hello,

I have the following scenario. I wish to integrate tomcat into an existing server application , so that a
webapp can send configuration commands and query that application's status . Browsing through the list, the most definitive answer I have seen is to use RMI. Is there another path to accomplish this or is RMI the only solution? 


Thank you,

 

Yiannis


Note:__________________________________________________________________
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient. Jaguar Freight Services and any of its subsidiaries
each reserve the right to monitor all e-mail communications through its
networks.
Any views expressed in this message are those of the individual sender,
except where the message states otherwise and the sender is authorized
to state them to be the views of any such entity.
________________________________________________________________________
This e-mail has been scanned for all known viruses.

Re: Embedded Tomcat and application communication

Posted by ben short <be...@benshort.co.uk>.
On further reading...

Server server = new Server(8080);
Context root = new Context(server,"/",Context.SESSIONS);
root.addServlet(new ServletHolder(new HelloServlet("Ciao")), "/*");
server.start();

You can pass the interface to your application into the HelloServlet's
constructor.

My app actually provides a hessian webservice to the application via
jetty, so i couldn't do exactly as the example shows.

Here is a snippet, if your interested.

mJettyServer = new Server();

      mJettyServer.addListener(mJettyIp + ":" + mJettyPort);

      ServletHttpContext ctx = (ServletHttpContext)
mJettyServer.getContext("/webservice");

      ServletHolder servletHolder = ctx.addServlet(
          "wservice", // servlet name
          "/wservice", // URI mapping pattern
          "com.caucho.hessian.server.HessianServlet" // class name
      );

      servletHolder.setInitParameter("api-class",
"com.mycompany.myapp.IWebservice");
      servletHolder.setInitParameter("service-class",
com.mycompany.myapp.WebserviceImp");

      mJettyServer.start();

Ben



On 1/23/07, ben short <be...@benshort.co.uk> wrote:
> Hi,
>
> I have done something similar, but used Jetty [1] as I couldn't figure
> out how to get tomcat to do it..
>
> My application registers a servlet and starts jetty. the servlet gets
> the interface to the application via a static method. But it all works
> OK. Maybe you could set the application interface into the
> ServletConfig somehow and the servlet could grab it in the init
> method.
>
> I hope this is of some help.
>
> Ben
>
> ps: sorry to mention jetty on a tomcat list ;)
>
> [1] http://docs.codehaus.org/display/JETTY/Embedding+Jetty
>
>
>
> On 1/23/07, Yiannis Mavroukakis <yi...@jaguarfreight.com> wrote:
> > Oh no, I mean the exact opposite :)
> >
> >
> > -----------------
> > | Application   |
> > |               |
> > |---------------|
> > |Embedded TC    |
> > -----------------
> >
> > The application I am writing this for is a server daemon which has a cli
> > that enables the user to issue commands to it once it's up and running.
> > What I want, is to use Tomcat to serve a page that will present the user
> > with a friendlier way to issue these commands to the app. Since there is
> > no ready way for embedded Tomcat to "communicate" with the host
> > application that launched it, I assume that the best way is to do this
> > via localhost RMI calls from Tomcat to the host application
> >
> >
> > Y.
> >
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >
> > > Yiannis,
> > >
> > > Yiannis Mavroukakis wrote:
> > > > The scenario is a server daemon that has a cli for runtime
> > > > configuration and status.
> > >
> > > Oh, so you want to be able to reconfigure Tomcat remotely. I assume that
> > > you are talking about more interesting things than can be done with the
> > > Tomcat Manager application.
> > >
> > > > I intend to use embedded tomcat to replace/augment that cli and I
> > > > have actually done so succesfully, using RMI but I was wondering
> > > > whether there was some other solution that allows Tomcat to
> > > > communicate with the application it's embedded into.
> > >
> > > You're reached the limit of my knowledge regarding Tomcat configuration
> > > capabilities. I've never embedded it or another like that.
> > >
> > > - -chris
> > >
> >
> >
> > Note:__________________________________________________________________
> > This message is for the named person's use only. It may contain
> > confidential, proprietary or legally privileged information. No
> > confidentiality or privilege is waived or lost by any mistransmission.
> > If you receive this message in error, please immediately delete it and
> > all copies of it from your system, destroy any hard copies of it and
> > notify the sender. You must not, directly or indirectly, use, disclose,
> > distribute, print, or copy any part of this message if you are not the
> > intended recipient. Jaguar Freight Services and any of its subsidiaries
> > each reserve the right to monitor all e-mail communications through its
> > networks.
> > Any views expressed in this message are those of the individual sender,
> > except where the message states otherwise and the sender is authorized
> > to state them to be the views of any such entity.
> > ________________________________________________________________________
> > This e-mail has been scanned for all known viruses.
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Embedded Tomcat and application communication

Posted by ben short <be...@benshort.co.uk>.
Hi,

I have done something similar, but used Jetty [1] as I couldn't figure
out how to get tomcat to do it..

My application registers a servlet and starts jetty. the servlet gets
the interface to the application via a static method. But it all works
OK. Maybe you could set the application interface into the
ServletConfig somehow and the servlet could grab it in the init
method.

I hope this is of some help.

Ben

ps: sorry to mention jetty on a tomcat list ;)

[1] http://docs.codehaus.org/display/JETTY/Embedding+Jetty



On 1/23/07, Yiannis Mavroukakis <yi...@jaguarfreight.com> wrote:
> Oh no, I mean the exact opposite :)
>
>
> -----------------
> | Application   |
> |               |
> |---------------|
> |Embedded TC    |
> -----------------
>
> The application I am writing this for is a server daemon which has a cli
> that enables the user to issue commands to it once it's up and running.
> What I want, is to use Tomcat to serve a page that will present the user
> with a friendlier way to issue these commands to the app. Since there is
> no ready way for embedded Tomcat to "communicate" with the host
> application that launched it, I assume that the best way is to do this
> via localhost RMI calls from Tomcat to the host application
>
>
> Y.
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Yiannis,
> >
> > Yiannis Mavroukakis wrote:
> > > The scenario is a server daemon that has a cli for runtime
> > > configuration and status.
> >
> > Oh, so you want to be able to reconfigure Tomcat remotely. I assume that
> > you are talking about more interesting things than can be done with the
> > Tomcat Manager application.
> >
> > > I intend to use embedded tomcat to replace/augment that cli and I
> > > have actually done so succesfully, using RMI but I was wondering
> > > whether there was some other solution that allows Tomcat to
> > > communicate with the application it's embedded into.
> >
> > You're reached the limit of my knowledge regarding Tomcat configuration
> > capabilities. I've never embedded it or another like that.
> >
> > - -chris
> >
>
>
> Note:__________________________________________________________________
> This message is for the named person's use only. It may contain
> confidential, proprietary or legally privileged information. No
> confidentiality or privilege is waived or lost by any mistransmission.
> If you receive this message in error, please immediately delete it and
> all copies of it from your system, destroy any hard copies of it and
> notify the sender. You must not, directly or indirectly, use, disclose,
> distribute, print, or copy any part of this message if you are not the
> intended recipient. Jaguar Freight Services and any of its subsidiaries
> each reserve the right to monitor all e-mail communications through its
> networks.
> Any views expressed in this message are those of the individual sender,
> except where the message states otherwise and the sender is authorized
> to state them to be the views of any such entity.
> ________________________________________________________________________
> This e-mail has been scanned for all known viruses.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Embedded Tomcat and application communication

Posted by Yiannis Mavroukakis <yi...@jaguarfreight.com>.
Oh no, I mean the exact opposite :)


-----------------	
| Application	|
|		|
|---------------|
|Embedded TC	|
-----------------

The application I am writing this for is a server daemon which has a cli
that enables the user to issue commands to it once it's up and running.
What I want, is to use Tomcat to serve a page that will present the user
with a friendlier way to issue these commands to the app. Since there is
no ready way for embedded Tomcat to "communicate" with the host
application that launched it, I assume that the best way is to do this
via localhost RMI calls from Tomcat to the host application


Y.

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Yiannis,
> 
> Yiannis Mavroukakis wrote:
> > The scenario is a server daemon that has a cli for runtime 
> > configuration and status.
> 
> Oh, so you want to be able to reconfigure Tomcat remotely. I assume that
> you are talking about more interesting things than can be done with the
> Tomcat Manager application.
> 
> > I intend to use embedded tomcat to replace/augment that cli and I
> > have actually done so succesfully, using RMI but I was wondering
> > whether there was some other solution that allows Tomcat to
> > communicate with the application it's embedded into.
> 
> You're reached the limit of my knowledge regarding Tomcat configuration
> capabilities. I've never embedded it or another like that.
> 
> - -chris
> 


Note:__________________________________________________________________
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient. Jaguar Freight Services and any of its subsidiaries
each reserve the right to monitor all e-mail communications through its
networks.
Any views expressed in this message are those of the individual sender,
except where the message states otherwise and the sender is authorized
to state them to be the views of any such entity.
________________________________________________________________________
This e-mail has been scanned for all known viruses.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Embedded Tomcat and application communication

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yiannis,

Yiannis Mavroukakis wrote:
> The scenario is a server daemon that has a cli for runtime 
> configuration and status.

Oh, so you want to be able to reconfigure Tomcat remotely. I assume that
you are talking about more interesting things than can be done with the
Tomcat Manager application.

> I intend to use embedded tomcat to replace/augment that cli and I
> have actually done so succesfully, using RMI but I was wondering
> whether there was some other solution that allows Tomcat to
> communicate with the application it's embedded into.

You're reached the limit of my knowledge regarding Tomcat configuration
capabilities. I've never embedded it or another like that.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFtO3f9CaO5/Lv0PARAk0ZAKCq5uMhixz7n/sabxrNIFcGgpEqygCgsi+N
opfeJUkBgo+CyRE3DFy8pkI=
=VQUx
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Embedded Tomcat and application communication

Posted by Yiannis Mavroukakis <yi...@jaguarfreight.com>.
Hi Chris,
 
The scenario is a server daemon that has a cli for runtime configuration and status.
I intend to use embedded tomcat to replace/augment that cli and I have actually done
so succesfully, using RMI but I was wondering whether there was some other solution that allows
Tomcat to communicate with the application it's embedded into.
 
Y.

	
	Yiannis Mavroukakis wrote:
	> Hello,
	>
	> I have the following scenario. I wish to integrate tomcat into an
	> existing server application , so that a webapp can send configuration
	> commands and query that application's status . Browsing through the
	> list, the most definitive answer I have seen is to use RMI. Is there
	> another path to accomplish this or is RMI the only solution?
	
	Can you clarify what you are trying to do? It's not clear to me that
	your scenario requires the use of embedded Tomcat.
	
	- -chris
	


Note:__________________________________________________________________
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient. Jaguar Freight Services and any of its subsidiaries
each reserve the right to monitor all e-mail communications through its
networks.
Any views expressed in this message are those of the individual sender,
except where the message states otherwise and the sender is authorized
to state them to be the views of any such entity.
________________________________________________________________________
This e-mail has been scanned for all known viruses.

Re: Embedded Tomcat and application communication

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yiannis,

Yiannis Mavroukakis wrote:
> Hello,
> 
> I have the following scenario. I wish to integrate tomcat into an
> existing server application , so that a webapp can send configuration
> commands and query that application's status . Browsing through the
> list, the most definitive answer I have seen is to use RMI. Is there
> another path to accomplish this or is RMI the only solution?

Can you clarify what you are trying to do? It's not clear to me that
your scenario requires the use of embedded Tomcat.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFs8ne9CaO5/Lv0PARAn13AJ9uzJNt3UaHO5vkZ63J7HHL1qG2wgCfcPDt
c0gQoWZEtdpvAPxlJ45dG3s=
=SwxM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org