You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Xtremebytes Webmaster <we...@xtremebytes.com> on 2003/09/16 16:11:42 UTC

Tomcat within custom application

Hi,

I am wondering how I can run the Tomcat JSP/Servlet container within another process, which is not a HTTP server but a custom Java application. This is to mean that I have some JSP or Servlets for example. I need to run them on a client machine (Windows NT/UNIX platform), which doesn't have a web server or the standalone Tomcat container installed. I do not want to install that either. I just want to launch the Tomcat container as one thread within one custom Java application while some other threads will do other unrelated work. The purpose is to deploy the Servlets or JSP making the Tomcat container transparent to the client.

Thanks in advance.

Xtremebytes Webmaster

Re: Tomcat within custom application

Posted by Henri Gomez <hg...@apache.org>.
Xtremebytes Webmaster a écrit :

> Hi,
> 
> I am wondering how I can run the Tomcat JSP/Servlet container within another process, which is not a HTTP server but a custom Java application. This is to mean that I have some JSP or Servlets for example. I need to run them on a client machine (Windows NT/UNIX platform), which doesn't have a web server or the standalone Tomcat container installed. I do not want to install that either. I just want to launch the Tomcat container as one thread within one custom Java application while some other threads will do other unrelated work. The purpose is to deploy the Servlets or JSP making the Tomcat container transparent to the client.


Do you want tomcat handle some HTTP requests ?




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Tomcat within custom application

Posted by Henri Gomez <hg...@apache.org>.
Xtremebytes Webmaster a écrit :

> Hi,
> 
> I am wondering how I can run the Tomcat JSP/Servlet container within another process, which is not a HTTP server but a custom Java application. This is to mean that I have some JSP or Servlets for example. I need to run them on a client machine (Windows NT/UNIX platform), which doesn't have a web server or the standalone Tomcat container installed. I do not want to install that either. I just want to launch the Tomcat container as one thread within one custom Java application while some other threads will do other unrelated work. The purpose is to deploy the Servlets or JSP making the Tomcat container transparent to the client.


Do you want tomcat handle some HTTP requests ?




Re: Tomcat within custom application

Posted by Xtremebytes Webmaster <we...@xtremebytes.com>.
Thanks Remy. I have managed to run the embedded Tomcat 4x. However, I still
have a bit of a problem with context configuration. Suppose I install a WAR
directory containing a XSLT servlet. The output from this XSLT servlet is
XHTML, which contains relative references to images and CSS files. If I
place all these relative reference files (in a proper directory structure)
in the root directory of the WAR, these are inaccessible. I cannot place
them in a different directory and get it from there either. Looks like there
is a problem with the contexts configuration.

Suppose my servlet is called as
http://localhost:8182/xsltservlet/xslTransform?xml=xmlfile.xml&xsl=xslfile.xsl
then any reference like http://localhost:8182/xsltservlet/images/myimage.gif
is not available even if it is in the directory path. It does not also let
me browse the virtual directory http://localhost:8182/xsltservlet/. How do I
go about solving this problem?

Thanks again.

----- Original Message ----- 
From: Remy Maucherat
To: Tomcat Developers List
Sent: Tuesday, September 16, 2003 3:23 PM
Subject: Re: Tomcat within custom application


Xtremebytes Webmaster wrote:
> I am wondering how I can run the Tomcat JSP/Servlet container within
> another process, which is not a HTTP server but a custom Java
> application. This is to mean that I have some JSP or Servlets for
> example. I need to run them on a client machine (Windows NT/UNIX
> platform), which doesn't have a web server or the standalone Tomcat
> container installed. I do not want to install that either. I just
> want to launch the Tomcat container as one thread within one custom
> Java application while some other threads will do other unrelated
> work. The purpose is to deploy the Servlets or JSP making the Tomcat
> container transparent to the client.

You can look at the Tomcat 5 embedded distribution (basically, you get
an Ant script replacing server.xml). The included example Ant script
just makes some basic JMX calls to create an embedded Tomcat, so you
don't have to use Ant (but, for an example, it's obviously easier to
understand and more readable) or have any dependencies on the Tomcat APIs.

The old Tomcat 4.x Embedded class is also supported (except it has been
rewritten to use the standard behavior rather than being a special case).

I believe some real docs on embedding would be useful, including:
- embedding Coyote
- embedding Tomcat using Embedded
- embedding Tomcat with JMX

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Tomcat within custom application

