You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by nlif <na...@dbnet.co.il> on 2007/08/29 09:05:37 UTC

Interacting with an embedded Tomcat

Hi,

If I run Tomcat as embedded, is it possible for the application that
contains Tomcat to interact with web-apps that run inside that Tomcat? For
example, the external application, in addition to starting the embedded
Tomcat, also manages other services, and the web-apps that runs inside the
embedded Tomcat need to use those services. How can this be done?

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12381880
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Interacting with an embedded Tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: OFFICIAL WEBSITE [mailto:director@technocomsys.com] 
> Subject: Re: Interacting with an embedded Tomcat
> 
> How do you intend to start Tomcat on the same JVM as your bootstrap
> application?

This is an EMBEDDED, not standalone, Tomcat.  (Google if you don't know
what that means.)  Please stop confusing the issue.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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: Interacting with an embedded Tomcat

Posted by OFFICIAL WEBSITE <di...@technocomsys.com>.
How do you intend to start Tomcat on the same JVM as your bootstrap
application? Bypass ALL of tomcat facilities and scripts and take direct
control, instantiating Tomcat classes by name from its libraries!!
Embedded through API Interfaces! Wow! What is the advantage gained?

I would leave tomcat stricly alone, configure its server and web
configuration files,; start, stop and control through Runtime commands
from the bootstrap application. Communicate through sockets.



On Wed, 2007-08-29 at 01:39 -0700, nlif wrote:
> Hmm, I guess I did not explain myself very well...
> 
> I have an application, that acts as bootstrap: it creates and initializes
> various services, which provide a Java API to resources such as database,
> file-system, and native libraries. In addition, I want that bootstrap
> application to start an embedded tomcat, in which my web application will
> run. Thus, *everything* is in the same process. The question was, how can I
> pass Java references from the bootstrap application to the web-apps in side
> the embedded Tomcat. 
> 
> I hope this makes it clear.
> 
> I assume the Tomcat embedded APIs provide some way to pass a reference into
> the web-app contexts that are deployed in that Tomcat. I've never worked
> with Tomcat as embedded, and frankly, I can't seem to find documentation or
> code-samples for it. If anyone can point me to anything, I'd appreciate it.
> 
> Thanks again.
> 
> 
> 
> 
> 
> OFFICIAL WEBSITE wrote:
> > 
> > If I understand correctly, external applications were started on one JVM
> > and the tomcat is on another JVM, started separately or by the external
> > application itself.
> > 
> > Two JVMS running on on machine have nothing in common other than system
> > resources. Open a serversocket at a named port on the external
> > application and let the tomcat applications from webapps connect to it
> > and exchange sweet talk on a mutually agreed protocol.
> > 
> > 
> > On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
> >> Hi,
> >> 
> >> If I run Tomcat as embedded, is it possible for the application that
> >> contains Tomcat to interact with web-apps that run inside that Tomcat?
> >> For
> >> example, the external application, in addition to starting the embedded
> >> Tomcat, also manages other services, and the web-apps that runs inside
> >> the
> >> embedded Tomcat need to use those services. How can this be done?
> >> 
> >> Thanks in advance.
> > 
> > 
> > ---------------------------------------------------------------------
> > 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: Interacting with an embedded Tomcat

Posted by Sonal Goyal <so...@gmail.com>.
Hi,

Are you also facing issues in starting up tomcat in embedded mode? Here are
some links that help:

http://www.vsj.co.uk/articles/display.asp?id=319
http://www.onjava.com/pub/a/onjava/2002/04/03/tomcat.html

Regards,
Sonal

