我有一个在tomcat 7和tomcat 6中运行的Web应用程序。但是当我尝试迁移到tomcat 8时它不会让我,有一些像这样的例外:
javax.servlet.ServletException: La ejecución del Servlet lanzó una excepción
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:314)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at mx.com.vw.servlet.filters.StylizerFilter.doFilter(StylizerFilter.java:112)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2463)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2452)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.AbstractMethodError
at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:913)
at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:913)
at org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:226)
at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:302)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2208)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2191)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:1945)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1412)
at mx.com.vw.db.PoolDataAccessor.openConnection(PoolDataAccessor.java:50)
at mx.com.vw.kp.servlet.SemaphoreServlet.retrieve(SemaphoreServlet.java:130)
at mx.com.vw.kp.servlet.SemaphoreServlet.processRequest(SemaphoreServlet.java:57)
at mx.com.vw.kp.servlet.SemaphoreServlet.doGet(SemaphoreServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
... 23 more`
这是我的应用程序中的上下文文件:
<Resource auth="Container"
connectionProperties="autoReconnect=true;
secondsBeforeRetryMaster=20;
autoReconnectForPools=true;
cachePrepStmts=true;"
driverClassName="com.mysql.jdbc.Driver"
factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
logAbandoned="false"
maxTotal="10"
maxIdle="3"
maxOpenPreparedStatements="-1"
maxWaitMillis="-1"
name="jdbc/KPPool"
password="infOmaP78257"
poolPreparedStatements="true"
removeAbandonedOnBorrow="true"
removeAbandonedOnMaintenance="true"
removeAbandonedTimeout="30"
type="javax.sql.DataSource"
url="jdbc:mysql://myhost:3306/mybd?noAccessToProcedureBodies=true"
username="myuser"/>
<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionName="java_apps"
connectionPassword="mypass"
connectionURL="jdbc:mysql://myhost:3306/mybd"
driverName="com.mysql.jdbc.Driver"
roleNameCol="role"
userCredCol="password"
userNameCol="username"
userRoleTable="roles"
userTable="users"
localDataSource="true"
debug="99"/>
我认为这与我的数据库连接有关,因为一旦我尝试做一些需要数据库连接的事情,就会向我发送异常。
我正在使用netbeans 8.2,在Windows 7中工作。我正在使用jsp和其他东西,所以我不知道我在这里失踪了什么。有没有人有办法解决吗?或者你有tomcat 8的配置文件我可以查看吗?我很感激你的帮助。
谢谢?
答案 0 :(得分:2)
当连接池尝试将连接验证委托给底层jdbc驱动程序时,似乎会发生错误。要确认,请尝试在上下文文件的Resource
元素下添加此配置参数:
validationQuery="select 1"
这将告诉DBCP使用该验证查询而不是委派验证。 Iirc,默认情况下在Tomcat 7(DBCP 1.x)中禁用了验证,因此可以解释行为的变化。
答案 1 :(得分:0)
当我将tomcat7升级到tomcat8.5时,我遇到了同样的问题。我回答了这个问题,请检查以下链接,它可能可以解决您的问题。
Tomcat 8, axis2 webservices aar, spring jndi not bound in context