You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Chamberlain <ri...@sunsetandlabrea.com> on 2002/09/11 00:27:12 UTC

compiling files in the classes directory

Hello,

Sorry if this is a really dumb question.

Do java files in WEB-INF/classes automatically get compiled?

I just presumed they would because that's the default behavior of resin, 
however I've created a java file and it doesn't appear to be doing so.

If it doesn't is there anyway of getting Tomcat to do that? - or do I 
have to stop being lazy and compile myself?

Thanks in advance,

Richard




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Servlet's loading twice on start-up--DRIVING ME NUTS!

Posted by Jeff Wishnie <je...@deluxebiz.com>.
This is the solution I ended up using--but shouldn't setting <host autoDeploy="false"> keep Tomcat from creating a context for
web-apps in the AppBase?

Is this a bug in 4.1.7 that autoDeploy="false" seems not to effect this behavior?

Thanks,

Jeff

----- Original Message -----
From: "Rui Fernandes" <ru...@entalpia.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, September 11, 2002 2:12 AM
Subject: RE: Servlet's loading twice on start-up--DRIVING ME NUTS!


> I got this problem this is the solution that someone told me.
>
> ----- Original Message -----
> From: Cox, Charlie <cc...@cincom.com>
> To: 'Tomcat Users List' <to...@jakarta.apache.org>
> Sent: Friday, August 30, 2002 3:18 PM
> Subject: RE: Servlet Instances
>
>
> > any webapp whose physical location is a subdirecty of the 'appBase'
> setting
> > in your server.xml(default is 'webapps') will be loaded as a context
> > automatically by tomcat.
> >
> > take this example:
> > you have a context defined in /tomcat/webapps/aaa
> >
> > the default 'appbase' is webapps. So aaa would automatically be loaded by
> > tomcat even if you didn't define a <context> for it in server.xml.
> > this way you can access it as www.myhost.com/aaa
> >
> > now if you defined a <context> such that www.myhost.com/bbb is using the
> > context aaa, then you now have two ways to access your context, each
> loaded
> > separately.
> >
> > to disable the automatic loading, change your appbase to an empty
> > directory(i.e. "/tomcat/webapps/dummy")
> >
> > Charlie
>
> ----- Original Message -----
> From: Peter Lin <tc...@yahoo.com>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Sent: Wednesday, September 11, 2002 4:38 AM
> Subject: Re: Servlet's loading twice on start-up--DRIVING ME NUTS!
>
>
> >
> >
> > I actually wrote a short document describing this docroot configuration
> problem and submitted it to tomcat-dev, but it didn't get any response from
> the developers.  unfortunately, they are all very busy.  I'm willing to
> revise the initial draft I wrote to include this kind of information if one
> of the developers is willing to sign off/speak up for it.
> >
> > peter lin
> >
> >  Jeff Wishnie wrote:I have a very simple Tomcat install with one
> application. The web.xml for
> > the applicaiton loads two servlets on start-up.
> >
> > According to my logs both servlets have their init() methods called
> _twice_.
> >
> > I've looked through the list archives and gone through the mentionned
> causes
> > of this problem and, assuming I understand the issues, have ruled them
> out.
> >
> > 1. The servlets are _not_ throwing exceptions
> >
> > 2. I have only _one_ context defined in server.xml and it is _not_ the
> > default context.
> >
> > I'm going nuts here and would be very grateful for any help folks on the
> > list can provide.
> >
> > Here are the details of my set-up:
> >
> > Tomcat: 4.1.7-LE
> > JDK: 1.4.0_01
> > OS: Redhat 7.2
> >
> > Tomcat layout:
> >
> > One web application in: $TOMCAT_HOME/ROOT/MyApp
> >
> > Here are revelant sections from $TOMCAT_HOME/conf/server.xml:
> >
> > autoDeploy="false">
> > directory="logs" prefix="localhost_log." suffix=".txt"
> > timestamp="true"/>
> > reloadable="false" />
> >
> >
> > [note that "autoDeploy" and "reloadable" are false and that the Context
> > path="/", _not_ ""]
> >
> > Here are relevent sections from $TOMCAT_HOME/ROOT/MyApp/WEB-INF/web,xml:
> >
> >
> > initServlet
> > com.foo.InitServlet
> > 10
> >
> >
> >
> > serviceInit
> > com.foo.ServiceInitServlet
> >
> >
> > endpoint
> >
> >
> > http://foo.com/service/bar?wsdl
> >
> >
> > 20
> >
> >
> > Why is Init getting called TWICE for each servlet??
> >
> > Help!
> >
> > Thanks!
> >
> > - Jeff
> >
> >
> > --
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
> >
> >
> > ---------------------------------
> > Yahoo! - We Remember
> > 9-11: A tribute to the more than 3,000 lives lost
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Servlet's loading twice on start-up--DRIVING ME NUTS!

