1

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver> When connecting a SQL server through Selenium webdriver(eclipseIDE), running as a background window service(although connection is a success in the foreground)

OS:Window server 2012.... sqljdbc4-2.0.jar path is included in the classpath..... Window Firewall is off..... Running a batch file as a window service which is calling a testng.xml to execute classes.....Even tried by including the sqljdbc4-2.0.jar path in PATH(system environment variable)....

1 Answers1

0

I have just resolved it : the java package should contain all the external libraries. I had a ANT based framework in which all external jars were referred from lib folder(present within the package)

But there was one jar(sqljdbc4-2.0.jar)for which I gave the reference from some other package, and this created the issue.

Michaël Azevedo
  • 3,874
  • 7
  • 31
  • 45
  • 1
    You should include further informations about the resolution of your problems in order to help people who will face it later. – Michaël Azevedo Apr 08 '16 at 06:46
  • Your java package should contain all the external libaries....I had a ANT based framework in which all external jars were referred from lib folder(present within the package).....There was one jar(sqljdbc4-2.0.jar )for which i gave the reference from some other package......and because of it I was having this issue – tanuj kUMAR Apr 08 '16 at 09:53
  • I've edited your answer to include your comment. You should mark this answer as valid now :) – Michaël Azevedo Apr 08 '16 at 11:40
  • Thanks @MichaëlAzevedo – tanuj kUMAR Apr 08 '16 at 12:28