This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

Grails 2.0.4 Oracle in STS - driver not found (though it's in the build path)Page Title Module

Grails 2.0.4 Oracle in STS - driver not found (though it's in the build path)

Oct 4th, 2012, 12:42 PM

I was building a new Grails application with 2.0.4 (it's been a couple of years since I've done this) and I keep getting an error running an Integration test for a service class. It's telling me that the OracleDriver class is not found. I've added ojdbc14.jar to the /lib directory, added it to the Libraries in the build path, and have the following DataSource.groovy

I've create an integration test for the service, and when (in STS) I run tests with test-app, I get the classic "Cannot load JDBC driver class 'oracle.jdbc.OracleDriver" error. I expect this when I don't have the jar in the /lib directory, or haven't added that to the build path. I've done all this before, and either something has changed, or I'm missing something easy.

Run "grails compile --refresh-dependencies". Putting jars in the lib directory is still supported (although adding dependencies in BuildConfig.groovy is the preferred approach) but they're not auto-discovered.

Comment

Run "grails compile --refresh-dependencies". Putting jars in the lib directory is still supported (although adding dependencies in BuildConfig.groovy is the preferred approach) but they're not auto-discovered.

Burt,

I did that, from the STS command prompt, and that didn't work. BuildConfig.groovy uses Mavenish style, but how would I add a dependency to a local file (/lib/ojdbc.jar)? I'll put it in there.

Brian

Comment

The STS classpath is derived from the Grails classpath; run Project | Grails Tools | Refresh Dependencies to sync up STS and Grails. Try doing this outside of the IDE to reduce the number of concurrent variables, then get STS working.

Comment

None of those suggestions has made a difference. I did a refresh-dependencies from the command line, and from STS and I still get the same error. When I look at the classpath section in STS I see the JRE System Library, the Grails Dependencies, and the Groovy DSL support, but the /lib directory and that jar are missing.

Comment

Can I configure this from BuildConfig.groovy? How would I add this jar to it, since it's not Mavenish?

Ok, I added the following line to my BuildConfig.groovy:

Code:

runtime 'com.oracle:ojdbc14:10.2.0.1.0'

I set the log level to 'warn' and ran the test again. I saw one of the places was the location of the jars in the /dist directory under the grails-2.0.4 product directory. I copied the jar file there, and then ran the test again. The original error no longer occurs; instead there's a new error:

I guess we're getting somewhere... Much of this wouldn't be a problem if I could get to Maven repositories outside of our network. They recently cut us off, and put a Nexus instance inside the org, but with a minimum set of projects/jars. If you want one that they don't have, you have to submit a request to a committee that decides if your request is valid. Then you wait.