在tomcat 7中部署war文件时出错

时间:2011-07-13 18:43:40

标签: tomcat7

大家好,并提前感谢您的帮助。

我有一个war文件,我正在尝试使用tomcat 7进行部署。此war文件名为ROOT.war,位于$ TOMCAT_HOME / webapps下。我还在$ TOMCAT_HOME / conf下有2个xml文件(server.xml和web.xml)。运行以下cmd时出现以下错误:catalina.sh run

  

2011年7月13日下午2:16:23 org.apache.catalina.core.StandardContext filterStart   SEVERE:异常启动过滤器LogFilter   java.lang.IllegalArgumentException:属性'dataSource'是必需的           在org.springframework.jdbc.support.JdbcAccessor.afterPropertiesSet(JdbcAccessor.java:134)           在org.springframework.jdbc.core.JdbcTemplate。(JdbcTemplate.java:141)           在org.springframework.jdbc.core.simple.SimpleJdbcTemplate。(SimpleJdbcTemplate.java:61)           在com.osi.ospoint.web.filter.LogFilter.init(LogFilter.java:92)           在org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)           在org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)           在org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)           在org.apache.catalina.core.ApplicationFilterConfig。(ApplicationFilterConfig.java:98)           在org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4562)           在org.apache.catalina.core.StandardContext $ 2.call(StandardContext.java:5240)           在org.apache.catalina.core.StandardContext $ 2.call(StandardContext.java:5235)           at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:303)           在java.util.concurrent.FutureTask.run(FutureTask.java:138)           at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886)           at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:908)           在java.lang.Thread.run(Thread.java:662)   2011年7月13日下午2:16:23 org.apache.catalina.core.StandardContext startInternal   严重:错误filterStart   2011年7月13日下午2:16:23 org.apache.catalina.core.StandardContext startInternal   严重:由于先前的错误,Context []启动失败

我的server.xml摘录

<?xml version='1.0' encoding='utf-8'?>
<Server port="8000" shutdown="shutdown">
<!-- firewall friendly jconsole remote access via service:jmx:rmi://<hostname>:802/jndi/rmi://<hostname>:8015/jmxrmi using credentials defined in the jmx files -->
    <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="8015" rmiServerPortPlatform="8020" />
    <Listener className="org.apache.catalina.core.JasperListener" />
    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
    <!-- define a datasource that is used for the web app deployed here -->
    <!-- we decided to move this into the server.xml not in context.xml for reduction of config files -->

    <Service name="some-service">
      <Executor name="some-thread-pool" namePrefix="some-thread-pool-" maxThreads="150" minSpareThreads="10" maxIdleTime="10000"/>
      <Connector address="127.0.0.1" port="8005" protocol="AJP/1.3" redirectPort="8443" executor="some-thread-pool"/>
      <Connector address="127.0.0.1" port="8080" protocol="HTTP/1.1"connectionTimeout="20000" redirectPort="8443" executor="some-thread-pool"/>   
      <!-- jvmRoute attribute on Engine tag not needed if apache is configured to provide this -->
      <Engine name="some-engine" defaultHost="some-host">
      <!--  <Host name="study-development-host"  appBase="webapps" unpackWARs="true" autoDeploy="true"/> -->
      <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true"/>
      <Context docBase="ROOT" path="/ROOT" />
      <WatchedResource>WEB-INF/web.xml</WatchedResource>
      <Manager pathname="" />
      <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
      <!-- <property name="dataSource"></property> -->
     </Engine>
    </Service>

上面的错误消息指向LogFilter但引发了异常,因为属性dataSource未在任何地方定义/存在。我不明白这应该是什么意思。男孩,对此的任何帮助将不胜感激。

布兰妮

1 个答案:

答案 0 :(得分:0)

您似乎正在使用spring进行数据库连接。你能添加你的弹簧配置或bean定义吗?

另外,你应该看一下Spring JDBC docs。看来你没有为Spring指定一个数据源,它正在抱怨你。那些文档解释了如何给Spring一个数据源。