在tomcat 7中部署war文件时出错
大家好,提前感谢您的帮助。
我有一个正在尝试使用 tomcat 7 进行部署的 war 文件。该 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 严重:启动过滤器 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) 在 java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 在 java.util.concurrent.FutureTask.run(FutureTask.java:138) 在 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) 七月 13, 2011 2:16:23 PM org.apache.catalina.core.StandardContext startInternal 严重:过滤器启动错误 七月 13, 2011 2:16:23 PM org.apache.catalina.core.StandardContext startInternal 严重:由于之前的错误,上下文 [] 启动失败
我的 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 未在任何地方定义/存在而引发异常。我不明白这是什么意思。男孩们,对此的任何帮助将不胜感激。
布兰妮
Hi all and thank you in advance for your help.
I have a war file that i'm trying to deploy using tomcat 7. This war file is named ROOT.war and is located under $TOMCAT_HOME/webapps. I also have 2 xml files (server.xml & web.xml) under $TOMCAT_HOME/conf. I get the following error when i run the following cmd: catalina.sh run
Jul 13, 2011 2:16:23 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter LogFilter
java.lang.IllegalArgumentException: Property 'dataSource' is required
at org.springframework.jdbc.support.JdbcAccessor.afterPropertiesSet(JdbcAccessor.java:134)
at org.springframework.jdbc.core.JdbcTemplate.(JdbcTemplate.java:141)
at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.(SimpleJdbcTemplate.java:61)
at com.osi.ospoint.web.filter.LogFilter.init(LogFilter.java:92)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:98)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4562)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5240)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5235)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at 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)
at java.lang.Thread.run(Thread.java:662)
Jul 13, 2011 2:16:23 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
Jul 13, 2011 2:16:23 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
Excerpt of my 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>
The error msg above is pointing to LogFilter but the exception is raised cuz the property dataSource is not defined/present anywhere. I'm not understanding what this supposed to mean. Boys, any help on this will be greatly appreciated.
Britney
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您正在使用 spring 进行数据库连接。你能添加你的 spring 配置或 bean 定义吗?
另外,您可能应该看看 Spring JDBC 文档。看来您没有为 Spring 指定数据源,它正在向您抱怨。这些文档解释了如何为 Spring 提供数据源。
It appears that you're using spring for the database connection. Could you add your spring configuration or bean definition?
Also, you should probably take a look at the Spring JDBC docs. It appears that you're not specifying a datasource for Spring and it's complaining at you. Those docs explain how to give Spring a datasource.