Posted by Peter Lin <tc...@yahoo.com>.
yeah that is the solution.  I had written a document
describing this issue and how to correctly configure
server.xml.  it was submitted to tomcat-dev, with a
proposal subject, but the developers were to busy.

This kind of documentation really should be included
with Tomcat and a more descriptive comment should also
be included in server.xml itself.

In a perfect world, the developers would have time to
both code and document, but until they have to sleep
too.

I am willing to revise the documentation and clean it
up, if the developers decide including this kind of
documentation is important enough.

peter lin


--- Rui Fernandes <ru...@entalpia.com> wrote:
> I got this problem this is the solution that someone
> told me.
> 
> 

__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Servlet's loading twice on start-up--DRIVING ME NUTS!

Posted by Rui Fernandes <ru...@entalpia.com>.
I got this problem this is the solution that someone told me.

----- Original Message -----
From: Cox, Charlie <cc...@cincom.com>
To: 'Tomcat Users List' <to...@jakarta.apache.org>
Sent: Friday, August 30, 2002 3:18 PM
Subject: RE: Servlet Instances


> any webapp whose physical location is a subdirecty of the 'appBase'
setting
> in your server.xml(default is 'webapps') will be loaded as a context
> automatically by tomcat.
>
> take this example:
> you have a context defined in /tomcat/webapps/aaa
>
> the default 'appbase' is webapps. So aaa would automatically be loaded by
> tomcat even if you didn't define a <context> for it in server.xml.
> this way you can access it as www.myhost.com/aaa
>
> now if you defined a <context> such that www.myhost.com/bbb is using the
> context aaa, then you now have two ways to access your context, each
loaded
> separately.
>
> to disable the automatic loading, change your appbase to an empty
> directory(i.e. "/tomcat/webapps/dummy")
>
> Charlie

----- Original Message -----
From: Peter Lin <tc...@yahoo.com>
To: Tomcat Users List <to...@jakarta.apache.org>
Sent: Wednesday, September 11, 2002 4:38 AM
Subject: Re: Servlet's loading twice on start-up--DRIVING ME NUTS!


>
>
> I actually wrote a short document describing this docroot configuration
problem and submitted it to tomcat-dev, but it didn't get any response from
the developers.  unfortunately, they are all very busy.  I'm willing to
revise the initial draft I wrote to include this kind of information if one
of the developers is willing to sign off/speak up for it.
>
> peter lin
>
>  Jeff Wishnie wrote:I have a very simple Tomcat install with one
application. The web.xml for
> the applicaiton loads two servlets on start-up.
>
> According to my logs both servlets have their init() methods called
_twice_.
>
> I've looked through the list archives and gone through the mentionned
causes
> of this problem and, assuming I understand the issues, have ruled them
out.
>
> 1. The servlets are _not_ throwing exceptions
>
> 2. I have only _one_ context defined in server.xml and it is _not_ the
> default context.
>
> I'm going nuts here and would be very grateful for any help folks on the
> list can provide.
>
> Here are the details of my set-up:
>
> Tomcat: 4.1.7-LE
> JDK: 1.4.0_01
> OS: Redhat 7.2
>
> Tomcat layout:
>
> One web application in: $TOMCAT_HOME/ROOT/MyApp
>
> Here are revelant sections from $TOMCAT_HOME/conf/server.xml:
>
> autoDeploy="false">
> directory="logs" prefix="localhost_log." suffix=".txt"
> timestamp="true"/>
> reloadable="false" />
>
>
> [note that "autoDeploy" and "reloadable" are false and that the Context
> path="/", _not_ ""]
>
> Here are relevent sections from $TOMCAT_HOME/ROOT/MyApp/WEB-INF/web,xml:
>
>
> initServlet
> com.foo.InitServlet
> 10
>
>
>
> serviceInit
> com.foo.ServiceInitServlet
>
>
> endpoint
>
>
> http://foo.com/service/bar?wsdl
>
>
> 20
>
>
> Why is Init getting called TWICE for each servlet??
>
> Help!
>
> Thanks!
>
> - Jeff
>
>
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:
>
>
>
> ---------------------------------
> Yahoo! - We Remember
> 9-11: A tribute to the more than 3,000 lives lost


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Servlet's loading twice on start-up--DRIVING ME NUTS!

