You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Propes, Barry L " <ba...@citi.com> on 2010/03/01 18:43:31 UTC

RE: DB connection error -Tomcat 6 config

Yes, I believe that is indeed getting created.

Should that be being done by Tomcat? Or prevented by some configuration on my end?

 

-----Original Message-----
From: Felix Schumacher [mailto:felix.schumacher@internetallee.de] 
Sent: Friday, February 26, 2010 12:37 AM
To: Tomcat Users List
Subject: RE: DB connection error -Tomcat 6 config

Hi,

have you checked, that no context file for your webapp exists in conf/Catalina/localhost? The file would be named like your webapp but ending with .xml.
So if your webapp is called foo. The file would be conf/Catalina/localhost/foo.xml.
Another thing with filenames. You called your context file META-INF/context.xml but your web.xml webapps/WEB-INF/web.xml. beware that both directories META-INF and WEB-INF are located inside your webapp. Keeping the foo examples, they would be sitting in webapps/foo.

Bye
 Felix


"Propes, Barry L" <ba...@citi.com> schrieb:

>Sorry for the delay - supplying both my META-INF/context.xml and webapps/WEB-INF/web.xml contents.
>
>
>Should be noted: for the factory type in the params below, I tried both 
>factory="org.apache.commons.dbcp.BasicDataSourceFactory" and 
>factory="org.apache.dbcp.BasicDataSourceFactory", each to no avail.
>
>I removed the commons ref to test out since there's no commons/lib dir 
>in TC 6.0.24, unlike in TC 4.1.31
>
>Please apprise if the error is glaring here and I just can't see it. That's certainly possible!
>
>Thanks, Chuck.
>
>
>context.xml in META-INF fldr
>---------<?xml version="1.0" encoding="UTF-8"?>
><!--
>  Licensed to the Apache Software Foundation (ASF) under one or more
>  contributor license agreements.  See the NOTICE file distributed with
>  this work for additional information regarding copyright ownership.
>  The ASF licenses this file to You under the Apache License, Version 
>2.0
>  (the "License"); you may not use this file except in compliance with
>  the License.  You may obtain a copy of the License at
>
>      http://www.apache.org/licenses/LICENSE-2.0
>
>  Unless required by applicable law or agreed to in writing, software  
> distributed under the License is distributed on an "AS IS" BASIS,  
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  See the License for the specific language governing permissions and  
> limitations under the License.
>-->
><Context>
>  <!-- omitting - factory="oracle.jdbc.pool.OracleDataSourceFactory" 
>below--> <Resource name="jdbc/myoracle"
>auth="Container" 
>type="javax.sql.DataSource"
>factory="org.apache.commons.dbcp.BasicDataSourceFactory"
> maxActive="125" 
> maxIdle="15" 
> maxWait="7000"
> removeAbandoned="true"
> removeAbandonedTimeout="30"
> logAbandoned="true"
>username="user_name" 
>password="pass_word" 
>driverClassName="oracle.jdbc.OracleDriver"
>url="jdbc:oracle:thin:@159.177.102.100:1526:MYSID"
>minEvictableIdleTimeMillis="5000"
>timeBetweenEvictionRunsMillis = "10000"
>testWhileIdle="true"
>/>
></Context>
>
>
>in webapps/WEB-INF/web.xml
>
><resource-ref>
><description>My Ora datasource</description> 
><res-ref-name>jdbc/myoracle</res-ref-name>
><res-type>javax.sql.DataSource</res-type>
><res-auth>Container</res-auth>
></resource-ref>
>
>-----Original Message-----
>From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>Sent: Tuesday, February 23, 2010 5:53 PM
>To: Tomcat Users List
>Subject: RE: DB connection error -Tomcat 6 config
>
>If you don't mind, post your <Context> element again.  The error message indicates something doesn't match between what your JSP/servlet is requesting and what's registered via the <Resource> element.
>
> - Chuck
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>

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


RE: DB connection error -Tomcat 6 config

Posted by "Propes, Barry L " <ba...@citi.com>.
 

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Monday, March 01, 2010 12:32 PM
To: Tomcat Users List
Subject: RE: DB connection error -Tomcat 6 config

> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Subject: RE: DB connection error -Tomcat 6 config
> 
> Yes, I believe that is indeed getting created.
> 
> Should that be being done by Tomcat?

     >>Yes, the <Context> element is copied from the webapp to conf/Catalina/[host]/[appName].xml when the webapp is first deployed.  If you replace the
     >>webapp without undeploying it first, you should also delete the [appName].xml file; otherwise, Tomcat treats it as something placed there by the 
     >>administrator to override the one packaged with the webapp.

 - Chuck



Ok, I gotcha.

Still having some issues, though I did as you'd advised here above.

Seems that if I source the factory as oracle.jdbc.pool.OracleDataSourceFactory" I get an error stating 

SEVERE: Null component Catalina:type=DataSource,path=/murach,host=localhost,clas
s=javax.sql.DataSource,name="jdbc/myoracle"
Mar 1, 2010 12:48:57 PM org.apache.catalina.startup.HostConfig deployDirectory

And if I source it as I then get a different error stating   
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not crea
te resource factory instance [Root exception is java.lang.ClassCastException: or
g.apache.tomcat.dbcp.dbcp.BasicDataSource cannot be cast to javax.naming.spi.Obj
ectFactory]

This upon startup, when I simply start up Tomcat. 

Had the context element in my META-INF/context.xml file (of the webapp) and whether or not I specify a resource-ref element in the web.xml doc.

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


RE: DB connection error -Tomcat 6 config

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Subject: RE: DB connection error -Tomcat 6 config
> 
> Yes, I believe that is indeed getting created.
> 
> Should that be being done by Tomcat?

Yes, the <Context> element is copied from the webapp to conf/Catalina/[host]/[appName].xml when the webapp is first deployed.  If you replace the webapp without undeploying it first, you should also delete the [appName].xml file; otherwise, Tomcat treats it as something placed there by the administrator to override the one packaged with the webapp.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org