Setting properties outside of the WAR

2000-12-10 Thread Ritchie Young



Hi,
 
Is there a standard way to set a property for a 
web-app other than in the WEB-INF/web.xml ?
 
I would like to copy my web app between several 
machines each of which requires some unique settings. Previously I've been 
doing this by setting the TOMCAT_OPTIONS="-Dprops=my.properties" before running 
Tomcat but I thought there must be a nicer way of doing it than 
that.
 
Thanks
Ritchie


Re: Setting properties outside of the WAR

2001-01-01 Thread Ritchie Young

Thanks for the response but that wasn't quite what I was getting at.

The idea was that there should be some easy way for an administrator to set
a property for the application. It just strikes me that the TOMCAT_OPTIONS
variable is a slightly cumbersome way especially when there start to be a
few more applications.

I thought that the "Context" tag in server.xml wouldn't be a bad place to
incorporate application specific settings such as where the application can
find it's properties file. This would also allow for multiple instance of
the same application to use different configurations but only one WAR file.

Cheers
Ritchie

> To set properties dynamically in your application you can try this command
>
> java.lang.System.setProperty(key,value)
>
> Or
>
> System.getProperties().put("HTTPClient.dontChunkRequests", "true");



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Setting properties outside of the WAR

2001-01-03 Thread Ritchie Young

Oh good, it's not just me.

Thanks, I would appreciate it if you did forward me a copy of that script.

Cheers
Ritchie

- Original Message -
From: "Kitching Simon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 03, 2001 6:07 PM
Subject: RE: Setting properties outside of the WAR


