首页 新闻 搜索 专区 学院

struts2+spring+mybatis启动报错

0
悬赏园豆:80 [已解决问题] 解决于 2013-01-18 13:29

2013-01-15 11:31:47,201 ERROR (org.apache.struts2.dispatcher.Dispatcher:38) - Dispatcher initialization failed
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
 at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
 at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
 at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:507)
 at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:517)
 at com.opensymphony.xwork2.inject.ContainerImpl$9.call(ContainerImpl.java:548)
 at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
 at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:546)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:197)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
 at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
 at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

问题补充:

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <welcome-file-list>
  <welcome-file>login!login</welcome-file>
 </welcome-file-list>
 <context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>/WEB-INF/classes/applicationContext.xml</param-value> 
</context-param> 
 
<listener> 
       <listener-class> 
           org.springframework.web.context.ContextLoaderListener 
       </listener-class> 
</listener> 
 
 <filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
  </filter-class>
 </filter>
 <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <mime-mapping>
  <extension>xls</extension>
  <mime-type>application/x-excel</mime-type>
 </mime-mapping>
 <mime-mapping>
  <extension>xslx</extension>
  <mime-type>application/x-excel</mime-type>
 </mime-mapping> 
</web-app>

 

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans
 xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 <!--配置数据源  -->
 <bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName">
   <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
  </property>
  <property name="url">
   <value>jdbc:sqlserver://192.168.4.326:1433;DatabaseName=ZSK</value>
  </property>
  <property name="username">
   <value>erp</value>
  </property>
  <property name="password">
   <value>erp</value>
  </property>
 </bean>
 
 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> 
     <property name="configLocation" value="classpath:com/elane/zsk/mybatis/mybatis-config.xml" /> 
     <property name="dataSource" ref="dataSource" /> 
 </bean>
 <bean id="topm" class="org.mybatis.spring.mapper.MapperFactoryBean"> 
       <property name="mapperInterface" value="com.elane.zsk.mybatis.config.TopicMapper"/> 
       <property name="sqlSessionFactory" ref="sqlSessionFactory" /> 
   </bean> 
 <bean id="fipm" class="org.mybatis.spring.mapper.MapperFactoryBean"> 
       <property name="mapperInterface" value="com.elane.zsk.mybatis.config.FileUploadMapper"/> 
       <property name="sqlSessionFactory" ref="sqlSessionFactory" /> 
   </bean> 
 <bean id="topdao" class="com.elane.zsk.dao.topic.Topic_d"> 
          <property name="topm" ref="topm"/> 
          <property name="fipm" ref="fipm"/> 
    </bean>
 <bean id="topbus" class="com.elane.zsk.bus.topic.Topic_b"> 
          <property name="topicDao" ref="topdao"/> 
    </bean>
    <bean id="topaction" class="com.elane.zsk.action.topic.TopicAction">
      <property name="topic_b" ref="topbus"></property>
    </bean>
    <bean id="loginaction" class="com.elane.zsk.action.topic.LoginAction">
    </bean>
</beans>

 

struts.xml

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts>    <!-- WEB应用程序默认的字符集,类似于request.setcharacterEncoding -->  <constant name="struts.i18n.encoding" value="UTF-8"></constant>  <!-- 浏览器是否缓存静态内容服务 -->  <constant name="struts.serve.static.browserCache" value="false" />  <!--开发模式 提示更多信息 -->  <constant name="struts.devMode" value="true" />  <!-- 是否每次HTTP请求系统都重新加载资源文件  -->  <constant name="struts.i18n.reload" value="true" />     <!-- 当STRUTS.XML文件修改后 是否系统自动重新加载 -->     <constant name="struts.configuration.xml.reload" value="true" />

 <package name="default"  extends="struts-default">   <interceptors>   <interceptor name="MyInterceptor" class="com.elane.zsk.utils.SysLoginInterceptor"></interceptor> <!--   定义Struts2拦截器栈 -->   <interceptor-stack name="myInterceptorStack">    <interceptor-ref name="MyInterceptor" />    <interceptor-ref name="defaultStack" />   </interceptor-stack>   </interceptors>   <default-interceptor-ref name="myInterceptorStack"></default-interceptor-ref>  </package>  <include file="struts/login.xml"></include>  <include file="struts/topic.xml"></include> </struts>   

 

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8" ?>   
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
 <mappers>
   <mapper resource="com/elane/zsk/mybatis/config/TopicMapper.xml"/>
   <mapper resource="com/elane/zsk/mybatis/config/FileUploadMapper.xml"/>
 </mappers>
