Reputation: 145
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>
Upvotes: 0
Views: 1049
Reputation: 159086
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.
Upvotes: 1