当我尝试在tomcat 7上部署并运行war文件时,我收到了以下错误..
2011-04-15 16:53:42 Commons Daemon procrun stderr initialized
Apr 15, 2011 4:53:43 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\oracle\oracle\product\10.2.0\client_1\bin;C:\oracle\ora10g\instantclient;C:\oracle\ora10g\bin;C:\oracle1\ora10g;C:\Perl\Bin;C:\Perl\5.8.1\Bin\MSWin32-x86-multi-thread;C:\Perl\5.8.1\Bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\WINZIP;C:\Program Files\WINZIP;C:\Program Files\Mono-1.2.5.1\bin;C:\Program Files\Java\jdk1.5.0_14\bin;C:\Program Files\Java\jre1.5.0_14\bin;C:\Program Files\apache-ant-1.6.5\bin;C:\Program Files\Apache Software Foundation\Tomcat 5.0\bin;C:\Program Files\cvsnt;C:\Program Files\Windows Imaging\;C:\Program Files\YourKit Java Profiler 7.5.11\bin\win32;C:\Program Files\YourKit Java Profiler 9.5.4\bin\win32;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\GnuWin32\bin;C:\CServer\lib\windows
Apr 15, 2011 4:53:44 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Apr 15, 2011 4:53:44 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Apr 15, 2011 4:53:45 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Apr 15, 2011 4:53:45 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3192 ms
Apr 15, 2011 4:53:45 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 15, 2011 4:53:45 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
Apr 15, 2011 4:53:45 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor webdatasinkserver.xml from C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\Catalina\localhost
Apr 15, 2011 4:53:45 PM org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\webdatasinkserver inside the host appBase has been specified, and will be ignored
Apr 15, 2011 4:53:52 PM org.apache.catalina.core.NamingContextListener addResource
WARNING: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: com.ncr.passport.webdatasink.servers.tomcat.dbcp.NcrDataSourceFactory]
Apr 15, 2011 4:53:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Apr 15, 2011 4:53:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
Apr 15, 2011 4:53:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
Apr 15, 2011 4:53:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Apr 15, 2011 4:53:59 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Apr 15, 2011 4:53:59 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8443"]
Apr 15, 2011 4:53:59 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Apr 15, 2011 4:53:59 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 13377 ms
ava:45)
at com.ncr.passport.webdatasinkserver.web.datasink.server.model.ClientMonitoring.refresh(ClientMonitoring.java:125)
at com.ncr.passport.webdatasinkserver.web.daemon.KeepAliveTask.doTask(KeepAliveTask.java:34)
at com.ncr.passport.webdatasinkserver.web.daemon.DaemonTask.run(DaemonTask.java:94)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.FileNotFoundException
at com.ncr.passport.cswe.receive.persist.hibernate.CSHibernateUtility.getSessionFactory(CSHibernateUtility.java:77)
... 10 more
stdout中的错误
["http-bio-8443"-exec-3][2011-04-15 17:13:50,840][FATAL][persist.hibernate.HibernateUtility] : Fatal Exception Occured: Method [static Initializer] Class [com.ncr.passport.persist.hibernate.HibernateUtility] Exception [org.hibernate.HibernateException: Could not find datasource] org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)com.ncr.passport.cswe.receive.persist.hibernate.CSHibernateUtility.getSessionFactory(CSHibernateUtility.java:114)com.ncr.passport.cswe.receive.persist.hibernate.CSHibernateUtility.currentSession(CSHibernateUtility.java:49)com.ncr.passport.cswe.receive.persist.hibernate.CSHibernatePersistenceManager.beginTransaction(CSHibernatePersistenceManager.java:69)com.ncr.passport.cswe.receive.persist.CSPersistenceManager.beginTransaction(CSPersistenceManager.java:15)com.ncr.passport.cswe.receive.persist.service.CSPersistServices.startService(CSPersistServices.java:67)com.ncr.passport.cswe.receive.itemprocessing.service.impl.DataSinkControlServicesImpl.findAll(DataSinkControlServicesImpl.java:71)com.ncr.passport.cswe.receive.itemprocessing.service.DataSinkControlServices.findAll(DataSinkControlServices.java:63)com.ncr.passport.webdatasinkserver.web.datasink.server.model.DataSinkServerControl.clear(DataSinkServerControl.java:178)com.ncr.passport.webdatasinkserver.web.datasink.server.servlets.DataServlet.init(DataServlet.java:224)javax.servlet.GenericServlet.init(GenericServlet.java:160)org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1189)org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:813)org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)java.lang.Thread.run(Thread.java:662)
["http-bio-8443"-exec-4][2011-04-15 17:14:20,965][FATAL][hibernate.connection.DatasourceConnectionProvider] : Could not find datasource: java:/comp/env/jdbc/NCRSQLATMDS
javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: com.ncr.passport.webdatasink.servers.tomcat.dbcp.NcrDataSourceFactory]
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:84)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:826)
at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
at com.ncr.passport.cswe.receive.persist.hibernate.CSHibernateUtility.getSessionFactory(CSHibernateUtility.java:114)
at com.ncr.passport.cswe.receive.persist.hibernate.CSHibernateUtility.currentSession(CSHibernateUtility.java:49)
at com.ncr.passport.cswe.receive.persist.hibernate.CSHibernatePersistenceManager.beginTransaction(CSHibernatePersistenceManager.java:69)
at com.ncr.passport.cswe.receive.persist.CSPersistenceManager.beginTransaction(CSPersistenceManager.java:15)
at com.ncr.passport.cswe.receive.persist.service.CSPersistServices.startService(CSPersistServices.java:67)
at com.ncr.passport.cswe.receive.itemprocessing.service.impl.DataSinkControlServicesImpl.findAll(DataSinkControlServicesImpl.java:71)
at com.ncr.passport.cswe.receive.itemprocessing.service.DataSinkControlServices.findAll(DataSinkControlServices.java:63)
at com.ncr.passport.webdatasinkserver.web.datasink.server.model.DataSinkServerControl.clear(DataSinkServerControl.java:178)
at com.ncr.passport.webdatasinkserver.web.datasink.server.servlets.DataServlet.init(DataServlet.java:224)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1189)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:813)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: com.ncr.passport.webdatasink.servers.tomcat.dbcp.NcrDataSourceFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:82)
相同的应用程序在没有任何修改的情况下在tomcat 6上正常工作..
当我部署战争时,tomcat 7没有将上下文文件复制到catlina / localhost,因此手动复制它,但这也没有帮助.. 日志中的classnotfounderror来自资源文件。
我的server.xml文件没有其他默认修改,除了8080和8443端口打开
答案 0 :(得分:3)
虽然你解决了这个问题,但我会解释它为什么会发生 - 你的安装有一些配置和先决条件在新安装中都没有达到。
这就是为什么应用程序所需的所有.jar文件都应放在WEB-INF/lib
中,除非完全必要。此外,我通常在存储库中提交server.xml
,以便我知道在成功运行之前必须对给定环境(开发/生产)进行修改。