简体   繁体   中英

How to add Ojdbc jar in classpath Spring Boot Jar?

I am working on Spring boot application. I run my application via a batch file using:

java -jar -Dspring.config.additional-location=file:/config/ -Dspring.profiles.active=profile myApplication.jar
pause

This is working fine. However, I want to delete Ojdbc6 jar entry from my Pom file and define it to my classpath via a batch file, like so:

SET CLASSPATH=%CLASSPATH%ojdbc6.jar;
echo %CLASSPATH%
java -jar -Dspring.config.additional-location=file:/config/ -Dspring.profiles.active=profile myApplication.jar --classpath=%CLASSPATH%
pause

This is not working and I'm getting an error:

Unable to create initial connections of pool. 
java.sql.SQLException: Unable to load class: oracle.jdbc.OracleDriver from ClassLoader:org.springframework.boot.loader.LaunchedURLClassLoader@439f5b3d;ClassLoader:TomcatEmbeddedWebappClassLoader

  context: application name

  delegate: true

----------> Parent Classloader:

org.springframework.boot.loader.LaunchedURLClassLoader@439f5b3d

    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:292)**

Use -classpath=%CLASSPATH% instead of --classpath=%CLASSPATH%

Ref. link: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM