问答详情
源自:3-2 引入相应配置文件-SSH环境搭建

tomcat启动报错

tomcat启动的时候报错: ERROR - Dispatcher initialization failed java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 有童鞋知道这个错误是什么原因,怎么解决么?

提问者:么么小跳跳 2017-04-15 17:27

个回答

  • 么么小跳跳
    2017-04-15 17:59:38

    struts:

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">

    <struts>

        <package name="bl" extends="struts-default" namespace="/">

        <action name="Yisheng_*" class="yishengAction" method="{1}">

        </action>

        </package>

    </struts>

    spring:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop.xsd
            http://www.springframework.org/schema/tx
            http://www.springframework.org/schema/tx/spring-tx.xsd">
    
    	<!-- 引入外部的属性文件 -->
    	<context:property-placeholder location="classpath:jdbc.properties" />
    	<!-- 配置连接池 -->
    	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    		<property name="driverClass" value="${jdbc.driverClass}" />
    		<property name="jdbcUrl" value="${jdbc.url}" />
    		<property name="user" value="${jdbc.username}" />
    		<property name="password" value="${jdbc.password}" />
    	</bean>
    	<!-- hibernate相关属性配置-->
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource" ref="dataSource" />
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.MySQLDialect
    			</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.format_sql">true</prop>
    				<prop key="hibernate.hbm2ddl_auto">update</prop>
    			</props>
    		</property>
    
    		<property name="mappingResources">
    			<list>
    				<value>domin/TYisheng.hbm.xml</value>
    				<value>domin/TKeshi.hbm.xml</value>
    			</list>
    		</property>
    	</bean>
    
    	<!-- action配置 -->
    	<bean id="yishengAction" class="action.YishengAction" scope="prototype">
    		<property name="yishengService" ref="yishengService"></property>
    	</bean>
    	<!-- 业务层配置 -->
    	<bean id="yishengService" class="service.YishengService">
    		<property name="yishengDao" ref="yishengDao">
    		</property>
    	</bean>
    	<!-- dao层配置 -->
    	<bean id="yishengDao" class="dao.YishengDao">
    	</bean>
    
    	
    </beans>

    web.xml:

    <?xml version="1.0" encoding="UTF-8"?>

    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 

    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <listener>

    <listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>

    </listener>

    <context-param>

    <param-name>contextConfigLocation</param-name>

    <param-value>classpath:applicationContext.xml</param-value>

    </context-param>


    <filter>

    <filter-name>struts</filter-name>

    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

    </filter>

    <filter-mapping>

    <filter-name>struts</filter-name>

    <url-pattern>/*</url-pattern>

    </filter-mapping>

    <welcome-file-list>

    <welcome-file>login.jsp</welcome-file>

    </welcome-file-list>

    </web-app>


  • clancy_liu
    2017-04-15 17:37:57

    有木有代码,