passing environment variables to Tomcat

2002-07-29 Thread Chen, Dean (Zhun)

Hi,
I'm using Tomcat 4.0.3, we need to pass an environment variable to Tomcat.
In essence, we are trying to define the environment variable, i.e.: DEV, QA,
PROD, etc.

Currently, we do this by modifying the catalina.sh and add this to the
runtime command 
-Dweb.env="$WEB_ENV" \  

However, can this be done by modifying the server.xml instead? I don't
believe we will have write access to catalina.sh in the future.

Thanks,

Dean

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




RE: Environment Variable

2002-07-11 Thread Chen, Dean (Zhun)

Thanks. that's a great idea. I have one web.xml for all environments.

Dean Chen


-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 11, 2002 11:02 AM
To: Tomcat Users List
Subject: RE: Environment Variable


Howdy,
If you have a different web.xml for each environment, you can put a
param there indicating which environment it is.  If you have a different
tomcat startup script for each environment, you can add an option
(CATALINA_OPTS or JAVA_OPTS), e.g. -Dcom.mycompany.env=production and
then use System.getProperty("com.mycompany.env") to retrieve the value. 

Maybe one of those will work for you ;)

Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Chen, Dean (Zhun) [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, July 11, 2002 10:54 AM
>To: 'Tomcat Users List'
>Subject: Environment Variable
>
>Hi,
>I have a quick question. I would like my application to know what kind
of
>environment (DEV, QA, PROD) it's in by looking at Tomcat. Does anyone
know
>how to do that?
>
>Thanks,
>
>Dean Chen
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Environment Variable

2002-07-11 Thread Chen, Dean (Zhun)

Hi,
I have a quick question. I would like my application to know what kind of
environment (DEV, QA, PROD) it's in by looking at Tomcat. Does anyone know
how to do that?

Thanks,

Dean Chen

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




Multiple App deployment

2002-06-21 Thread Chen, Dean (Zhun)

Hi, I have a simple question regarding where to put files for deployment of
multiple applications that will share common files.

Currently, I have 

--commons
css
images
jsp
--images
--jsp
--WEB-INF

This is good because you can package all these up into a WAR file and
everything works. However, if the files in the commons directory changes,
the application would need to be recompiled. If I move the commons directory
up a level, it would be outside the scope of the application and it wouldn't
be able to refer to it. Any ideas? Is there a way to do this but still have
deploy WAR files instead of individual files?

Thanks,

Dean Chen

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




Tomat & Weblogic

2002-06-20 Thread Chen, Dean (Zhun)

Has anyone had success developing the application in Tomcat and having it
run in production in Weblogic?

I'm trying to figure out what are the common files and what are the
app-specific files.

So far, I have a build.xml script that puts the files in the correct places.
However, Tomcat specifiesto be placed in web.xml, but
weblogic requires a weblogic.xml file. I'm trying to minimize the # of files
to change. 

Any suggestions?

Thanks,

Dean Chen

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




Reload Application.properties

2002-05-31 Thread Chen, Dean (Zhun)

Is there a way for Tomcat to automatically reload Application.properties
file? The search feature on the archive is not working, so I can't search.

Thanks,

Dean Chen

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




RE: tomcat 4.0.3 and No suitable driver SQLException - SOLVED

2002-05-29 Thread Chen, Dean (Zhun)

Thanks for your help everyone.

I found the solution:

I am using Tomcat 4.03+ with JDK 1.4 (I've tested with JDK 1.31 and it also
works)

According to this file
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

It states the order in which classes & jars are loaded.
/WEB-INF/classes of your web application 
/WEB-INF/lib/*.jar of your web application 
Bootstrap classes of your JVM 
System class loader classses (described above) 
$CATALINA_HOME/common/classes 
$CATALINA_HOME/common/endorsed/*.jar 
$CATALINA_HOME/common/lib/*.jar 
$CATALINA_HOME/shared/classes 
$CATALINA_HOME/shared/lib/*.jar 

Since jconn2.jar is application wide file, I put it in
$CATALINA_HOME/common/lib (I've also referenced other Tomcat documentations.
Of course since it's constantly being revised, this information is as of
this writing). PS, I'm using JConnect 5.5

You do not need (and probably should not) have a classpath to jconn2.jar. 

The solution lies in server.xml, the parameter user & password should occur
before the other info, and the paramter url has been changed to driverName,
although it might still work.


  
userusername
 
passwordpassword
driverClassName
  com.sybase.jdbc2.jdbc.SybDriver

driverName
  jdbc:sybase:Tds::/

  

Thanks all for your help. I hope this helps in the future.


Dean Chen


-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 8:05 PM
To: Tomcat Users List
Subject: RE: tomcat 4.0.3 and No suitable driver SQLException


Some of the parameter names seem to have changed.  I suggest grabbing a 
recent nightly build of Tomcat 4.1 and following the instructions here:

http://marc.theaimsgroup.com/?l=tomcat-user&m=102242646003357&w=2

There I point to two other messages that I sent to the list and reference
the original email where I found the solution.  I also added a bit of code
to one of the emails so be sure to read them all.

I think the main problem is this.  Compare my configuration to 
yours.  Notice that some of the param names are different and there are 
some that you don't have that you need (such as "factory"):


 
 
 username
 blahuser
 
 
 password
 blahpass
 
 
 driverClassName
 oracle.jdbc.driver.OracleDriver
 
 
 url
 jdbc:oracle:thin:@oracle.mydomain:1521:utasklst
 
 
 factory
 org.apache.commons.dbcp.BasicDataSourceFactory
 
 
 maxActive
 100
 
 
 maxIdle
 3
 
 
 maxWait
 100
 
 
 validationQuery
 SELECT MAX(id) FROM Users
 
 

Jake

At 07:12 PM 5/28/2002 -0400, you wrote:
>I was able to connect by doing:
>
>Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
>conn = DriverManager.getConnection();
>
>However, still doesn't work if I do ds.getConnection();
>
>How can I check to see if the datasource is loaded correctly besides
>checking if it's null or not.
>
>Thanks,
>
>Dean Chen
>
>
>-Original Message-
>From: Chen, Dean (Zhun)
>Sent: Tuesday, May 28, 2002 1:00 PM
>To: 'Tomcat Users List'
>Subject: tomcat 4.0.3 and No suitable driver SQLException
>
>
>Hi,
>
>I know this has been covered before, and I've searched the archives, but
>none of the solutions posted seemed to work. Am I missing something?
>
>I am using Tomcat 4.03, JDK 1.4, and Sybase JConn 5.5
>
>Here's what I did:
>
>I installed the appropriate applications.
>I put jconn2.jar in CATALINA_HOME/common/lib
>
>My settings are as follows
>server.xml
>type="javax.sql.DataSource"/>
>
>   
> driverClassName
>   com.sybase.jdbc2.jdbc.SybDriver
> 
> url
>   jdbc:sybase:Tds:servername:4946/database
> 
>
userusername
>
passwordpassword
>   
>
>
>web.xml
>   
> Sets Database
> jdbc/setsDataSource
> javax.sql.DataSource
> Container
>   
>
>
>I have a method that has this
>
> Context ctx = new InitialContext();
> Context envCtx = (Context) ctx.lookup("java:comp/env/");
> DataSource ds = (DataSource) envCtx.lookup("jdbc/setsDataSource");
>
> if (ds==null)
> throw new DatasourceUnavailableException("Unable to obtain
>datasource: "+name);
>
>  

RE: tomcat 4.0.3 and No suitable driver SQLException

2002-05-28 Thread Chen, Dean (Zhun)

I was able to connect by doing:

Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
conn = DriverManager.getConnection();

However, still doesn't work if I do ds.getConnection();

How can I check to see if the datasource is loaded correctly besides
checking if it's null or not.

Thanks,

Dean Chen


-Original Message-----
From: Chen, Dean (Zhun) 
Sent: Tuesday, May 28, 2002 1:00 PM
To: 'Tomcat Users List'
Subject: tomcat 4.0.3 and No suitable driver SQLException


Hi,

I know this has been covered before, and I've searched the archives, but
none of the solutions posted seemed to work. Am I missing something?

I am using Tomcat 4.03, JDK 1.4, and Sybase JConn 5.5

Here's what I did:

I installed the appropriate applications.
I put jconn2.jar in CATALINA_HOME/common/lib

My settings are as follows
server.xml
  

  
driverClassName
  com.sybase.jdbc2.jdbc.SybDriver

url
  jdbc:sybase:Tds:servername:4946/database

userusername
passwordpassword
  


web.xml
  
Sets Database
jdbc/setsDataSource
javax.sql.DataSource
Container
  


I have a method that has this

Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env/");
DataSource ds = (DataSource) envCtx.lookup("jdbc/setsDataSource");

if (ds==null)
throw new DatasourceUnavailableException("Unable to obtain
datasource: "+name);

try {
conn = ds.getConnection();  
catch { blah blah


That getConnection() part throws a SQLException

java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:233)
at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:204)
at
com.gs.ed.sh.SetsInitializer.getConnection(SetsInitializer.java:83)
at com.gs.ed.sh.SetsInitializer.reload(SetsInitializer.java:111)
at com.gs.ed.sh.SetsInitializer.load(SetsInitializer.java:100)
at com.gs.ed.sh.SetsInitializer.init(SetsInitializer.java:61)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
6)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:808)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3266)
at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:2479)
at
org.apache.catalina.loader.WebappContextNotifier.run(WebappLoader.java:1329)
at java.lang.Thread.run(Thread.java:536)

Thanks in advance.

Dean Chen



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




tomcat 4.0.3 and No suitable driver SQLException

2002-05-28 Thread Chen, Dean (Zhun)

Hi,

I know this has been covered before, and I've searched the archives, but
none of the solutions posted seemed to work. Am I missing something?

I am using Tomcat 4.03, JDK 1.4, and Sybase JConn 5.5

Here's what I did:

I installed the appropriate applications.
I put jconn2.jar in CATALINA_HOME/common/lib

My settings are as follows
server.xml
  

  
driverClassName
  com.sybase.jdbc2.jdbc.SybDriver

url
  jdbc:sybase:Tds:servername:4946/database

userusername
passwordpassword
  


web.xml
  
Sets Database
jdbc/setsDataSource
javax.sql.DataSource
Container
  


I have a method that has this

Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env/");
DataSource ds = (DataSource) envCtx.lookup("jdbc/setsDataSource");

if (ds==null)
throw new DatasourceUnavailableException("Unable to obtain
datasource: "+name);

try {
conn = ds.getConnection();  
catch { blah blah


That getConnection() part throws a SQLException

java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:233)
at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:204)
at
com.gs.ed.sh.SetsInitializer.getConnection(SetsInitializer.java:83)
at com.gs.ed.sh.SetsInitializer.reload(SetsInitializer.java:111)
at com.gs.ed.sh.SetsInitializer.load(SetsInitializer.java:100)
at com.gs.ed.sh.SetsInitializer.init(SetsInitializer.java:61)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
6)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:808)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3266)
at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:2479)
at
org.apache.catalina.loader.WebappContextNotifier.run(WebappLoader.java:1329)
at java.lang.Thread.run(Thread.java:536)

Thanks in advance.

Dean Chen



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




RE: tomcat 4.0.3 and Null datasource

2002-05-28 Thread Chen, Dean (Zhun)

The datasource issue was solved, but I get this: 

java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:233)
at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:204)
at
com.gs.ed.sh.SetsInitializer.getConnection(SetsInitializer.java:83)
at com.gs.ed.sh.SetsInitializer.reload(SetsInitializer.java:111)
at com.gs.ed.sh.SetsInitializer.load(SetsInitializer.java:100)
at com.gs.ed.sh.SetsInitializer.init(SetsInitializer.java:61)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
6)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:808)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3266)
at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:2479)
at
org.apache.catalina.loader.WebappContextNotifier.run(WebappLoader.java:1329)
at java.lang.Thread.run(Thread.java:536)

I'm using jconn2.jar, file size is 760KB, I put it in
CATALINA_HOME/common/lib. Are there any files I'm missing? 
Also, people mentioned putting these files in the same directory, ie: DBCP,
collections and pool, what do I need these files for?

Thanks,

Dean Chen


-Original Message-----
From: Chen, Dean (Zhun) 
Sent: Tuesday, May 28, 2002 10:09 AM
To: 'Tomcat Users List'
Subject: RE: tomcat 4.0.3 and Null datasource


Thanks,
I can't believe that was it, I was concentrating on the first "D" and
totalling ignored the "S". Thanks again. This is what I get for coding on
Friday! :-)

Dean Chen



-Original Message-
From: Phillip Morelock [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 6:06 PM
To: Tomcat Users List
Subject: Re: tomcat 4.0.3 and Null datasource


just reading your email, i think you should look at how you spell each
instance of this word:

> setsDatasource


in some places it's setsDataSource

cheers
fillup

--
Hi,

I am having trouble obtain datasource to get a connection, I've looked over
the mailing archives and followed the directions, but still can't get it to
work.

I'm using I'm using Tomcat 4.0.3 and Sybase jconn2.jar

I have a method that has this

Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env/");
DataSource ds = (DataSource) envCtx.lookup("jdbc/setsDataSource");

however, if I check for  if (ds == null), that is true, so the get
Connection that follows doesn't work.


I have tried different approaches, I've put jconn2.jar in my Web-inf/lib, I
have tried putting jconn2.jar in %tomcat%/common/lib, still doesn't work.

My settings are as follows
server.xml
  
  
driverClassName
  com.sybase.jdbc2.jdbc.SybDriver

url
  jdbc:sybase:Tds:servername:4946/database

userusername
 
passwordpassword
  

web.xml
  
Sets Database
jdbc/setsDataSource
javax.sql.DataSource
Container
  

Any ideas would be appreciated, thanks.

Dean




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: tomcat 4.0.3 and Null datasource

2002-05-28 Thread Chen, Dean (Zhun)

Thanks,
I can't believe that was it, I was concentrating on the first "D" and
totalling ignored the "S". Thanks again. This is what I get for coding on
Friday! :-)

Dean Chen



-Original Message-
From: Phillip Morelock [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 6:06 PM
To: Tomcat Users List
Subject: Re: tomcat 4.0.3 and Null datasource


just reading your email, i think you should look at how you spell each
instance of this word:

> setsDatasource


in some places it's setsDataSource

cheers
fillup

--
Hi,

I am having trouble obtain datasource to get a connection, I've looked over
the mailing archives and followed the directions, but still can't get it to
work.

I'm using I'm using Tomcat 4.0.3 and Sybase jconn2.jar

I have a method that has this

Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env/");
DataSource ds = (DataSource) envCtx.lookup("jdbc/setsDataSource");

however, if I check for  if (ds == null), that is true, so the get
Connection that follows doesn't work.


I have tried different approaches, I've put jconn2.jar in my Web-inf/lib, I
have tried putting jconn2.jar in %tomcat%/common/lib, still doesn't work.

My settings are as follows
server.xml
  
  
driverClassName
  com.sybase.jdbc2.jdbc.SybDriver

url
  jdbc:sybase:Tds:servername:4946/database

userusername
 
passwordpassword
  

web.xml
  
Sets Database
jdbc/setsDataSource
javax.sql.DataSource
Container
  

Any ideas would be appreciated, thanks.

Dean




--
To unsubscribe, e-mail:

For additional commands, e-mail:




--
To unsubscribe, e-mail:

For additional commands, e-mail:


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




RE: tomcat 4.0.3 and Null datasource

2002-05-24 Thread Chen, Dean (Zhun)

Hi,

I am having trouble obtain datasource to get a connection, I've looked over
the mailing archives and followed the directions, but still can't get it to
work.

I'm using I'm using Tomcat 4.0.3 and Sybase jconn2.jar

I have a method that has this

Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env/");
DataSource ds = (DataSource) envCtx.lookup("jdbc/setsDataSource");

however, if I check for  if (ds == null), that is true, so the get
Connection that follows doesn't work.


I have tried different approaches, I've put jconn2.jar in my Web-inf/lib, I
have tried putting jconn2.jar in %tomcat%/common/lib, still doesn't work.

My settings are as follows
server.xml

  
driverClassName
  com.sybase.jdbc2.jdbc.SybDriver

url
  jdbc:sybase:Tds:servername:4946/database

userusername
 
passwordpassword
  

web.xml
  
Sets Database
jdbc/setsDataSource
javax.sql.DataSource
Container
  

Any ideas would be appreciated, thanks.

Dean




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