> I think that this whole issue (specifying configuration parameters
> to web applications) needs some serious thought - possibly
> at the level of the servlet spec development group, even.
>
> The problem is that two deployments of the same application are
> not necessarily identical. The most obvious example is where two
> otherwise identical installations need to be configured to use
> different databases (ie different JDBC connection strings).
>
> It is really **nasty** to deploy a webapp, then have to edit a string
> inside the WEB-INF/web.xml as part of the deployment procedure.
> (a) it's hard to describe in such a way that an "application support team"
> can reliably get it right,
> (b) if it is stuffed up, then really nasty consequences can occur
> - testing system gets connected to production database, or
>   production system gets connected to development database,
>   which is worse ???!!
>
> I think what is needed, instead, **is** some configuration
> outside of the webapp. Upgrading a webapp then doesn't
> "throw away" the configuration settings used for the previous
> release. Obviously, there needs to be some kind of consistency
> checking to ensure that new configuration items don't need to
> be added for the new release, etc.
>
> My current solution (which you are welcome to, Ritchie, if you
> want a copy) is a perl script which is run after installing a copy
> of the webapp. It searches the tree of files, replacing any occurrence
> of strings of form @token-name@ with a value from a property file
> which is specific to each *installation* of the webapp. My development
> installation of the webapp gets configured using one property file,
> my acceptance-test instance uses a second, and the production
> system uses a third properties file.
>
> While the *main* file that gets modified during the install is the
> web.xml file, there are other files that get modified, eg the log4j
> configuration options file which is also in WEB-INF.
>
> Note that I do not want to use ANT to do this token-replacement
> during building of the "WAR" file, because I want to have a standard
> WAR file that can be deployed into development, testing and production.
>
> Any alternatives that could be used to configure a webapp per-deployment
> would be welcome - I'm not perfectly happy with my current solution, I
just
> can't think of anything better
>
> Regards,
>
> Simon
> > -Original Message-
> > From: Craig R. McClanahan [SMTP:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 02, 2001 10:10 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Setting properties outside of the WAR
> >
> > Ritchie Young wrote:
> >
> > > Thanks for the response but that wasn't quite what I was getting at.
> > >
> > > The idea was that there should be some easy way for an administrator
to
> > set
> > > a property for the application. It just strikes me that the
> > TOMCAT_OPTIONS
> > > variable is a slightly cumbersome way especially when there start to
be
> > a
> > > few more applications.
> > >
> > > I thought that the "Context" tag in server.xml wouldn't be a bad place
> > to
> > > incorporate application specific settings such as where the
application
> > can
> > > find it's properties file. This would also allow for multiple instance
> > of
> > > the same application to use different configurations but only one WAR
> > file.
> > >
> >
> > The settings in server.xml are designed to configure Tomcat's own
features
> > --
> > not your application.  Your app is responsible for that.  You can do
> > things in a
> > portable way (for example, call
> > ServletContext.getResource("/WEB-INF/myprops.properties")), or not, as
you
> > choose.
> >
> > Keep in mind that the intent of web applications is that they are *stand
> > alone*
> > gadgets, to be dragged and dropped onto a servlet container (*any*
> > container,
> > not just Tomcat) and work correctly.  Given that, it does not make sense
> > for the
> > servlet API to provide any mechanism to access resources outside of the
> > WAR.
> > You are free, of course, to implement any such technique (such as
passing
&

Re: Setting properties outside of the WAR

2001-01-03 Thread Ritchie Young

Craig R. McClanahan wrote:

> The settings in server.xml are designed to configure Tomcat's own
features --
> not your application. Your app is responsible for that.  You can do things
in a
> portable way (for example, call
> ServletContext.getResource("/WEB-INF/myprops.properties")), or not, as you
> choose.

The problem with that is that you are getting the properties from within the
WAR. It's just the same as setting init parameters inside web.xml. This is
my point. There should be a portable way of accessing parameters set by the
administrator who probably shouldn't be opening up a WAR file and playing
around with it's contents.


> Keep in mind that the intent of web applications is that they are *stand
alone*
> gadgets, to be dragged and dropped onto a servlet container (*any*
container,
> not just Tomcat) and work correctly.  Given that, it does not make sense
for the
> servlet API to provide any mechanism to access resources outside of the
WAR.

If the intention is that they be drag & dropped, the administrator still
needs some way of configuring the particular instance. By limiting the
portable configuration options to what's inside the WAR, you are at least
requiring a separate copy of the WAR for each running instance of the same
web app within the container.

What's worse is that dropping a new version of the WAR would wipe out any
configuration changes made to the original.

Why can't the servlet API define calls to access parameters defined outside
of the WAR but tell the container writers that they can implement the
setting and storage of these parameters however they see fit?

> You are free, of course, to implement any such technique (such as passing
the
> absolute pathname to a properties file in a servlet initialization
parameter),
> but you are making it harder on people who want to deploy your webapp in a
> variety of environments, as well as limiting the set of environments in
which
> your app can run (for example, an ISP might prohibit file access in order
to
> protect the various web apps from each other).

Absolutely. That's why I don't want to do it.

Thanks for responding to my query. I hope my reply doesn't seem negative.
WARs are really cool but I still think that something is missing here.

Cheers
Ritchie


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: bind problem

2001-01-03 Thread Ritchie Young

Use

netstat -nlp

to find the process id that is listening on that port.

Cheers
Ritchie

- Original Message -
From: "Andrew Burrows" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 04, 2001 11:23 AM
Subject: Re: bind problem


> Hi David,
> Could you tell me how to find what process is using this port.
>
> Andrew
> Ps It is install on a linux box.
>
>
>
> > From: "David M. Holmes" <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > Date: Wed, 3 Jan 2001 20:34:57 -0800
> > To: [EMAIL PROTECTED]
> > Subject: Re: bind problem
> >
> > The address & port that Tomcat is trying to listen on is already in
use...
> >
> > --- Andrew Burrows <[EMAIL PROTECTED]> wrote:
> >> Hi All
> >> Could anyone shed some light on this error I get when starting tomcat.
> >>
> >> csjsp:/usr/local/tomcat/bin# ./startup.sh
> >> Using classpath:
> >>
.:/usr/local/tomcat/lib/ant.jar:/usr/local/tomcat/lib/jasper.jar:/usr/local/
> >>
tomcat/lib/servlet.jar:/usr/local/tomcat/lib/test:/usr/local/tomcat/lib/webs
> >> erver.jar:/usr/local/tomcat/lib/xml.jar
> >> csjsp:/usr/local/tomcat/bin# Context log: path="/examples" Adding
context
> >> path="/examples"  docBase="webapps/examples"
> >> Context log: path="" Adding context path=""  docBase="webapps/ROOT"
> >> Context log: path="/test" Adding context path="/test"
> >> docBase="webapps/test"
> >> Starting tomcat. Check logs/tomcat.log for error messages
> >> Starting tomcat install="/usr/local/tomcat" home="/usr/local/tomcat"
> >>
classPath="/usr/share/java/repository:.:/usr/local/tomcat/lib/ant.jar:/usr/l
> >>
ocal/tomcat/lib/jasper.jar:/usr/local/tomcat/lib/servlet.jar:/usr/local/tomc
> >>
at/lib/test:/usr/local/tomcat/lib/webserver.jar:/usr/local/tomcat/lib/xml.ja
> >> r"
> >> Context log: path="/admin" Automatic context load
> >> docBase="/usr/local/tomcat/webapps/admin"
> >> Context log: path="/admin" Adding context path="/admin"
> >> docBase="/usr/local/tomcat/webapps/admin"
> >> FATAL:java.net.BindException: Address already in use
> >> java.net.BindException: Address already in use
> >> at java.net.PlainSocketImpl.socketBind(Native Method)
> >> at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:397)
> >> at java.net.ServerSocket.(ServerSocket.java:170)
> >> at java.net.ServerSocket.(ServerSocket.java:121)
> >> at
> >>
org.apache.tomcat.net.DefaultServerSocketFactory.createSocket(DefaultServerS
> >> ocketFactory.java:97)
> >> at
> >>
org.apache.tomcat.service.SimpleTcpEndpoint.startEndpoint(SimpleTcpEndpoint.
> >> java:186)
> >> at
> >>
org.apache.tomcat.service.SimpleTcpConnector.start(SimpleTcpConnector.java:1
> >> 42)
> >> at
> >> org.apache.tomcat.core.ContextManager.start(ContextManager.java:253)
> >> at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:157)
> >> at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:163)
> >>
> >>
> >> 
> >> Andrew Burrows
> >> National IT Manager
> >> Flexstor.net Australia
> >> 5 Roundhay Court
> >> Berwick VIC 3806
> >> Mobile: 0402300400
> >> Phone: 613 97073008
> >> Fax: 613 99236069
> >> E-mail: [EMAIL PROTECTED]
> >> cc E-mail: [EMAIL PROTECTED]
> >> www.flexstornet.com.au
> >> 
> >>
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, email: [EMAIL PROTECTED]
> >>
> >
> >
> > __
> > Do You Yahoo!?
> > Yahoo! Photos - Share your holiday photos online!
> > http://photos.yahoo.com/
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: bind problem

