spring mvc servlet-context.xml

时间:2015-01-31 05:17:37

标签: spring spring-mvc

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
     xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        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/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd ">

    <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->

    <!-- Enables the Spring MVC @Controller programming model -->
    <annotation-driven />

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
    <resources mapping="/resources/**" location="/resources/" />
    <task:annotation-driven/>
    <!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>

    <context:component-scan base-package="com.tetra.ecable" />

    <beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <beans:property name="url"
            value="jdbc:mysql://localhost:3306/nibblrdw_collections" />
        <beans:property name="username" value="root" />
        <beans:property name="password" value="" />
    </beans:bean>

    <!-- Hibernate 4 SessionFactory Bean definition -->
    <beans:bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <beans:property name="dataSource" ref="dataSource" />
        <beans:property name="annotatedClasses">
            <beans:list>
                <beans:value>com.tetra.ecable.model.Admin</beans:value>
                <beans:value>com.tetra.ecable.model.SAdmin</beans:value>
                <beans:value>com.tetra.ecable.model.Subs</beans:value>
                <beans:value>com.tetra.ecable.model.SubsTyp</beans:value>
                <beans:value>com.tetra.ecable.model.CablePoc</beans:value>
                <beans:value>com.tetra.ecable.model.City</beans:value>
                <beans:value>com.tetra.ecable.model.Ctry</beans:value>
                <beans:value>com.tetra.ecable.model.Addr</beans:value>
                <beans:value>com.tetra.ecable.model.StPrv</beans:value>
                <beans:value>com.tetra.ecable.model.Area</beans:value>
                <beans:value>com.tetra.ecable.model.BillCyc</beans:value>
                <beans:value>com.tetra.ecable.model.BillDisc</beans:value>
                <beans:value>com.tetra.ecable.model.Cntc</beans:value>
                <beans:value>com.tetra.ecable.model.CustBillRelt</beans:value>
                <beans:value>com.tetra.ecable.model.CustDevRelt</beans:value>
                <beans:value>com.tetra.ecable.model.CustSubsRelt</beans:value>
                <beans:value>com.tetra.ecable.model.DevDet</beans:value>
                <beans:value>com.tetra.ecable.model.DevTyp</beans:value>
                <beans:value>com.tetra.ecable.model.LicnDet</beans:value>
                <beans:value>com.tetra.ecable.model.LicnDisc</beans:value>
                <beans:value>com.tetra.ecable.model.LicnSt</beans:value>
                <beans:value>com.tetra.ecable.model.Mnth</beans:value>
                <beans:value>com.tetra.ecable.model.PayMod</beans:value>
                <beans:value>com.tetra.ecable.model.SecQues</beans:value>
                <beans:value>com.tetra.ecable.model.SubsTyp</beans:value>
                <beans:value>com.tetra.ecable.model.SubsDisc</beans:value>
                <beans:value>com.tetra.ecable.model.SubsReq</beans:value>
                <beans:value>com.tetra.ecable.model.SubsReqTypSt</beans:value>
                <beans:value>com.tetra.ecable.model.SubsSt</beans:value>
                <beans:value>com.tetra.ecable.model.SubsTyp</beans:value>
                <beans:value>com.tetra.ecable.model.TaxTyp</beans:value>
                <beans:value>com.tetra.ecable.model.Tikt</beans:value>
                <beans:value>com.tetra.ecable.model.TiktEta</beans:value>
                <beans:value>com.tetra.ecable.model.TiktSt</beans:value>
                <beans:value>com.tetra.ecable.model.TiktTyp</beans:value>
                <beans:value>com.tetra.ecable.model.Usr</beans:value>
                <beans:value>com.tetra.ecable.model.UsrRelt</beans:value>
                <beans:value>com.tetra.ecable.model.UsrTyp</beans:value>
                <beans:value>com.tetra.ecable.model.VendDevRelt</beans:value>
                <beans:value>com.tetra.ecable.model.VendLicnRelt</beans:value>
                <beans:value>com.tetra.ecable.model.Staff</beans:value>
                <beans:value>com.tetra.ecable.model.StafRole</beans:value>
            </beans:list>
        </beans:property>
        <beans:property name="hibernateProperties">
            <beans:props>
                <beans:prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect
                </beans:prop>
                <beans:prop key="hibernate.show_sql">true</beans:prop>
            </beans:props>
        </beans:property>
    </beans:bean>

    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>

    <!-- Configure to plugin JSON as request and response in method handler -->

    <beans:bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        </beans:bean>
    <tx:annotation-driven transaction-manager="transactionManager"/>

    <beans:bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <beans:property name="sessionFactory" ref="sessionFactory" />
    </beans:bean>
    <beans:bean id="billGen" class="com.tetra.ecable.bill.BillGenerator"></beans:bean>
</beans:beans>

servlet的context.xml中

tx jar文件

弹簧-TX-3.1.1.RELEASE.jar

错误消息

  

org.xml.sax.SAXParseException; lineNumber:108; columnNumber:69;   cvc-complex-type.2.4.c:匹配的通配符是严格的,但没有   可以在元素'tx:annotation-driven'找到声明。

运行带有Internet连接的Spring mvc应用程序时出现此错误。

0 个答案:

没有答案