On 8/29/07, Sonal Goyal <so...@gmail.com> wrote:
>
> Hi,
>
> I am assuming you are calling createContext() on the
> org.apache.catalina.startup.Embedded object. Do you think calling
> org.apache.catalina.Context.getServletContext() and then setAttribute on
> the returned ServletContext will help?
>
> Just a thought. Do let me know if it makes sense.
>
> Sonal
>
>
>
> On 8/29/07, nlif <naaman@dbnet.co.il > wrote:
> >
> >
> > Hmm, I guess I did not explain myself very well...
> >
> > I have an application, that acts as bootstrap: it creates and
> > initializes
> > various services, which provide a Java API to resources such as
> > database,
> > file-system, and native libraries. In addition, I want that bootstrap
> > application to start an embedded tomcat, in which my web application
> > will
> > run. Thus, *everything* is in the same process. The question was, how
> > can I
> > pass Java references from the bootstrap application to the web-apps in
> > side
> > the embedded Tomcat.
> >
> > I hope this makes it clear.
> >
> > I assume the Tomcat embedded APIs provide some way to pass a reference
> > into
> > the web-app contexts that are deployed in that Tomcat. I've never worked
> > with Tomcat as embedded, and frankly, I can't seem to find documentation
> > or
> > code-samples for it. If anyone can point me to anything, I'd appreciate
> > it.
> >
> > Thanks again.
> >
> >
> >
> >
> >
> > OFFICIAL WEBSITE wrote:
> > >
> > > If I understand correctly, external applications were started on one
> > JVM
> > > and the tomcat is on another JVM, started separately or by the
> > external
> > > application itself.
> > >
> > > Two JVMS running on on machine have nothing in common other than
> > system
> > > resources. Open a serversocket at a named port on the external
> > > application and let the tomcat applications from webapps connect to it
> > > and exchange sweet talk on a mutually agreed protocol.
> > >
> > >
> > > On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
> > >> Hi,
> > >>
> > >> If I run Tomcat as embedded, is it possible for the application that
> > >> contains Tomcat to interact with web-apps that run inside that
> > Tomcat?
> > >> For
> > >> example, the external application, in addition to starting the
> > embedded
> > >> Tomcat, also manages other services, and the web-apps that runs
> > inside
> > >> the
> > >> embedded Tomcat need to use those services. How can this be done?
> > >>
> > >> Thanks in advance.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > >
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12382936
> >
> > Sent from the Tomcat - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
>
> --
> Thanks and Regards,
> Sonal




-- 
Thanks and Regards,
Sonal

Re: Interacting with an embedded Tomcat

Posted by nlif <na...@dbnet.co.il>.
Thanks very much. Maybe that's the way. I'll give it a try.

Naaman




Sonal Goyal wrote:
> 
> Hi,
> 
> I am assuming you are calling createContext() on the
> org.apache.catalina.startup.Embedded object. Do you think calling
> org.apache.catalina.Context.getServletContext() and then setAttribute on
> the
> returned ServletContext will help?
> 
> Just a thought. Do let me know if it makes sense.
> 
> Sonal
> 
> 
> 
> On 8/29/07, nlif <na...@dbnet.co.il> wrote:
>>
>>
>> Hmm, I guess I did not explain myself very well...
>>
>> I have an application, that acts as bootstrap: it creates and initializes
>> various services, which provide a Java API to resources such as database,
>> file-system, and native libraries. In addition, I want that bootstrap
>> application to start an embedded tomcat, in which my web application will
>> run. Thus, *everything* is in the same process. The question was, how can
>> I
>> pass Java references from the bootstrap application to the web-apps in
>> side
>> the embedded Tomcat.
>>
>> I hope this makes it clear.
>>
>> I assume the Tomcat embedded APIs provide some way to pass a reference
>> into
>> the web-app contexts that are deployed in that Tomcat. I've never worked
>> with Tomcat as embedded, and frankly, I can't seem to find documentation
>> or
>> code-samples for it. If anyone can point me to anything, I'd appreciate
>> it.
>>
>> Thanks again.
>>
>>
>>
>>
>>
>> OFFICIAL WEBSITE wrote:
>> >
>> > If I understand correctly, external applications were started on one
>> JVM
>> > and the tomcat is on another JVM, started separately or by the external
>> > application itself.
>> >
>> > Two JVMS running on on machine have nothing in common other than system
>> > resources. Open a serversocket at a named port on the external
>> > application and let the tomcat applications from webapps connect to it
>> > and exchange sweet talk on a mutually agreed protocol.
>> >
>> >
>> > On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
>> >> Hi,
>> >>
>> >> If I run Tomcat as embedded, is it possible for the application that
>> >> contains Tomcat to interact with web-apps that run inside that Tomcat?
>> >> For
>> >> example, the external application, in addition to starting the
>> embedded
>> >> Tomcat, also manages other services, and the web-apps that runs inside
>> >> the
>> >> embedded Tomcat need to use those services. How can this be done?
>> >>
>> >> Thanks in advance.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12382936
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 
> 
> -- 
> Thanks and Regards,
> Sonal
> 
> 

-- 
View this message in context: http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12387467
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Interacting with an embedded Tomcat

Posted by Sonal Goyal <so...@gmail.com>.
Hi,

I am assuming you are calling createContext() on the
org.apache.catalina.startup.Embedded object. Do you think calling
org.apache.catalina.Context.getServletContext() and then setAttribute on the
returned ServletContext will help?

Just a thought. Do let me know if it makes sense.

Sonal



