tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jieryn (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MTOMCAT-50) add support for JNDI datasource JDBC driver jar dependencies for the run goal
Date Thu, 08 Sep 2011 14:59:09 GMT

    [ https://issues.apache.org/jira/browse/MTOMCAT-50?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100369#comment-13100369
] 

jieryn commented on MTOMCAT-50:
-------------------------------

Yah, I don't think this is something the Maven plugin ought to solve. Proper use of Maven's
dependency mechanism is the real solution here. Please close this JIRA.

> add support for JNDI datasource JDBC driver jar dependencies for the run goal
> -----------------------------------------------------------------------------
>
>                 Key: MTOMCAT-50
>                 URL: https://issues.apache.org/jira/browse/MTOMCAT-50
>             Project: Maven 2.x Tomcat Plugin
>          Issue Type: Improvement
>    Affects Versions: 1.0-beta-1
>         Environment: os x 10.6.2, java 1.6.0_17, Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
>            Reporter: Jonathan Russell
>            Priority: Minor
>
> I get a ClassNotFoundException for Oracle driver classes unless I drop the jdbc driver
jar into Java's extension directory when executing "mvn tomcat:run-war" for my project. (see
below)
> If I were using an installed tomcat instance I know I could add the jar to the /usr/local/tomcat/apache-tomcat-7.0.21/lib
directory.  I don't know if it isn't supported, or if I just haven't found good documentation
on this, but I can't get this error to go away unless I add the jar into a Java extension
directory.
> pom.xml excerpts:
>             <plugin>
>                 <groupId>org.codehaus.mojo</groupId>
>                 <artifactId>tomcat-maven-plugin</artifactId>
>                 <configuration>
>                     <path>/</path>
>                     <mode>both</mode>
>                 </configuration>
>             </plugin>
> ...
>         <dependency>
>             <groupId>com.oracle</groupId>
>             <artifactId>ojdbc14</artifactId>
>             <version>10.2.0.4.0</version>
>             <scope>runtime</scope>
>         </dependency>
> context.xml excerpt:
> <?xml version="1.0" encoding="UTF-8"?>
> <Context 
>     path="/"
>     docBase=".war"
>     debug="1"
>     reloadable="true"
>     crossContext="true"
>     >
> <Resource name="0" auth="Container" 
>         type="javax.sql.DataSource"
>         maxActive="4" maxIdle="2" maxWait="60000"
>         removeAbandoned="true" logAbandoned="true"
>         driverClassName=""
>         url=""
>         username="" password=""
>         NetworkProtocol="tcp"
>         DataSourceName="oracle.jdbc.xa.client.OracleXADataSource"
>         NativeXA="true"
>         allowLocalTransactions="true"
>         LoginTimeout="0"
>         ExplicitCachingEnabled="false"
>         ImplicitCachingEnabled="false"
>         MaxStatements="0"
>     />
> ...
> </Context>
> Stack trace:
> 	... 
> Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
> 	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
> 	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
> 	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
> 	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
> 	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
> 	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
> 	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
> 	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577)
> 	at org.hibernate.loader.Loader.doQuery(Loader.java:696)
> 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
> 	at org.hibernate.loader.Loader.doList(Loader.java:2232)
> 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
> 	at org.hibernate.loader.Loader.list(Loader.java:2124)
> 	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
> 	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
> 	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
> 	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
> 	at com.ssn.dm.service.DM.query(DM.java:616)
> 	... 48 more
> Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class
'oracle.jdbc.OracleDriver'
> 	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
> 	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
> 	at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:92)
> 	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
> 	... 62 more
> Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
> 	at java.net.URLClassLoader1.run(URLClassLoader.java:200)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
> 	at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
> 	at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
> 	at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
> 	at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
> 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:169)
> 	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
> 	... 65 more 
> I would expect that the run-war goal would have the class loader configured to load the
jdbc driver jar from a well known location (e.g. /lib) automatically, or could handle copying
the JDBC dependencies and including them in some other way based on the plugin's configuration.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message