RE: [SOLVED] tomcat not able to connect to postgresql?

2008-04-11 Thread Dan Eriksson
Hi Chuck,
Thanks for the input!

I changed the appBase=webapps and docBase=myapp.

Not sure about the context yet though, as I want to be able to use the
same parameters for some other applications and not be dependent on the
developers to do configuration changes as we use war files to pack the
applications.
I guess there are other alternatives as well to accomplish this, and I
will look at it when I have more time :)

Best regards,
Dan


-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 10, 2008 3:30 PM
To: Tomcat Users List
Subject: RE: [SOLVED] tomcat not able to connect to postgresql?

 From: Dan Eriksson [mailto:[EMAIL PROTECTED] 
 Subject: [SOLVED] tomcat not able to connect to postgresql?
 
   Host name=myapp.mydomain.com appBase=webapps/myapp
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false
 Context path= docBase= debug=0 reloadable=true

You may have fixed your DB access issue, but the above config contains a
serious problem that will likely bite you in the future.  A docBase
attribute (explicit or implicit) must never be empty; in your case it's
the same as the Host appBase, which creates serious internal grief for
Tomcat.  The proper setting would be appBase=webapps and
docBase=myapp.

The above also places the Context element in server.xml, which has
been strongly discouraged for several years, and shouldn't be used by
any current implementation.  Since you apparently want this webapp to be
the default one, it should be located in webapps/ROOT, not
webapps/myapp, and the Context element should be in
webapps/ROOT/META-INF/context.xml, without the path and docBase
attributes.

 - 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]


-
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: [SOLVED] tomcat not able to connect to postgresql?

2008-04-11 Thread Caldarale, Charles R
 From: Dan Eriksson [mailto:[EMAIL PROTECTED] 
 Subject: RE: [SOLVED] tomcat not able to connect to postgresql?
 
 Not sure about the context yet though, as I want to be able to 
 use the same parameters for some other applications and not be 
 dependent on the developers to do configuration changes as we 
 use war files to pack the applications.

If you're specifying Resource elements that all webapps should have
access to, use GlobalNamingResources with embedded Resource elements
in server.xml and just a ResourceLink in each webapp:
http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html

If other configuration parameters are to be used for all webapps, you
can place them in conf/context.xml, and they will be picked up for all.

You can also override a Context element in a webapp's
META-INF/context.xml file with one in a
conf/Catalina/[host]/[appname].xml file.  However, this may be
overwritten during redeployment.

 - 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: [SOLVED] tomcat not able to connect to postgresql?

2008-04-10 Thread Caldarale, Charles R
 From: Dan Eriksson [mailto:[EMAIL PROTECTED] 
 Subject: [SOLVED] tomcat not able to connect to postgresql?
 
   Host name=myapp.mydomain.com appBase=webapps/myapp
 unpackWARs=true autoDeploy=true
 xmlValidation=false xmlNamespaceAware=false
 Context path= docBase= debug=0 reloadable=true

You may have fixed your DB access issue, but the above config contains a
serious problem that will likely bite you in the future.  A docBase
attribute (explicit or implicit) must never be empty; in your case it's
the same as the Host appBase, which creates serious internal grief for
Tomcat.  The proper setting would be appBase=webapps and
docBase=myapp.

The above also places the Context element in server.xml, which has
been strongly discouraged for several years, and shouldn't be used by
any current implementation.  Since you apparently want this webapp to be
the default one, it should be located in webapps/ROOT, not
webapps/myapp, and the Context element should be in
webapps/ROOT/META-INF/context.xml, without the path and docBase
attributes.

 - 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]



[SOLVED] tomcat not able to connect to postgresql?

2008-04-09 Thread Dan Eriksson
Hi Gabe,
Thanks for the fast answer!

-Original Message-
From: Gabe Wong [mailto:[EMAIL PROTECTED]
Sent: Thu 4/10/2008 4:29 AM
To: Tomcat Users List
Subject: Re: tomcat not able to connect to postgresql?
 
Dan Eriksson wrote:
 If I try to connect to my vhost now everything looks ok, no errors anywhere, 
 but when I try to login I get a message that the database is not online and 
 in my logfile I see this:

 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of 
 class '' for connect UR
   
Dan,
This has been discussed many times before. Usually adding the database 
driver to $TOMCAT_HOME/lib or $TOMCAT_HOME/common/lib
solves the problem.
Also further information maybe found at the following URL from the 
mailing list archive, which is a good way to search for previously 
discussed issues and solutions:
http://marc.info/?l=tomcat-userm=119454595817475w=2

Indeed, I missed that one.
Adding everything from my lib dir to common/lib didn't solve it though.

I went through the documentation again,
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations
Under the postgresql there are two different configurations, first a generic 
resource that can be shared, which was what I was trying, and one that is 
specific resource per vhost.
I re-made the configuration to be specific per vhost instead, so my vhost 
configuration looked like this instead:

  Host name=myapp.mydomain.com appBase=webapps/myapp
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false

Context path= docBase= debug=0 reloadable=true
Resource
  name=jdbc/springmobil_db
  type=javax.sql.DataSource
  password=mypasswd
  driverClassName=org.postgresql.Driver
  maxIdle=2
  maxWait=5000
  validationQuery=SELECT 1
  username=myapp
  url=jdbc:postgresql://10.10.120.80/myapp_db
  maxActive=4/
/Context
Valve className=org.apache.catalina.valves.AccessLogValve
 directory=logs  prefix=vaxeladmin_access_log. suffix=.txt
 pattern=common resolveHosts=false/
  /Host

After doing this it started to work as it should.

But if someone can explain why the generic resource didn't work it would be 
greatly appreciated!

Best regards,
Dan

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]