On 8/29/07, nlif <na...@dbnet.co.il> wrote:
>
>
> Hmm, I guess I did not explain myself very well...
>
> I have an application, that acts as bootstrap: it creates and initializes
> various services, which provide a Java API to resources such as database,
> file-system, and native libraries. In addition, I want that bootstrap
> application to start an embedded tomcat, in which my web application will
> run. Thus, *everything* is in the same process. The question was, how can
> I
> pass Java references from the bootstrap application to the web-apps in
> side
> the embedded Tomcat.
>
> I hope this makes it clear.
>
> I assume the Tomcat embedded APIs provide some way to pass a reference
> into
> the web-app contexts that are deployed in that Tomcat. I've never worked
> with Tomcat as embedded, and frankly, I can't seem to find documentation
> or
> code-samples for it. If anyone can point me to anything, I'd appreciate
> it.
>
> Thanks again.
>
>
>
>
>
> OFFICIAL WEBSITE wrote:
> >
> > If I understand correctly, external applications were started on one JVM
> > and the tomcat is on another JVM, started separately or by the external
> > application itself.
> >
> > Two JVMS running on on machine have nothing in common other than system
> > resources. Open a serversocket at a named port on the external
> > application and let the tomcat applications from webapps connect to it
> > and exchange sweet talk on a mutually agreed protocol.
> >
> >
> > On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
> >> Hi,
> >>
> >> If I run Tomcat as embedded, is it possible for the application that
> >> contains Tomcat to interact with web-apps that run inside that Tomcat?
> >> For
> >> example, the external application, in addition to starting the embedded
> >> Tomcat, also manages other services, and the web-apps that runs inside
> >> the
> >> embedded Tomcat need to use those services. How can this be done?
> >>
> >> Thanks in advance.
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12382936
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Thanks and Regards,
Sonal

Re: Interacting with an embedded Tomcat

Posted by nlif <na...@dbnet.co.il>.
Hmm, I guess I did not explain myself very well...

I have an application, that acts as bootstrap: it creates and initializes
various services, which provide a Java API to resources such as database,
file-system, and native libraries. In addition, I want that bootstrap
application to start an embedded tomcat, in which my web application will
run. Thus, *everything* is in the same process. The question was, how can I
pass Java references from the bootstrap application to the web-apps in side
the embedded Tomcat. 

I hope this makes it clear.

I assume the Tomcat embedded APIs provide some way to pass a reference into
the web-app contexts that are deployed in that Tomcat. I've never worked
with Tomcat as embedded, and frankly, I can't seem to find documentation or
code-samples for it. If anyone can point me to anything, I'd appreciate it.

Thanks again.





OFFICIAL WEBSITE wrote:
> 
> If I understand correctly, external applications were started on one JVM
> and the tomcat is on another JVM, started separately or by the external
> application itself.
> 
> Two JVMS running on on machine have nothing in common other than system
> resources. Open a serversocket at a named port on the external
> application and let the tomcat applications from webapps connect to it
> and exchange sweet talk on a mutually agreed protocol.
> 
> 
> On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
>> Hi,
>> 
>> If I run Tomcat as embedded, is it possible for the application that
>> contains Tomcat to interact with web-apps that run inside that Tomcat?
>> For
>> example, the external application, in addition to starting the embedded
>> Tomcat, also manages other services, and the web-apps that runs inside
>> the
>> embedded Tomcat need to use those services. How can this be done?
>> 
>> Thanks in advance.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12382936
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Interacting with an embedded Tomcat

Posted by OFFICIAL WEBSITE <di...@technocomsys.com>.
If I understand correctly, external applications were started on one JVM
and the tomcat is on another JVM, started separately or by the external
application itself.

Two JVMS running on on machine have nothing in common other than system
resources. Open a serversocket at a named port on the external
application and let the tomcat applications from webapps connect to it
and exchange sweet talk on a mutually agreed protocol.


On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
> Hi,
> 
> If I run Tomcat as embedded, is it possible for the application that
> contains Tomcat to interact with web-apps that run inside that Tomcat? For
> example, the external application, in addition to starting the embedded
> Tomcat, also manages other services, and the web-apps that runs inside the
> embedded Tomcat need to use those services. How can this be done?
> 
> Thanks in advance.


---------------------------------------------------------------------
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: Interacting with an embedded Tomcat

Posted by Sonal Goyal <so...@gmail.com>.
Hi,

Can you please elaborate what kind of external services your embedded tomcat
webapps would need to access. What kind of interfaces exist for those
services. Do they run in the same process?

Regards,
Sonal

On 8/29/07, nlif <na...@dbnet.co.il> wrote:
>
>
> Hi,
>
> If I run Tomcat as embedded, is it possible for the application that
> contains Tomcat to interact with web-apps that run inside that Tomcat? For
> example, the external application, in addition to starting the embedded
> Tomcat, also manages other services, and the web-apps that runs inside the
> embedded Tomcat need to use those services. How can this be done?
>
> Thanks in advance.
> --
> View this message in context:
> http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12381880
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Thanks and Regards,
Sonal