2015-05-21 2 views
0

Я использовал tomcat 7.0.54, и мое веб-приложение работало должным образом. Когда я переключился на tomcat 8.0.22, я не смог запустить приложение. я получил следующее на выходе Tomcat 8:Элемент ресурса в context.xml исключает исключения в Tomcat 8

org.apache.catalina.deploy.NamingResourcesImpl.cleanUp Failed to retrieve JNDI naming context for container [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testTomcat]] so no cleanup was performed for that container 
javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp]. 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:818) 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:166) 
    at org.apache.catalina.deploy.NamingResourcesImpl.cleanUp(NamingResourcesImpl.java:993) 
    at org.apache.catalina.deploy.NamingResourcesImpl.stopInternal(NamingResourcesImpl.java:975) 
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) 
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5404) 
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) 
    at org.apache.catalina.manager.ManagerServlet.undeploy(ManagerServlet.java:1398) 
    at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:370) 
    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) 
    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 org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108) 
    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:614) 
    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.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) 
    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) 

21-May-2015 17:32:15.634 INFO [http-nio-8080-exec-11] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/testTomcat] 
21-May-2015 17:32:15.658 INFO [http-nio-8080-exec-12] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\tomcat\conf\Catalina\localhost\testTomcat.xml 
21-May-2015 17:32:15.662 WARNING [http-nio-8080-exec-12] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property. 
21-May-2015 17:32:15.754 SEVERE [http-nio-8080-exec-12] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testTomcat]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586) 
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:460) 
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1556) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:483) 
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) 
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 
    at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1460) 
    at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:906) 
    at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:344) 
    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) 
    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 org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108) 
    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:614) 
    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.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) 
    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.NoClassDefFoundError: Could not initialize class org.apache.tomcat.dbcp.dbcp2.BasicDataSource 
    at org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:193) 
    at org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstance(BasicDataSourceFactory.java:182) 
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94) 
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321) 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:841) 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152) 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:829) 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:166) 
    at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1084) 
    at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:663) 
    at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:256) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) 
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 42 more 

21-May-2015 17:32:15.798 SEVERE [http-nio-8080-exec-12] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:\tomcat\conf\Catalina\localhost\testTomcat.xml 
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testTomcat]] 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586) 
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:460) 
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1556) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:483) 
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) 
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 
    at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1460) 
    at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:906) 
    at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:344) 
    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) 
    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 org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108) 
    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:614) 
    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.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521) 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478) 
    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) 

Интересно, если я удалить элемент ресурса из моего файла context.xml, приложение работает без ошибок. Это файл context.xml:

<Context antiJARLocking="true" path="/testTomcat"> 

    <Resource name="jdbc/t_board" auth="Container" 
      maxActive="100" maxIdle="30" maxWait="10000" 
      username="hello" password="hellohello" 
      driverClassName="com.mysql.jdbc.Driver" 
      url="jdbc:mysql://localhost:3306/data_base?autoReconnect=true" 
      logAbandoned="true" removeAbandoned="true" 
      removeAbandonedTimeout="60" type="javax.sql.DataSource" /> 

</Context> 

Снова удаление элемента ресурса устраняет проблему. Кроме того, работает тот же элемент ресурса с tomcat версии 7.0.54. Есть ли у кого-нибудь предложения, как я могу это решить? Спасибо.

ответ

0

Я сделал следующее: 1) скопировал файл tomcat-juli.jar из каталога lib tomcat. 2) вставил этот файл jar в директорию jre \ lib \ ext JDK. 3) Добавлен эту банку файл (в Netbeans правой кнопкой мыши на папке libraries в projects, нажав на кнопку «добавить JAR/папку» и выбрав котом-juli.jar файл.

Мое приложение теперь работает.

 Смежные вопросы

  • Нет связанных вопросов^_^