ClassNotFoundException:com.microsoft.sqlserver.jdbc [英] ClassNotFoundException: com.microsoft.sqlserver.jdbc
问题描述
当我在Eclipse IDE下运行我的Web应用程序时,一切正常。
但是当我将项目导出到war-file并在tomcat中部署时,我得到以下消息:
When I ran my web application under Eclipse IDE everything worked fine. But when I exported my project into war-file and deployed in tomcat I've got following message:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc
我试过把sqljdbc4.jar放到各处:
I've tried putting sqljdbc4.jar everywhere:
- catalina-home \lib dir
- WEB-INF \lib dir
- 他们两人
我缺少什么?
环境:tomcat 6.0.20,sql server 2005
What I'am missing? Environment: tomcat 6.0.20, sql server 2005
推荐答案
您的驱动程序类名称是错的。异常文本指向包,而不是实际的驱动程序类。并且不要忘记在更改各种lib目录的内容后重新启动Tomcat。
Your driver class name is wrong. The exception text points to a package, not an actual driver class. And don't forget to restart Tomcat after changing the contents of various lib directories.
编辑:您的IDE可能使用与部署不同的配置战争。或者以静默方式失败但是驱动程序本身已经通过其他方式加载 - 然后实际连接才起作用。
Your IDE might use different configuration than your deployed war. Or fail with the same exception silently but the driver itself was already loaded by other means - then the actual connection just works.
这篇关于ClassNotFoundException:com.microsoft.sqlserver.jdbc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!