2001-01-03 Thread Ritchie Young

Which port are we talking about here? If you haven't changed server.xml then
it would be trying to listen on ports 8080 and 8007. It looks here like you
have a java process of some kind listening on port 8080 (PID 258).

If this is the state that the system is in before you try to start tomcat
and you haven't modified server.xml then you should expect to see the
exception that you saw.

Try using the ps command to find out more about the 258 process. If this is
a fresh install then it's very likely an instance of Tomcat that didn't get
shutdown properly.

Cheers
Ritchie

- Original Message -
From: "Andrew Burrows" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 04, 2001 11:53 AM
Subject: Re: bind problem


> Hi Ritchie,
> I ran that but it hasn't listed anything on that port.
> csjsp:/etc/apache# netstat -nlp
> Active Internet connections (only servers)
> Proto Recv-Q Send-Q Local Address   Foreign Address State
> PID/Program name
> tcp0  0 0.0.0.0:80  0.0.0.0:*   LISTEN
> 25856/apache
> tcp0  0 0.0.0.0:80800.0.0.0:*   LISTEN
> 258/java
> tcp0  0 0.0.0.0:21  0.0.0.0:*   LISTEN
> 224/proftpd (accept
> tcp0  0 0.0.0.0:22  0.0.0.0:*   LISTEN
> 216/sshd
> tcp0  0 0.0.0.0:33060.0.0.0:*   LISTEN
> 181/mysqld
> raw0  0 0.0.0.0:1   0.0.0.0:*   7
> -
> raw0  0 0.0.0.0:6   0.0.0.0:*   7
> -
> Active UNIX domain sockets (only servers)
> Proto RefCnt Flags   Type   State I-Node PID/Program name
> Path
> unix  0  [ ACC ] STREAM LISTENING 127181/mysqld
> /var/run/mysqld/mysqld.sock
> unix  0  [ ACC ] STREAM L
> 
> Andrew Burrows
> National IT Manager
> Flexstor.net Australia
> 5 Roundhay Court
> Berwick VIC 3806
> Mobile: 0402300400
> Phone: 613 97073008
> Fax: 613 99236069
> E-mail: [EMAIL PROTECTED]
> cc E-mail: [EMAIL PROTECTED]
> www.flexstornet.com.au
> 
>
>
> > From: "Ritchie Young" <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > Date: Thu, 4 Jan 2001 11:34:54 +0800
> > To: <[EMAIL PROTECTED]>
> > Subject: Re: bind problem
> >
> > Use
> >
> > netstat -nlp
> >
> > to find the process id that is listening on that port.
> >
> > Cheers
> > Ritchie
> >
> > - Original Message -
> > From: "Andrew Burrows" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, January 04, 2001 11:23 AM
> > Subject: Re: bind problem
> >
> >
> >> Hi David,
> >> Could you tell me how to find what process is using this port.
> >>
> >> Andrew
> >> Ps It is install on a linux box.
> >>
> >>
> >>
> >>> From: "David M. Holmes" <[EMAIL PROTECTED]>
> >>> Reply-To: [EMAIL PROTECTED]
> >>> Date: Wed, 3 Jan 2001 20:34:57 -0800
> >>> To: [EMAIL PROTECTED]
> >>> Subject: Re: bind problem
> >>>
> >>> The address & port that Tomcat is trying to listen on is already in
> > use...
> >>>
> >>> --- Andrew Burrows <[EMAIL PROTECTED]> wrote:
> >>>> Hi All
> >>>> Could anyone shed some light on this error I get when starting
tomcat.
> >>>>
> >>>> csjsp:/usr/local/tomcat/bin# ./startup.sh
> >>>> Using classpath:
> >>>>
> >
.:/usr/local/tomcat/lib/ant.jar:/usr/local/tomcat/lib/jasper.jar:/usr/local/
> >>>>
> >
tomcat/lib/servlet.jar:/usr/local/tomcat/lib/test:/usr/local/tomcat/lib/webs
> >>>> erver.jar:/usr/local/tomcat/lib/xml.jar
> >>>> csjsp:/usr/local/tomcat/bin# Context log: path="/examples" Adding
> > context
> >>>> path="/examples"  docBase="webapps/examples"
> >>>> Context log: path="" Adding context path=""  docBase="webapps/ROOT"
> >>>> Context log: path="/test" Adding context path="/test"
> >>>> docBase="webapps/test"
> >>>> Starting tomcat. Check logs/tomcat.log for error messages
> >>>> Starting tomcat install="/usr/local/tomcat" home="/usr/local/tomcat"
> >>>>
> >

Re: tomcat install config error linux!!

2001-01-04 Thread Ritchie Young

Make sure that the following line appears in your /etc/hosts file:

127.0.0.1localhost

Then reboot to get rid of your running instances and try it all again.

-Ritchie

- Original Message -
From: "Deepak C S" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 04, 2001 2:28 PM
Subject: tomcat install config error linux!!


>
>  Hi,
>
> Ive just installed tomcat3.2.1 on linux and trying to run it
> standalone.
>
> while starting the server,Im getting
>
> FATAL:java.io.IOException: Address already in
> usecat-3.2.1/./webapps/examples"/t
> est context static) that#
> java.io.IOException: Address already in use
> at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:42)
> at java.net.ServerSocket.(ServerSocket.java:53)
> at java.net.ServerSocket.(ServerSocket.java:30)
> at
> org.apache.tomcat.net.DefaultServerSocketFactory.createSocket(Default
> ServerSocketFactory.java:97)
> at
> org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoi
> nt.java:239)
> at
> org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnector.jav
> a:188)
> at
> org.apache.tomcat.core.ContextManager.start(ContextManager.java:527)
> at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:202)
> at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
>
>
> If I change the default ports 8080 && 8007 to different Port values,Tomcat
> starts but
>
> After starting the server, If any request is made .
> Im getting
>
>  ContextManager: Erro
> r reading request, ignored - java.lang.ArrayIndexOutOfBoundsException:
> at java.io.BufferedInputStream.read(BufferedInputStream.java:118)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:69)
> at
> org.apache.tomcat.service.http.HttpRequestAdapter.doRead(HttpRequestA
> dapter.java:115)
> at
> org.apache.tomcat.core.BufferedServletInputStream.doRead(BufferedServ
> letInputStream.java:106)
> at
> org.apache.tomcat.core.BufferedServletInputStream.read(BufferedServle
> tInputStream.java:128)
> at
> javax.servlet.ServletInputStream.readLine(ServletInputStream.java:138
> )
> at
> org.apache.tomcat.service.http.HttpRequestAdapter.readNextRequest(Htt
> pRequestAdapter.java:129)
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
> n(HttpConnectionHandler.java:195)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
> 416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
> :498)
> at java.lang.Thread.run(Thread.java:314)
>
>
>
>
> while shutting down, Im getting
>
> "java.net.UnknownHostException: Unknown host: localhost "
>
> hence shutdown is incomplete and I cannot reuse the same PORTS without
> rebooting the m/c else I get Addressalreadyin use exception.
>
>
> Can anybody please help??
>
> thanx in adv,
> Deeps
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Is ANYONE doing this?? TC3.2.1 standalone + SSL + multiple instances on multiple IP's

