简体   繁体   中英

com.microsoft.sqlserver.jdbc.SQLServerDriver class not found exception (NEW)

Now I am working with Microsoft SQLserver jdbc connectivity when I try to define class.forname

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

error occurs, everything else is fine, but I dint have any idea about this error.

pom.xml:

<dependency>
  <groupId>com.microsoft.sqlserver</groupId>
  <artifactId>sqljdbc4</artifactId>
  <version>4-2.0</version>
  <scope>system</scope>
  <systemPath>D:\my current work(please backup this folder)\backup\12-15-2016\milma_jishnu/src/main/lib/sqljdbc4-2.0.jar</systemPath>
</dependency>

Quoting Maven documentation :

System Dependencies

Important note: This is marked deprecated.

Dependencies with the scope system are always available and are not looked up in repository. They are usually used to tell Maven about dependencies which are provided by the JDK or the VM. Thus, system dependencies are especially useful for resolving dependencies on artifacts which are now provided by the JDK, but where available as separate downloads earlier. Typical example are the JDBC standard extensions or the Java Authentication and Authorization Service (JAAS).

So, <scope>system</scope> tells Maven: This is already present, you don't need to do anything.

Ergo, it is not added to the classpath, and you wonder why it's not there?

Seems you misunderstood the purpose of <scope>system</scope> . Don't use it, because the MS SQL JDBC driver is not part of the JDK.

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