tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sriram N <sriramx_2...@yahoo.com>
Subject RE: Embedding Tomcat with Java App and JRE only
Date Thu, 19 Jun 2003 13:56:05 GMT
This is indeed the ight place.

But please check the mail archives first. I'd had to Embed Tomcat way back in
Dec 2001 - Jan 2002, and had faced lots of problems then, with not a single
question of mine being answered. However, I'd posted some of my lessons learnt
at around that time.

I've replied to some other posts on Embedding Tomcat over the past months, you
should get these on the mail archives too.

I'm not at all aware of changes in Tomcat 4.1.x, but here are some of the
problems that I'd faced:

1. Embedding Tomcat itself.
Browse the source, trace how Bootstrap and Embedded work, and you'll learn that
"tomcat", is actually Catalina for Servlets, Jasper for JSPs, Connectors for
HTTP services, etc. I first figured how the Digestion works (where server.xml
is used to assemble together the Engine, the host, the contexts, etc), and then
wrote something myself on the lines of Embedded.

You need to understand just how Embedded works, and you'll have a working
ServletContainer running.

2. Accessing LifeCycle events
With 4.0.1, the LifeCycle Interface has just the "starting" and "stopping"
events. I think 4.1.x now has "starting", "started", "stopping" and "stopped" 
(or something along those lines). Since I did not dare to alter the LifeCycle
Interface myself (break compatibility with the Tomcat Developers, etc), I had
to resort to a check after the entire server came up.

3. Getting Jasper to work right.
I had to start my app via an executable Jar, and this changed the classpath.
(Remember, I was not using the startup scripts). I chose to alter the
java.class.path environment variable myself before starting to assemble the
Catalina components together. If you're loading via a Jar too, then you'll need
to use the JarFile API, access the manifest, used the Classpath attribute from
the manifest, and assemble together a classpath again. (NOTE: 4.0.1 uses the
javac compiler. 4.1.x uses Ant, so I have no idea on what to expect here.)

I used the Visual Age for Java IDE then, so that helped a lot (The scrap book
was the best aid I had). I think Eclipse gives you similar functionality, so
you could perhaps experiment with snippets of code yourself.

A lot has changed since 4.0.1. Browse the source, read the Javadocs, and you
should have a good understanding in about a week's time.

There was also a post recently of someone writing a book on "How Tomcat works",
you might want to give those PDF chapters a try.

Like Yoav Shapira says, go ahead and ask questions, some one will surely
answer.

-- Sriram
Developer,
Object Edge Software India Pvt. Ltd.

--- "Shapira, Yoav" <Yoav.Shapira@mpi.com> wrote:
> 
> Howdy,
> This is the right place.  Ask specific questions, post relevant
> materials (source code, stack traces, etc.), and most times you will get
> a good answer or two.  Just like you did with your previous question.
> 
> Yoav Shapira
> Millennium ChemInformatics
> 
> 
> >-----Original Message-----
> >From: Lee Peik Feng [mailto:pflee@syabas.com]
> >Sent: Monday, June 16, 2003 11:31 AM
> >To: Tomcat Users List
> >Subject: Re: Embedding Tomcat with Java App and JRE only
> >
> >Yes, it is very difficult to get help on Embedding Tomcat in Java App.
> >Does someone know where can I get more help on EmbeddedTomcat?
> >
> >
> >
> >----- Original Message -----
> >From: "Shapira, Yoav" <Yoav.Shapira@mpi.com>
> >To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> >Sent: Monday, June 16, 2003 9:28 PM
> >Subject: RE: Embedding Tomcat with Java App and JRE only
> >
> >
> >>
> >> Howdy,
> >> Yes with two big BUTs:
> >>
> >> 1. You will no longer have the tomcat stated requirements, i.e. you
> will
> >> not have a standard usage of embedded tomcat, making it harder for
> you
> >> to receive accurate support for your questions.
> >>
> >> 2. You will of course lose the ability to deploy new JSPs to your app
> ;)
> >> That may not matter for your specification application though.
> >>
> >> Yoav Shapira
> >> Millennium ChemInformatics
> >>
> >>
> >> >-----Original Message-----
> >> >From: Lee Peik Feng [mailto:pflee@syabas.com]
> >> >Sent: Sunday, June 15, 2003 10:17 PM
> >> >To: Tomcat Users List
> >> >Subject: Re: Embedding Tomcat with Java App and JRE only
> >> >
> >> >Yes
> >> >
> >> >
> >> >----- Original Message -----
> >> >From: "Kwok Ng" <kwokng@earthlink.net>
> >> >To: <tomcat-user@jakarta.apache.org>
> >> >Sent: Monday, June 16, 2003 8:16 AM
> >> >Subject: Embedding Tomcat with Java App and JRE only
> >> >
> >> >
> >> >> Hi folks,
> >> >>
> >> >> I have read a article that explains how to embed the Tomcat with
> java
> >> app
> >> >in O'Reily website.  I will try to do it for my java app.   But I
> want
> >> to
> >> >do
> >> >one step further which use JRE instead of JDK.  Does anybody know if
> I
> >> >pre-compile all jsp files, is it possible to embed the Tomcat with
> JRE
> >> >only?
> >> >>
> >> >> Thanks!
> >> >>
> >> >> Billy Ng
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> >> >
> >> >
> >> >
> >>
> >---------------------------------------------------------------------
> >> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >> This e-mail, including any attachments, is a confidential business
> >communication, and may contain information that is confidential,
> >proprietary
> >and/or privileged.  This e-mail is intended only for the individual(s)
> to
> >whom it is addressed, and may not be saved, copied, printed, disclosed
> or
> >used by anyone else.  If you are not the(an) intended recipient, please
> >immediately delete this e-mail from your computer system and notify the
> >sender.  Thank you.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> This e-mail, including any attachments, is a confidential business
> communication, and may contain information that is confidential, proprietary
> and/or privileged.  This e-mail is intended only for the individual(s) to
> whom it is addressed, and may not be saved, copied, printed, disclosed or
> used by anyone else.  If you are not the(an) intended recipient, please
> immediately delete this e-mail from your computer system and notify the
> sender.  Thank you.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Mime
View raw message