This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tomcat 5.5.9 admin and Datasources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 5.5.9 admin and Datasources" Watch "Tomcat 5.5.9 admin and Datasources" New topic
Author

Tomcat 5.5.9 admin and Datasources

Vinicius Carvalho
Ranch Hand

Joined: Dec 07, 2004
Posts: 61
Hello there! Back on 4.x era, I always had my datasources configured through the admin console. Now that it's gone from basic distribution on 5.5, I've downloaded and installed it, but when I save a datasource, when the server re-starts it vanish from there. It's not saving the datasource. Well, so I tried the old way, putting it on the server.xml:


And my hibernate.cfg.xml has this line:
<property name="connection.datasource">java:comp/env/jdbc/tcrud</property>

But I'm getting an error:
FATAL main org.hibernate.connection.DatasourceConnectionProvider - Could not find datasource: java:comp/env/jdbc/tcrud
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

Any ideas?

Regards

Vinicius
Vinicius Carvalho
Ranch Hand

Joined: Dec 07, 2004
Posts: 61
Ok I fixed it, and got in another nightmare.
A few months ago I gave up on tomcat 5.x datasource configuration (it's a pain configuring it, this is one lesson the guys from tomcat should take from jboss group). Everthing I've done, searched the web I always get the:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
error.

So I found spring which would manage my ds pools and everthing was OK I didnt need tomcat 5.x ds support (or the lack of it). Now the nightmare begins once again...
I've read : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html
I do have my driver on common/lib folder
And yet, it simply does not work.
I know ppl use datasource + tomcat, could someone help me out with this?

Ps: I havent fixex the "don't save the datasource" problem. I've just put the <context> inside server.xml

Thanks all
Vinicius Carvalho
Ranch Hand

Joined: Dec 07, 2004
Posts: 61
Fixed
Ok, I love tomcat, but I really would like to kill someone for this:

It seems that the order of the params matter and what's worse: only through this I could accomplish:
<Resource
type="javax.sql.DataSource"
auth="Container"
name="jdbc/tcrud"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="root"
password=""
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/tcrud?autoReconnect=true"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
/>
Resource params does not work as nested properties

Shame on you tomcat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 5.5.9 admin and Datasources
 
Similar Threads
JDBC-CONNECTION POOL
connector/J with my SQL.. Driver fails to load!
tomcat hibernate
db connection pooling to mssql from Tomcat 4.0.6
Tomcat DataSource