Posted by Xtremebytes Webmaster <we...@xtremebytes.com>.
Thanks Remy. I have managed to run the embedded Tomcat 4x. However, I still
have a bit of a problem with context configuration. Suppose I install a WAR
directory containing a XSLT servlet. The output from this XSLT servlet is
XHTML, which contains relative references to images and CSS files. If I
place all these relative reference files (in a proper directory structure)
in the root directory of the WAR, these are inaccessible. I cannot place
them in a different directory and get it from there either. Looks like there
is a problem with the contexts configuration.

Suppose my servlet is called as
http://localhost:8182/xsltservlet/xslTransform?xml=xmlfile.xml&xsl=xslfile.xsl
then any reference like http://localhost:8182/xsltservlet/images/myimage.gif
is not available even if it is in the directory path. It does not also let
me browse the virtual directory http://localhost:8182/xsltservlet/. How do I
go about solving this problem?

Thanks again.

----- Original Message ----- 
From: Remy Maucherat
To: Tomcat Developers List
Sent: Tuesday, September 16, 2003 3:23 PM
Subject: Re: Tomcat within custom application


Xtremebytes Webmaster wrote:
> I am wondering how I can run the Tomcat JSP/Servlet container within
> another process, which is not a HTTP server but a custom Java
> application. This is to mean that I have some JSP or Servlets for
> example. I need to run them on a client machine (Windows NT/UNIX
> platform), which doesn't have a web server or the standalone Tomcat
> container installed. I do not want to install that either. I just
> want to launch the Tomcat container as one thread within one custom
> Java application while some other threads will do other unrelated
> work. The purpose is to deploy the Servlets or JSP making the Tomcat
> container transparent to the client.

You can look at the Tomcat 5 embedded distribution (basically, you get
an Ant script replacing server.xml). The included example Ant script
just makes some basic JMX calls to create an embedded Tomcat, so you
don't have to use Ant (but, for an example, it's obviously easier to
understand and more readable) or have any dependencies on the Tomcat APIs.

The old Tomcat 4.x Embedded class is also supported (except it has been
rewritten to use the standard behavior rather than being a special case).

I believe some real docs on embedding would be useful, including:
- embedding Coyote
- embedding Tomcat using Embedded
- embedding Tomcat with JMX

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org



Re: Tomcat within custom application

Posted by Remy Maucherat <re...@apache.org>.
Xtremebytes Webmaster wrote:
> I am wondering how I can run the Tomcat JSP/Servlet container within
> another process, which is not a HTTP server but a custom Java
> application. This is to mean that I have some JSP or Servlets for
> example. I need to run them on a client machine (Windows NT/UNIX
> platform), which doesn't have a web server or the standalone Tomcat
> container installed. I do not want to install that either. I just
> want to launch the Tomcat container as one thread within one custom
> Java application while some other threads will do other unrelated
> work. The purpose is to deploy the Servlets or JSP making the Tomcat
> container transparent to the client.

You can look at the Tomcat 5 embedded distribution (basically, you get 
an Ant script replacing server.xml). The included example Ant script 
just makes some basic JMX calls to create an embedded Tomcat, so you 
don't have to use Ant (but, for an example, it's obviously easier to 
understand and more readable) or have any dependencies on the Tomcat APIs.

The old Tomcat 4.x Embedded class is also supported (except it has been 
rewritten to use the standard behavior rather than being a special case).

I believe some real docs on embedding would be useful, including:
- embedding Coyote
- embedding Tomcat using Embedded
- embedding Tomcat with JMX

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Tomcat within custom application

Posted by Remy Maucherat <re...@apache.org>.
Xtremebytes Webmaster wrote:
> I am wondering how I can run the Tomcat JSP/Servlet container within
> another process, which is not a HTTP server but a custom Java
> application. This is to mean that I have some JSP or Servlets for
> example. I need to run them on a client machine (Windows NT/UNIX
> platform), which doesn't have a web server or the standalone Tomcat
> container installed. I do not want to install that either. I just
> want to launch the Tomcat container as one thread within one custom
> Java application while some other threads will do other unrelated
> work. The purpose is to deploy the Servlets or JSP making the Tomcat
> container transparent to the client.

You can look at the Tomcat 5 embedded distribution (basically, you get 
an Ant script replacing server.xml). The included example Ant script 
just makes some basic JMX calls to create an embedded Tomcat, so you 
don't have to use Ant (but, for an example, it's obviously easier to 
understand and more readable) or have any dependencies on the Tomcat APIs.

The old Tomcat 4.x Embedded class is also supported (except it has been 
rewritten to use the standard behavior rather than being a special case).

I believe some real docs on embedding would be useful, including:
- embedding Coyote
- embedding Tomcat using Embedded
- embedding Tomcat with JMX

Remy