You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jo...@fwd.at on 2003/03/28 10:40:38 UTC

Tomcat server.xml context-specific configuration

Hi there,

Since I got no replies to any of my inquiries regarding the use of 
context-specific information in server.xml, it seems as if nobody else 
uses this configuration property?

What is the recommended place to put context-specific parameters into?
e.g.
<Context crossContext="true" debug="0" docBase="myapp" path="/myapp" 
reloadable="true">
                <Logger className="org.apache.catalina.logger.FileLogger" 
prefix="wartung_log." suffix=".txt" timestamp="true"/>
        <ResourceLink name="jdbc/mydb" global="MyDatabase"/>
        <Parameter name="myparam" override="false" value="xxx"/>
</Context>

Should I 
*) put it into server.xml (as is done with the examples demo-context) with 
the disadvantage of having to restart Tomcat if changes occur.
*) put it into webapps/myapp.xml (with the same disadvantage as above)
*) put it into web.xml as servlet-specific configuration?
Or can I also store context-specific info in web.xml??

Thx alot
Johannes

Re: Tomcat server.xml context-specific configuration

Posted by jo...@fwd.at.
Hi Andoni,

I've got to manage tomcat in production with 99% availabilty, so I cannot 
afford a stop/start of Tomcat just to perform a minor update or bugfix. I 
want Tomcat in general run continuously.

