日期:2014-05-18  浏览次数:20733 次

jar文件是不是一定要放在tomcat\common\lib目录下?
我不想把Sybase的JConnect或者MySQL的Connector/J的jar文件放置到tomcat的common\lib目录下,只想把jar文件放置在数据库服务器的安装目录下或者其他目录下,可不可以对tomcat进行配置?
刚试过了,将Sybase和MySQL的jar文件添加到classpath中去都不行!都报了出错信息,关于com.sybase.jdbc3.jdbc.SybDriver和com.mysql.jdbc.Driver出错!数据库服务器已经启动且用户名密码正确,数据库驱动放在common\lib可以,移到其他目录并在classpath中即使添加环境变量也不行!

错误信息如下:  
exception  

org.apache.jasper.JasperException:   javax.servlet.ServletException:   java.lang.ClassNotFoundException:   com.sybase.jdbc3.jdbc.SybDriver  
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:565)  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:414)  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)  
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)  
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)  


root   cause  

javax.servlet.ServletException:   java.lang.ClassNotFoundException:   com.sybase.jdbc3.jdbc.SybDriver  
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)  
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)  
org.apache.jsp.testsybase_jsp._jspService(testsybase_jsp.java:159)  
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)  
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)  
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)  
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)  


root   cause  

java.lang.ClassNotFoundException:   com.sybase.jdbc3.jdbc.SybDriver  
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355)  
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)  
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)  
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)  
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)  
java.lang.Class.forName0(Native   Method)  
java.lang.Class.forName(Class.java:164)  
org.apache.jsp.testsybase_jsp._jspService(testsybase_jsp.java:86)  
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)  
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)  
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)  
javax.servlet.http.Ht