Posted by Peter Lin <tc...@yahoo.com>.
 
I actually wrote a short document describing this docroot configuration problem and submitted it to tomcat-dev, but it didn't get any response from the developers.  unfortunately, they are all very busy.  I'm willing to revise the initial draft I wrote to include this kind of information if one of the developers is willing to sign off/speak up for it.
 
peter lin
 
 Jeff Wishnie wrote:I have a very simple Tomcat install with one application. The web.xml for
the applicaiton loads two servlets on start-up.

According to my logs both servlets have their init() methods called _twice_.

I've looked through the list archives and gone through the mentionned causes
of this problem and, assuming I understand the issues, have ruled them out.

1. The servlets are _not_ throwing exceptions

2. I have only _one_ context defined in server.xml and it is _not_ the
default context.

I'm going nuts here and would be very grateful for any help folks on the
list can provide.

Here are the details of my set-up:

Tomcat: 4.1.7-LE
JDK: 1.4.0_01
OS: Redhat 7.2

Tomcat layout:

One web application in: $TOMCAT_HOME/ROOT/MyApp

Here are revelant sections from $TOMCAT_HOME/conf/server.xml:

autoDeploy="false">
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
reloadable="false" />


[note that "autoDeploy" and "reloadable" are false and that the Context
path="/", _not_ ""]

Here are relevent sections from $TOMCAT_HOME/ROOT/MyApp/WEB-INF/web,xml:


initServlet
com.foo.InitServlet
10



serviceInit
com.foo.ServiceInitServlet


endpoint


http://foo.com/service/bar?wsdl


20


Why is Init getting called TWICE for each servlet??

Help!

Thanks!

- Jeff


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 



---------------------------------
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost

RE: Servlet's loading twice on start-up--DRIVING ME NUTS!

Posted by Tim Colson <tc...@cisco.com>.
>According to my logs both servlets have their init() methods called
_twice_.
> 2. I have only _one_ context defined in server.xml and it is _not_ the
default context.

I've seen this happen in our environment too. The explanation seems to
be that the ROOT context and our specified contexts both point to a
directory with a WEB-INF so the web.xml is indeed started up twice.

I simply added a line to server.xml to point the root context at
something innocuous - like the src path:

    <Context path="" docBase="D:\somewhere\without\a\servlet\src"
debug="0" />
    <Context path="/my/funkyapp" docBase="D:\real\servlet\root\path\"
debug="0" />

Works for me. ;-)
Tim


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


How to Configure Contexts? STILL DRIVING ME NUTS!

Posted by Jeff Wishnie <je...@deluxebiz.com>.
Hi All,

Thank you for the responses I received.

>From the responses it's clear to me that I do _not_ understand the mechanism
of how contexts are specified and generated. I've read through the Tomcat
documentation, and gone through the email-list-archives, and am still
confused.

Can someone explain? Once I do understand, I'd be happy to clean it up and
turn it into a FAQ.

Here is what I _think_ I understand:

1. The server.xml file can contain any number of <context> directives
2. It also _must_ contain a context with path="" as the default context
3. In addition, any web-apps that appear in the <Host> directives appBase
will have a context generated for them

Here is what I _don't_ understand:

Q1. Why can't I declare a <Context> with a path (e.g. "/foo") and also use
this app as my default context WITHOUT having it LOADED TWICE? It seems that
if I have two <Context> entries--one with path="/foo" to handle the
"myserver/foo" requests, and another to set it as the default, the App gets
loaded twice.

Q2. What happens when I put an explicit Context entry in server.xml for an
application that sits in my hosts appBase? I do this to explicitly set
parameters like 'path'.

I would expect the explicit Context entry in server.xml to superseed any
generated context, but again, the app seems to get loaded twice.