</configuration>

导入的jar包

 /zsk/WebRoot/WEB-INF/lib/aopalliance-1.0.jar
/zsk/WebRoot/WEB-INF/lib/asm-3.3.1.jar
/zsk/WebRoot/WEB-INF/lib/aspectjrt.jar
/zsk/WebRoot/WEB-INF/lib/aspectjtools.jar
/zsk/WebRoot/WEB-INF/lib/aspectjweaver.jar
/zsk/WebRoot/WEB-INF/lib/commons-beanutils-1.7.0.jar
/zsk/WebRoot/WEB-INF/lib/commons-collections-3.2.jar
/zsk/WebRoot/WEB-INF/lib/commons-fileupload-1.2.2.jar
/zsk/WebRoot/WEB-INF/lib/commons-io-2.0.1.jar
/zsk/WebRoot/WEB-INF/lib/commons-lang-2.5.jar
/zsk/WebRoot/WEB-INF/lib/commons-logging-1.1.1.jar
/zsk/WebRoot/WEB-INF/lib/dom4j-2.0.0-ALPHA-2.jar
/zsk/WebRoot/WEB-INF/lib/ezmorph-1.0.3.jar
/zsk/WebRoot/WEB-INF/lib/freemarker-2.3.18.jar
/zsk/WebRoot/WEB-INF/lib/javassist-3.11.0.GA.jar
/zsk/WebRoot/WEB-INF/lib/json_simple-1.1.jar
/zsk/WebRoot/WEB-INF/lib/jsoup-1.6.3.jar
/zsk/WebRoot/WEB-INF/lib/jstl-1.2.jar
/zsk/WebRoot/WEB-INF/lib/log4j-1.2.16.jar
/zsk/WebRoot/WEB-INF/lib/mybatis-3.1.1.jar
/zsk/WebRoot/WEB-INF/lib/mybatis-generator-core-1.3.2.jar
/zsk/WebRoot/WEB-INF/lib/mybatis-spring-1.1.1.jar
/zsk/WebRoot/WEB-INF/lib/ognl-3.0.4.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.aop-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.asm-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.aspects-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.beans-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.context.support-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.context-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.core-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.expression-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.instrument.tomcat-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.instrument-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.jdbc-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.jms-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.orm-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.oxm-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.test-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.transaction-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.web.portlet-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.web.servlet-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.web.struts-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/org.springframework.web-3.1.2.RELEASE.jar
/zsk/WebRoot/WEB-INF/lib/poi-3.8-20120326.jar
/zsk/WebRoot/WEB-INF/lib/poi-examples-3.8-20120326.jar
/zsk/WebRoot/WEB-INF/lib/poi-excelant-3.8-20120326.jar
/zsk/WebRoot/WEB-INF/lib/poi-ooxml-3.8-20120326.jar
/zsk/WebRoot/WEB-INF/lib/poi-ooxml-schemas-3.8-20120326.jar
/zsk/WebRoot/WEB-INF/lib/poi-scratchpad-3.8-20120326.jar
/zsk/WebRoot/WEB-INF/lib/servlet-api.jar
/zsk/WebRoot/WEB-INF/lib/sqljdbc4.jar
/zsk/WebRoot/WEB-INF/lib/struts2-core-2.3.1.2.jar
/zsk/WebRoot/WEB-INF/lib/struts2-spring-plugin-2.3.4.jar
/zsk/WebRoot/WEB-INF/lib/xmlbeans-2.3.0.jar
/zsk/WebRoot/WEB-INF/lib/xwork-core-2.3.1.2.jar

知之为知之的主页 知之为知之 | 初学一级 | 园豆:125
提问于:2013-01-15 12:51
< >
分享
最佳答案
0

好歹多贴点东西,这个信息也太少了。 比如配置文件之类的。

收获园豆:80
风云力 | 小虾三级 |园豆:541 | 2013-01-17 17:28

谢谢关注,

已解决

知之为知之 | 园豆:125 (初学一级) | 2013-01-18 13:28
其他回答(2)
0

包有问题。struts2-core-2.3.1.2.jar  xwork-core-2.3.1.2.jar换成struts2-core-2.3.4.jar xwork-core-2.3.4.jar

还需加入commons-lang3-3.1.jar。

知之为知之 | 园豆:125 (初学一级) | 2013-01-18 13:27
0

请问楼主是怎么解决的??

flyingsnowers | 园豆:204 (菜鸟二级) | 2015-03-03 15:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册