So I have to avoid server.xml and its neighbourhood (/webapps/*.xml) where 
possible to achieve this goal. I think every application will have to 
achieve this goal at a certain point (=production level).

I'd suggest to set up a "code of practice" , i.e. what has to be done to 
achieve high availability of Tomcat. 
My first suggestion at this point would be to deprecate the usage of 
server.xml for parameter storage and encourage e.g. environment-variables 
(env-entry) in web.xml of each Context. This makes parameter config 
reloadable using ant/the manager application.

Does anybody know who could be in charge of this configuration issues and 
whom I could tell/discuss this idea with?
I think this topic is going to be important for every production quality 
tomcat server out there, which has to run frequent updates of 
functionality (webapps).

thx
Johannes





"Andoni" <an...@indigo.ie> 
28.03.2003 13:36
Please respond to
"Tomcat Users List" <to...@jakarta.apache.org>


To
"Tomcat Users List" <to...@jakarta.apache.org>
cc

Subject
Re: Tomcat server.xml context-specific configuration






I like putting everything possible into servlet.xml even though that means
restarting tomcat.  The advantage to me (and it is purely personal
preference) is that then I can look at one file and see straight away
everything that is going on with my system.  I don't understand people who
break up config files into  smaller files here, there and everywhere 
around
the tree.

If you are just starting out and you are not used to configuring Tomcat
servers then you might start this way and change if you don't like it or
vice-versa.

Hope that's of some help.

Andoni.
----- Original Message -----
From: <jo...@fwd.at>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, March 28, 2003 9:40 AM
Subject: Tomcat server.xml context-specific configuration


> Hi there,
>
> Since I got no replies to any of my inquiries regarding the use of
> context-specific information in server.xml, it seems as if nobody else
> uses this configuration property?
>
> What is the recommended place to put context-specific parameters into?
> e.g.
> <Context crossContext="true" debug="0" docBase="myapp" path="/myapp"
> reloadable="true">
>                 <Logger 
className="org.apache.catalina.logger.FileLogger"
> prefix="wartung_log." suffix=".txt" timestamp="true"/>
>         <ResourceLink name="jdbc/mydb" global="MyDatabase"/>
>         <Parameter name="myparam" override="false" value="xxx"/>
> </Context>
>
> Should I
> *) put it into server.xml (as is done with the examples demo-context) 
with
> the disadvantage of having to restart Tomcat if changes occur.
> *) put it into webapps/myapp.xml (with the same disadvantage as above)
> *) put it into web.xml as servlet-specific configuration?
> Or can I also store context-specific info in web.xml??
>
> Thx alot
> Johannes


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



In process with IIS and external application

Posted by Amit Bhargava <ab...@bdinnoware.com>.
Hi,

I am a real newbie to Tomcat and its world.

I have an application that has Tomcat 3.3 bundled with itself. If I run
Tomcat that is bundled from its location, I can access the application from
the browser. In short the application is running outprocess.
(http://localhost:8080/costume/index.html)

What I want is to have the application run from IIS, that is an inprocess
application.

What I have done is following

1. Downloaded the isapi_redirector.dll and copied it to the location
<TOMCAT_HOME>/conf/
2. Created a new context in the server.xml name 'costume'.
3. Created a worker.properties and uriworkermap.properties file with
following entries.

workers.properties file entries.
============================================================================
============================
	workers.tomcat_home=c:\jakarta
	workers.java_home=d:\j2sdk1.4.0_02

	ps=\

	worker.list=inprocess

# Defining a worker named inprocess and of type jni
	worker.inprocess.type=jni

# Additional class path components.

	worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
	worker.inprocess.class_path=d:\j2sdk1.4.0_02\lib\tools.jar
	worker.inprocess.class_path=c:\costume\webserver\config
	worker.inprocess.class_path=D:\Program Files\Microsoft SQL Server 2000
Driver for JDBC\lib\msbase.jar
	worker.inprocess.class_path=D:\Program Files\Microsoft SQL Server 2000
Driver for JDBC\lib\msutil.jar
	worker.inprocess.class_path=D:\Program Files\Microsoft SQL Server 2000
Driver for JDBC\lib\mssqlserver.jar
	worker.inprocess.class_path=E:\oracle\ora90\jdbc\lib\classes111.zip
	worker.inprocess.class_path=E:\oracle\ora90\jdbc\lib\nls_charset11.zip

	worker.inprocess.cmd_line=start

	worker.inprocess.jvm_lib=D:\j2sdk1.4.0_02\jre\bin\client\jvm.dll


worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout

worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr

============================================================================
============================

uriworkermap.properties file entries

============================================================================
============================
default.worker=inprocess

/admin=$(default.worker)
/admin/*=$(default.worker)
/examples=$(default.worker)
/examples/*=$(default.worker)
/costume*=inprocess
/costume/*=inprocess
============================================================================
============================

3. Modified the registry to have following entries.

[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi
Redirector\1.0]
"extension_uri"="/tomcat/isapi_redirect.dll"
"log_file"="C:\\tomcat 4.1\\logs\\jk_iis_redirect.log"
"log_level"="debug"
"worker_file"="C:\\tomcat 4.1\\conf\\jk\\workers.properties"
"worker_mount_file"="C:\\tomcat 4.1\\conf\\uriworkermap.properties"

4. Created a new virtual directory 'jakarta', installed a new filter, into
IIS and got that filter up and running.
5. Restarted Tomcat 4.1.24 and then restarted IIS

Now when I check the following urls, none of them works

1. http://localhost/examples/jsp/index.html
2. http://localhost/costume/index.html

alternatively these works

1. http://localhost:8080/examples/jsp/index.html
2. http://localhost:8080/costume/index.html

What I get is 'page not found' error.

Now pls. help me as to get my application running from Tomcat.

Regards

Amit Bhargava


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


Re: Tomcat server.xml context-specific configuration

Posted by Andoni <an...@indigo.ie>.
I like putting everything possible into servlet.xml even though that means
restarting tomcat.  The advantage to me (and it is purely personal
preference) is that then I can look at one file and see straight away
everything that is going on with my system.  I don't understand people who
break up config files into  smaller files here, there and everywhere around
the tree.

If you are just starting out and you are not used to configuring Tomcat
servers then you might start this way and change if you don't like it or
vice-versa.

Hope that's of some help.

Andoni.
----- Original Message -----
From: <jo...@fwd.at>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, March 28, 2003 9:40 AM
Subject: Tomcat server.xml context-specific configuration


> Hi there,
>
> Since I got no replies to any of my inquiries regarding the use of
> context-specific information in server.xml, it seems as if nobody else
> uses this configuration property?
>
> What is the recommended place to put context-specific parameters into?
> e.g.
> <Context crossContext="true" debug="0" docBase="myapp" path="/myapp"
> reloadable="true">
>                 <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="wartung_log." suffix=".txt" timestamp="true"/>
>         <ResourceLink name="jdbc/mydb" global="MyDatabase"/>
>         <Parameter name="myparam" override="false" value="xxx"/>
> </Context>
>
> Should I
> *) put it into server.xml (as is done with the examples demo-context) with
> the disadvantage of having to restart Tomcat if changes occur.
> *) put it into webapps/myapp.xml (with the same disadvantage as above)
> *) put it into web.xml as servlet-specific configuration?
> Or can I also store context-specific info in web.xml??
>
> Thx alot
> Johannes


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


Re: Tomcat server.xml context-specific configuration

Posted by jo...@fwd.at.
Hi there,

Here's what I found so far:

1.) I found that the more modern way of accessing scalar environment 
attributes seems to be JNDI.
2.) JNDI environment entries can be stored in web.xml
3.) 
web.xml file:
    <env-entry>
      <env-entry-name>testvaluewebxml</env-entry-name>
      <env-entry-value>value1</env-entry-value>
      <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

4.) 
Lookup using Java Code:
 try {
        Context globalctx = new InitialContext();
        String envEntry = null;

        envEntry = (String) 
globalctx.lookup("java:comp/env/testvaluewebxml");
        out.println("envEntry testvaluewebxml: " + envEntry);
} catch (Exception e) {
        out.println("<li>Cannot get env-entry on JNDI " + e + "</li>");
        return;
}

I didn't find such an example in the JNDI resources howto 
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html) 
, but I think it would be cool to have such one.

p.s. Does anybody know how to access e.g. java:comp/env/ to read all 
environment entries available? Maybe even a code sample to share??

thx alot
Johannes