Q3. In the Tomcat documentation for the <Host> directive, it's mentioned
that you can use .xml files to explicity create Contexts outside of
server.xml. But it isn't clear on where you put these. I quote: "Any XML
file in this directory is assumed to contain a Context element " Ok, but
what is THIS directory? AppBase? Web-application directory? WEB-INF in a
Webapp??

Here is a link to the unclear docs:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html#Automatic%2
0Application%20Deployment

Q4. How do these 4 kinds of Context specifications interact:
    - server.xml entries
    - server.xml default context (not the <defalutContext> directive, the
<context path=""> directive)
    - separate context .xml files
    - auto-generated contexts for web-apps in the AppBase directory

Specifically how can I:
    - Explicitly specify context parameters
    - Satisfy the requirement that there be a default context (path="")
    - NOT have my app loaded multiple times
    ????

Thanks in advance for all your help. As you can tell, I'm getting pretty
frustrated!

- jeff

----- Original Message -----
From: "Michael Petres" <mp...@rogers.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, September 10, 2002 3:56 PM
Subject: RE: Servlet's loading twice on start-up--DRIVING ME NUTS!


> Tomcat will (upon startup) scan the appBase="..." directory (default is
> 'webapps') by default and will load any web applications located there. In
> addition if you have a context defined, it will also load the app again!
>
> Try placing your web application some other place but 'webapps' and make
> sure you specify the absolute path in the docBase of your context tag.
>
> Michael Petres
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> InnovObjX Corp.
> Web: www.innovobjx.com
> Tel: 905-729-2235 x3
> Fax: 905-729-2235
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> -----Original Message-----
> From: Jeff Wishnie [mailto:jeff@deluxebiz.com]
> Sent: Tuesday, September 10, 2002 6:53 PM
> To: Tomcat Users List
> Subject: Servlet's loading twice on start-up--DRIVING ME NUTS!
>
> I have a very simple Tomcat install with one application. The web.xml for
> the applicaiton loads two servlets on start-up.
>
> According to my logs both servlets have their init() methods called
_twice_.
>
> I've looked through the list archives and gone through the mentionned
causes
> of this problem and, assuming I understand the issues, have ruled them
out.
>
> 1. The servlets are _not_ throwing exceptions
>
> 2. I have only _one_ context defined in server.xml and it is _not_ the
> default context.
>
> I'm going nuts here and would be very grateful for any help folks on the
> list can provide.
>
> Here are the details of my set-up:
>
> Tomcat: 4.1.7-LE
> JDK: 1.4.0_01
> OS: Redhat 7.2
>
> Tomcat layout:
>
> One web application in: $TOMCAT_HOME/ROOT/MyApp
>
> Here are revelant sections from $TOMCAT_HOME/conf/server.xml:
>
>   <Host name="localhost" debug="0" appBase="ROOT" unpackWARs="true"
> autoDeploy="false">
>         <Logger className="org.apache.catalina.logger.FileLogger"
>                  directory="logs"  prefix="localhost_log." suffix=".txt"
>                 timestamp="true"/>
>         <Context path="/" docBase="DeluxeCal" debug="0"
crossContext="false"
> reloadable="false" />
>   </Host>
>
> [note that "autoDeploy" and "reloadable" are false and that the Context
> path="/", _not_ ""]
>
> Here are relevent sections from  $TOMCAT_HOME/ROOT/MyApp/WEB-INF/web,xml:
>
>  <servlet>
>         <servlet-name>initServlet</servlet-name>
>         <servlet-class>com.foo.InitServlet</servlet-class>
>         <load-on-startup>10</load-on-startup>
>     </servlet>
>
>     <servlet>
>         <servlet-name>serviceInit</servlet-name>
>         <servlet-class>com.foo.ServiceInitServlet</servlet-class>
>         <init-param>
>             <param-name>endpoint</param-name>
>             <param-value>http://foo.com/service/bar?wsdl</param-value>
>         </init-param>
>         <load-on-startup>20</load-on-startup>
>     </servlet>
>
> Why is Init getting called TWICE for each servlet??
>
> Help!
>
> Thanks!
>
> - Jeff
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Servlet's loading twice on start-up--DRIVING ME NUTS!

Posted by Michael Petres <mp...@rogers.com>.
Tomcat will (upon startup) scan the appBase="..." directory (default is
'webapps') by default and will load any web applications located there. In
addition if you have a context defined, it will also load the app again!

