因项目需要,需要在Java项目中访问 MSSQLServer 数据库,本地开发的时候,没有问题,可以正常链接数据库,通过Jenkins部署到服务器上时候,报数据库驱动未找到。

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

原因:pom.xml 的包未找到:


<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
</dependency>

解决方法:需要手工在服务器上安装一下 sqljdbc:

mvn install:install-file -Dmaven.repo.local=/newdata/jenkins/maven-repositories/0 -Dfile=sqljdbc4-4.0.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-13
  • 2022-02-12
  • 2021-05-24
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-07-09
  • 2021-07-26
相关资源
相似解决方案