Hello all,
Part time Java programmer. Pretty new to apache camel and spring. Been using Intellij for years but I only get to code Java maybe a few hundred hours a year.
My env
- intellij 14.1.3 on Mac OS X Yosemite
- apache camel command line application
- uses spring framework for route specifications
- maven project
- all libraries loaded via maven
- no ./lib jar files
I have a route that inserts data into an oracle table
The application works from Intellij no problem. Inserted 4,000+ records last night from intellij
When I build the artifact and run as a jar file from the command line I get
No suitable driver found for jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=ourhostname.richmond.edu)(PORT=1521)))(CONNECT_DATA=(SERVER = dedicated) (SERVICE_NAME=ourservicename.richmond.edu)))
So I tried to preload the driver with
try{ Class c = Class.forName("oracle.jdbc.OracleDriver"); log.info("success: Class.forName(\"oracle.jdbc.OracleDriver\")");}catch (ClassNotFoundException e) { log.info("Unable to load ojdbc"); log.info(e);}
I get
[ main] MyMain INFO Unable to load ojdbc
[ main] MyMain INFO java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
When I untar the jar file and search for "ojdb"
find ./ | grep ojdbc
.//ojdbc6-11.2.0.4.jar
find ./ | grep oracle
# only finds my packages with oracle in the name
If I grep for some other library I see the class files and more
find ./ | grep log4j
many lines removed for breviety
.//org/apache/log4j/xml/DOMConfigurator$1.class
.//org/apache/log4j/xml/DOMConfigurator$2.class
.//org/apache/log4j/xml/DOMConfigurator$3.class
.//org/apache/log4j/xml/DOMConfigurator$4.class
.//org/apache/log4j/xml/DOMConfigurator$5.class
.//org/apache/log4j/xml/DOMConfigurator$ParseAction.class
.//org/apache/log4j/xml/DOMConfigurator.class
.//org/apache/log4j/xml/log4j.dtd
.//org/apache/log4j/xml/Log4jEntityResolver.class
.//org/apache/log4j/xml/SAXErrorHandler.class
.//org/apache/log4j/xml/UnrecognizedElementHandler.class
.//org/apache/log4j/xml/XMLLayout.class
.//org/apache/log4j/xml/XMLWatchdog.class
.//slf4j-log4j12-1.7.12.jar
Any idea how I can fix this?