Webapp won't run uder Tomcat 8.0.23

1.7k views Asked by At

I have a web App running in tomcat 7 and tomcat 6. But when I try to migrate to tomcat 8 it won't let me, there are some exceptions like this one:

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`

Here's my context file from my App:

<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"/>

I think is something about my database connection, because once I tried to do something that requires a db connection, it would send me the exception.

I'm using netbeans 8.2, working in Windows 7. I'm new working with jsp and stuff so I don't what I'm missing here. Does anyone have a solution? or do you have configuration files of tomcat 8 that I can check? I would appreciate your help.

Thank You?

1

There are 1 answers

2
David Levesque On

The error seems to happen when the connection pool tries to delegate the validation of the connection to the underlying jdbc driver. To confirm, try adding this config parameter under the Resource element of your context file:

validationQuery="select 1"

This will tell DBCP to use that validation query instead of delegating the validation. Iirc, validation was disabled by default in Tomcat 7 (DBCP 1.x) so that could explain the change in behavior.