You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Clovis Wichoski <cl...@gmail.com> on 2008/06/19 22:03:30 UTC
when use classes that implements javax.sql.DataSource in a JDBC datasource throws an Exception at first try
Hi,
i'm using tomcat 6.0.16 and if i configure a class that implements
javax.sql.DataSource as the value of the attribute driverClassName of the
Resource element,
when the server starts, the first try to get a connection from JNDI that
fails with follow Exception:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of
class 'com.sap.dbtech.jdbcext.DataSourceSapDB' for connect URL
'jdbc:sapdb://dbserver/DBNAME'
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
... 25 more
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:264)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1143)
... 26 more
but if i try to get a JDBC connection again, always works, that exception
only occurs at first request, how can i avoid this first request Exception,
i know that i can put a .jsp file
that after start tomcat, call that .jsp, then that is my way to hide the
first request fail, but i think that this is a ugly solution, and can be
solved at tomcat side.
here is how i configured the resource in GlobalNamingResources:
<Resource name="jdbc/vendor_conces_primary"
auth="Container"
type="javax.sql.DataSource"
username="USER"
password="secret"
driverClassName="com.sap.dbtech.jdbcext.DataSourceSapDB"
url="jdbc:sapdb://dbserver/DBNAME"
maxActive="30"
maxIdle="-1"
validationQuery="SELECT NOW() FROM DBA.DUAL"
testOnBorrow="true"/>
thanks for any idea
Clóvis