Try placing your web application some other place but 'webapps' and make
sure you specify the absolute path in the docBase of your context tag.

Michael Petres
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InnovObjX Corp.
Web: www.innovobjx.com
Tel: 905-729-2235 x3
Fax: 905-729-2235
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----Original Message-----
From: Jeff Wishnie [mailto:jeff@deluxebiz.com]
Sent: Tuesday, September 10, 2002 6:53 PM
To: Tomcat Users List
Subject: Servlet's loading twice on start-up--DRIVING ME NUTS!

I have a very simple Tomcat install with one application. The web.xml for
the applicaiton loads two servlets on start-up.

According to my logs both servlets have their init() methods called _twice_.

I've looked through the list archives and gone through the mentionned causes
of this problem and, assuming I understand the issues, have ruled them out.

1. The servlets are _not_ throwing exceptions

2. I have only _one_ context defined in server.xml and it is _not_ the
default context.

I'm going nuts here and would be very grateful for any help folks on the
list can provide.

Here are the details of my set-up:

Tomcat: 4.1.7-LE
JDK: 1.4.0_01
OS: Redhat 7.2

Tomcat layout:

One web application in: $TOMCAT_HOME/ROOT/MyApp

Here are revelant sections from $TOMCAT_HOME/conf/server.xml:

  <Host name="localhost" debug="0" appBase="ROOT" unpackWARs="true"
autoDeploy="false">
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
                timestamp="true"/>
        <Context path="/" docBase="DeluxeCal" debug="0" crossContext="false"
reloadable="false" />
  </Host>

[note that "autoDeploy" and "reloadable" are false and that the Context
path="/", _not_ ""]

Here are relevent sections from  $TOMCAT_HOME/ROOT/MyApp/WEB-INF/web,xml:

 <servlet>
        <servlet-name>initServlet</servlet-name>
        <servlet-class>com.foo.InitServlet</servlet-class>
        <load-on-startup>10</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>serviceInit</servlet-name>
        <servlet-class>com.foo.ServiceInitServlet</servlet-class>
        <init-param>
            <param-name>endpoint</param-name>
            <param-value>http://foo.com/service/bar?wsdl</param-value>
        </init-param>
        <load-on-startup>20</load-on-startup>
    </servlet>

Why is Init getting called TWICE for each servlet??

Help!

Thanks!

- Jeff


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Servlet's loading twice on start-up--DRIVING ME NUTS!

Posted by Jeff Wishnie <je...@deluxebiz.com>.
I have a very simple Tomcat install with one application. The web.xml for
the applicaiton loads two servlets on start-up.

According to my logs both servlets have their init() methods called _twice_.

I've looked through the list archives and gone through the mentionned causes
of this problem and, assuming I understand the issues, have ruled them out.

1. The servlets are _not_ throwing exceptions

2. I have only _one_ context defined in server.xml and it is _not_ the
default context.

I'm going nuts here and would be very grateful for any help folks on the
list can provide.

Here are the details of my set-up:

Tomcat: 4.1.7-LE
JDK: 1.4.0_01
OS: Redhat 7.2

Tomcat layout:

One web application in: $TOMCAT_HOME/ROOT/MyApp

Here are revelant sections from $TOMCAT_HOME/conf/server.xml:

  <Host name="localhost" debug="0" appBase="ROOT" unpackWARs="true"
autoDeploy="false">
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
                timestamp="true"/>
        <Context path="/" docBase="DeluxeCal" debug="0" crossContext="false"
reloadable="false" />
  </Host>

[note that "autoDeploy" and "reloadable" are false and that the Context
path="/", _not_ ""]

Here are relevent sections from  $TOMCAT_HOME/ROOT/MyApp/WEB-INF/web,xml:

 <servlet>
        <servlet-name>initServlet</servlet-name>
        <servlet-class>com.foo.InitServlet</servlet-class>
        <load-on-startup>10</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>serviceInit</servlet-name>
        <servlet-class>com.foo.ServiceInitServlet</servlet-class>
        <init-param>
            <param-name>endpoint</param-name>
            <param-value>http://foo.com/service/bar?wsdl</param-value>
        </init-param>
        <load-on-startup>20</load-on-startup>
    </servlet>

Why is Init getting called TWICE for each servlet??

Help!

Thanks!

- Jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>