Re: can a web app discover its Service?
Raghupathy, Gurumoorthy wrote: How about Setting up jndi variables ? I've had a closer look at Tomcat Configuration Reference, which says you can set per-Server JNDI variables (GlobalNamingResources), and per-Context ones, but there's no mention of per-Service variables. Any idea whether/how this could be done? regards - Paul Regards Guru --- Gurumoorthy Raghupathy Email : [EMAIL PROTECTED] Internal Extn : 2337 External Phone : 01483712337 Nielsen Book 3rd Floor Midas House 62 Goldsworth Road Woking Surrey GU21 6LQ Visit us at : http://www.nielsenbookdata.co.uk/ --- -Original Message- From: Mikolaj Rydzewski [mailto:[EMAIL PROTECTED] Sent: 20 March 2007 15:05 To: Tomcat Users List Subject: Re: can a web app discover its Service? Paul Singleton wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. Is there a Tomcat-specific way to do this? JMX and MBeans come to mind. Is there a container-independent way of discovering container-specific info like this? Check port server listens on? -- Paul Singleton Jambusters Ltd tel: 01782 750821 fax: 08707 628609 VAT: 777 3904 85 Company no. 04150146 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
Mikolaj Rydzewski wrote: Paul Singleton wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. Is there a Tomcat-specific way to do this? JMX and MBeans come to mind. Is there a container-independent way of discovering container-specific info like this? Check port server listens on? OK, since Servlet 2.4 there's String ServletRequest.getLocalAddr() which returns the IP address on which the request was received; this should enable my web apps to discover whether they are deployed to our 'test' virtual server or one of the live ones. I'd still like to know if there's anything we can set in a Service element which our web apps can read... Paul Singleton - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: can a web app discover its Service?
From: Paul Singleton [mailto:[EMAIL PROTECTED] Subject: Re: can a web app discover its Service? I've had a closer look at Tomcat Configuration Reference, which says you can set per-Server JNDI variables (GlobalNamingResources), and per-Context ones, but there's no mention of per-Service variables. I have to ask: are you really trying to run both test and production environments inside a single instance of Tomcat inside a single JVM? If so, that's pretty gutsy. If you're not doing that, why do you have to change the Service name? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul, Paul Singleton wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. Is there a Tomcat-specific way to do this? Is there a container-independent way of discovering container-specific info like this? You tell us: how can /you/ tell that you are in production versus test? If you can make that determination, then you should be able to make your software do it, too. I have ant scripts that build everything for me including WAR files for deployment. In my source repo, I have different configuration directories for each of dev, demo, and prod. In fact, I can make as many of those as I'd like, since I just set release-type in my build.properties file to a string, and ant pulls the configuration and properties files that match that directory, so I could potentially create a foo release-type if I wanted. So, instead of the application detecting where it is and configuring itself appropriately, I tell the application what it /will be/ and configure it at build time. Yeah, so do we, but like I said: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. I didn't explain *why* we want to do this, because I don't want to spend time debating it with folk who prefer to do it the other way ;-) But here are a couple of plus points for discovery and self-configuration (DSC): 1) our dev, test and demo configurations behave in convenient ways we don't *ever* want in our live apps; with DSC we are more confident that, even if deployment misteaks are made, we won't be embarrassed 2) we can implement all configuration in Java and don't need to learn or teach anything else! regards - Paul Just my $0.02 - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF//kT9CaO5/Lv0PARAgJZAJ4r2l8nkM/fbQWl62nTeR1TsKgQOACfYIXr wWE/VnGrYVqHxl5mUpbPt1U= =qyrv -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Paul Singleton Jambusters Ltd tel: 01782 750821 fax: 08707 628609 VAT: 777 3904 85 Company no. 04150146 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
--- Paul Singleton [EMAIL PROTECTED] wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. I didn't explain *why* we want to do this, because I don't want to spend time debating it with folk who prefer to do it the other way ;-) But here are a couple of plus points for discovery and self-configuration (DSC): 1) our dev, test and demo configurations behave in convenient ways we don't *ever* want in our live apps; with DSC we are more confident that, even if deployment misteaks are made, we won't be embarrassed Paul, If your app talks to a database, have you considered using a database table to map IP's to deploy modes? -Bob Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
Bob Hall wrote: --- Paul Singleton [EMAIL PROTECTED] wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. I didn't explain *why* we want to do this, because I don't want to spend time debating it with folk who prefer to do it the other way ;-) But here are a couple of plus points for discovery and self-configuration (DSC): 1) our dev, test and demo configurations behave in convenient ways we don't *ever* want in our live apps; with DSC we are more confident that, even if deployment misteaks are made, we won't be embarrassed Paul, If your app talks to a database, have you considered using a database table to map IP's to deploy modes? No, each app has its own database, and in our case, I'm happier building this table into our (common) application bean. But you've given me an idea: I may label each database internally as test, live etc. and get the apps to check this too when they start... Many thanks - Paul -Bob Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Paul Singleton Jambusters Ltd tel: 01782 750821 fax: 08707 628609 VAT: 777 3904 85 Company no. 04150146 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul, Paul Singleton wrote: For now, I'm using ServletRequest.getLocalAddr() on the first request and inferring deploy mode from that. That seems pretty fragile, although I must admit that I can't immediately think of a way to subvert it. I mean, I'm assuming that one IP address is used for test and another for production, so using the test-IP to try to make the production deployment act like test (oops) probably wouldn't work. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGAbiS9CaO5/Lv0PARAiw6AJsEvVx9mWrwAWw72qUUueeN9b2jNgCdFtgn NYq70m0p93KL0faxB8SeHoo= =G6eQ -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: can a web app discover its Service?
How about Setting up jndi variables ? Regards Guru --- Gurumoorthy Raghupathy Email : [EMAIL PROTECTED] Internal Extn : 2337 External Phone : 01483712337 Nielsen Book 3rd Floor Midas House 62 Goldsworth Road Woking Surrey GU21 6LQ Visit us at : http://www.nielsenbookdata.co.uk/ --- -Original Message- From: Mikolaj Rydzewski [mailto:[EMAIL PROTECTED] Sent: 20 March 2007 15:05 To: Tomcat Users List Subject: Re: can a web app discover its Service? Paul Singleton wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. Is there a Tomcat-specific way to do this? JMX and MBeans come to mind. Is there a container-independent way of discovering container-specific info like this? Check port server listens on? -- Mikolaj Rydzewski [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul, Paul Singleton wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. Is there a Tomcat-specific way to do this? Is there a container-independent way of discovering container-specific info like this? You tell us: how can /you/ tell that you are in production versus test? If you can make that determination, then you should be able to make your software do it, too. I have ant scripts that build everything for me including WAR files for deployment. In my source repo, I have different configuration directories for each of dev, demo, and prod. In fact, I can make as many of those as I'd like, since I just set release-type in my build.properties file to a string, and ant pulls the configuration and properties files that match that directory, so I could potentially create a foo release-type if I wanted. So, instead of the application detecting where it is and configuring itself appropriately, I tell the application what it /will be/ and configure it at build time. Just my $0.02 - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF//kT9CaO5/Lv0PARAgJZAJ4r2l8nkM/fbQWl62nTeR1TsKgQOACfYIXr wWE/VnGrYVqHxl5mUpbPt1U= =qyrv -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
Paul Singleton wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. Is there a Tomcat-specific way to do this? JMX and MBeans come to mind. Is there a container-independent way of discovering container-specific info like this? Check port server listens on? -- Mikolaj Rydzewski [EMAIL PROTECTED] smime.p7s Description: S/MIME Cryptographic Signature
Re: can a web app discover its Service?
On 3/20/07, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 ... I have ant scripts that build everything for me including WAR files for deployment. In my source repo, I have different configuration directories for each of dev, demo, and prod. In fact, I can make as many of those as I'd like, since I just set release-type in my build.properties file to a string, and ant pulls the configuration and properties files that match that directory, so I could potentially create a foo release-type if I wanted. in fact you can even specify the system type as parameter to the build script, without need to edit it in the properties file: target name=war ... !-- test is default -- property name=config.file location=etc/config/test-config.properties/ copy tofile=${config.file.target} file=${config.file} overwrite=true/ ... /target target name=prod property name=config.file location=etc/config/prod-config.properties/ /target target name=test property name=config.file location=etc/config/test-config.properties/ /target ant test war - builds the war file for the testsystem, prod war - the production system. ant war build test or whatever you want to have as default. regards Leon So, instead of the application detecting where it is and configuring itself appropriately, I tell the application what it /will be/ and configure it at build time. Just my $0.02 - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF//kT9CaO5/Lv0PARAgJZAJ4r2l8nkM/fbQWl62nTeR1TsKgQOACfYIXr wWE/VnGrYVqHxl5mUpbPt1U= =qyrv -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Leon, Leon Rosenberg wrote: in fact you can even specify the system type as parameter to the build script, without need to edit it in the properties file: [snip] ant test war - builds the war file for the testsystem, prod war - the production system. ant war build test or whatever you want to have as default. Not a bad idea. I happen to have many different configuration files -- it's not just one -- but that same idea could be modified to meet my needs (i.e. set the base directory name instead of just a config file name). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGAAFX9CaO5/Lv0PARAlS0AJ9PnnKmy37HZchEUoQ90RRprrgz4gCfeEcv q6sdxaOY3T6ODcnIGSidgeE= =SOBd -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a web app discover its Service?
Mikolaj Rydzewski wrote: Paul Singleton wrote: I want to deploy the same war into different (5.5) Services (e.g. test and live), and want it to discover where it is and behave differently. Is there a Tomcat-specific way to do this? JMX and MBeans come to mind. Is there a container-independent way of discovering container-specific info like this? Check port server listens on? Well the port numbers are the same but the IP addresses differ, so if I can discover these, that's good enough for me. But how? I can't find anything in the Servlet API... Paul Singleton - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]