Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat 5.5.9 admin and Datasources

 
Vinicius Carvalho
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic