Suddenly lost the ability to resolve the oracle jar - need help with maven.

250 views
Skip to first unread message

Simon

unread,
Aug 22, 2010, 7:24:42 AM8/22/10
to mybatis-user
So the project has been running find for 2 months in elipse. Then
yesterday for some unknown reason, tomcat in eclipse started saying:

org.apache.ibatis.datasource.DataSourceException: Error setting driver
on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: Cannot
find class: oracle.jdbc.driver.OracleDriver
at
org.apache.ibatis.datasource.unpooled.UnpooledDataSource.initializeDriver(UnpooledDataSource.java:
179)
at
org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:
57)
at
org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:
349)
at
org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:
55)
at
org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromDataSource(DefaultSqlSessionFactory.java:
72)
at
org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSession(DefaultSqlSessionFactory.java:
32)

Now nothing changed between it working and not working, the only thing
I did was restart the eclipse tomcat using eclipse, something I have
done thousands of times without problem.

If I look in the eclipse workspace under ge-api/target/ge-api/WEB-INF/
lib, I see ojdbc6-11.1.0.jar no problem.

I tried the usual: clean and rebuild in eclipse, redeploy, mvn clean
and mvn intstall etc. no luck.

In my project core project I have this (not changed since adding some
months ago)

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.1.0</version>
</dependency>

And in my local .m2 repository I have this:
com/oracle/ojdbc6/11.1.0/ojdbc6-11.1.0.jar with a modification date of
2 months ago (when I added it to the repository.

In the eclipse server tab, I have:
Tomcat
|-ge-api
|-ge-core
|-ojdbc6-11.1.0.jar
|-testng-5.12.1.jar

So tomcat knows about the jar (although I have no idea how Maven tells
tomcat where to find it).

currently I cant build the project using mvn install, as it doesnt
package the mybatis.xml (and if I put it in resources, eclipse doesnt
know about it).

ge-api is the webapp, and ge-core is the sibling project which has the
mybatis stuff in it.

All th projects were created using a maven archetype though eclipse.

Any ideas where to look for the problem? I dont know how to debug
maven when it goes wrong.


Simon

unread,
Aug 26, 2010, 8:58:01 AM8/26/10
to mybatis-user
I found a solution.

I was manually adding the oracle jar to my local .m2 repo thusly:

mvn install:install-file -Dfile=ojdbc6-11.1.0.jar -Dpackaging=jar\ -
DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.1.0

This worked find for a while, but then mvn started winging that it
could not find the jar, even though its sitting quite happily in the
local .m2 repo in the correct location.

However, If you add "-DgeneratePom=true", the problem goes away (at
least for today). i.e.

mvn install:install-file -Dfile=ojdbc6-11.1.0.jar -Dpackaging=jar\
-DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.1.0 -
DgeneratePom=true

Simon.
Reply all
Reply to author
Forward
0 new messages