2001-01-10 Thread Ritchie Young

For what it's worth, I can run TC 3.2.1 on the same machine as IIS both on
port 80 but different IP addresses. In server.xml it looks a bit like this:








Obviously, 10.1.1.1 would have to be an address bound to an interface on
that machine. I haven't tried doing this with SSL but I would suggest that
if you're really stuck, have a look through the source of the classes
mentioned in the config file.

Cheers
Ritchie

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 10, 2001 1:10 AM
Subject: Is ANYONE doing this?? TC3.2.1 standalone + SSL + multiple
instances on multiple IP's


>
>
> My frustration level has reached it's peak with this, so if I come across
as
> being a little short, I apologize in advance. I have not been able to find
> anything in the archives about this, and previous posts have not netted
much to
> help me with this problem. Perhaps it was just the holidays, so here we
go.
>
> I am going to provide as much detail as I can in this message, so it may
be
> long, but hopefully it will garner some responses.
>
> Environment: Solaris 2.6 on SPARC, JDK 1.3, Tomcat 3.2.1 Standalone
(binaries),
> SSL
>
> Goal: To run Tomcat standalone + SSL with Multiple IPs/domains on the same
> machine
>
> Background: I have installed TC 3.2.1 on a system, configured it to use
SSL with
> a certificate, and have run the included Tomcat apps successfully through
HTTP
> and HTTPS.
>
> Problems: 1) Our app will not work under SSL, 2) Can't configure Tomcat to
use
> multiple IPs/domains
>
>
> Problem 1:
> I have created new directories for our applications and modified
server.xml to
> point to the tomcat3.2.1 directory as the TOMCAT_HOME directory, and our
> application's directory as the docBase and home directories (I will email
> server.xml to anyone interested in helping).
>
> The application runs just fine through HTTP when the docBase is set to the
> application's main directory which links to a subdirectory containing the
> index.html file for the app. The index.html file simply presents a "Login"
link
> which takes the user to the jsp file that performs the login. Everything
works
> just fine this way.
>
> With HTTPS, however, the application hangs after clicking on the link to
the
> subdirectory. The link is dynamically created by Tomcat and is relative,
so the
> source for the page shows the link being "/dirname", and hovering the
mouse over
> the link displays it as "https://123.456.789.012/dirname". HOWEVER,
clicking on
> the link makes the status bar display "Connect: Host 123.456.789.012:80
> contacted. Waiting for reply..."
>
> The tomcat.log shows:
>
> 2001-01-09 10:48:37 - ContextManager: Error mapping the request R(  +
/dirname +
> null) 302
> 2001-01-09 10:48:37 - Ctx( 192.168.2.63: ): Handler
> tomcat.redirectHandler(null/null) tomcat.redirectHandler
>
> What is causing this problem?
>
> Problem 2:
> I can not seem to get Tomcat to bind to different IP addresses. I have
tried
> adding "inet=" and "address=" directives in various spots throughout the
> server.xml file for each test server created, but starting up Tomcat the
second
> time returns "Address already in use" and the second address is
unavailable. We
> want to be able to shutdown/restart/startup Tomcat on one IP and not
affect
> other running Tomcat instances.
>
> If you are running Tomcat standalone with multiple IP addresses, or know
someone
> who is, PLEASE email me your config files or tell me how you have done
this.
>
> I have been working at this off and on for almost three weeks and have
posted to
> this list a couple of times asking for help, but no one seems to be
running
> Tomcat in this way. If this can not be done in standalone, then we may
have to
> abandon Tomcat and look elsewhere. All of our pages are dynamic, so we
really
> don't need any of the static services of Apache, thus the need to Tomcat
to be
> configured by itself.
>
> Yours in exhaustion,
>
> Dion Vansevenant
> Internetwork Administrator
> MRO.com
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]