복붙노트

[SPRING] cvc-complex-type.2.4.c : 일치하는 와일드 카드가 엄격하지만 'tx : annotation-driven'요소에 대한 선언을 찾을 수 없습니다.

SPRING

cvc-complex-type.2.4.c : 일치하는 와일드 카드가 엄격하지만 'tx : annotation-driven'요소에 대한 선언을 찾을 수 없습니다.

내가 xmlns : tx = "http://www.springframework.org/schema/tx"를 붙여 넣지 않으면 문제가 없습니다. 그러나 텍스트를 삽입 할 경우 cvc-complex-type.2.4.c 얻을 : 일치하는 와일드 카드 엄격하지만 요소 'tx에 대한 선언을 찾을 수 없습니다 : 주석 - 구동 된'오류가 발생했습니다.

<beans xmlns:tx="http://www.springframework.org/schema/tx" 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:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">

    <context:annotation-config />
    <tx:annotation-driven /> 
<context:component-scan base-package="ne.projl.server" />

    <bean name="security.securityInfo" class="org.geomajas.security.SecurityInfo">
        <property name="loopAllServices" value="false" />
        <property name="securityServices">
            <list>
                <bean class="org.geomajas.security.allowall.AllowAllSecurityService" />
            </list>
        </property>
    </bean>

    <bean name="puregwt-app" class="org.geomajas.configuration.client.ClientApplicationInfo">
        <property name="maps">
            <list>
                <ref bean="mapOsm" />
<!--                <ref bean="mapWms" /> -->
<!--                <ref bean="mapLegend" /> -->
<!--                <ref bean="mapLayerVisibility" /> -->
<!--                <ref bean="mapCountries" /> -->
<!--                <ref bean="mapEmpty" /> -->
<!--                <ref bean="mapPrinting" /> -->
            </list>
        </property>
    </bean>
<bean class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean" id="entityManagerFactory">
        <property name="persistenceUnitName" value="MyPUnit" />
    </bean>

    <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>
</beans>

또한 다음과 같이 를 수정하려고 시도했습니다.

해결법

  1. ==============================

    1.tx의 스키마 위치는 태그에서 제공되지 않습니다. 제공된 구성의 마지막 행에서 변경 사항을 확인하십시오. 또한 config는 Spring 2.0과 2.5를 섞어서, 이것이 필요한지 확신 할 수 없지만 이것을 알고 싶었습니다.

    tx의 스키마 위치는 태그에서 제공되지 않습니다. 제공된 구성의 마지막 행에서 변경 사항을 확인하십시오. 또한 config는 Spring 2.0과 2.5를 섞어서, 이것이 필요한지 확신 할 수 없지만 이것을 알고 싶었습니다.

    <beans xmlns:tx="http://www.springframework.org/schema/tx" 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:util="http://www.springframework.org/schema/util"
        xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    
  2. ==============================

    2.오류를 제거하려면 줄 내용을 바꿔야합니다.

    오류를 제거하려면 줄 내용을 바꿔야합니다.

    http://www.springframework.org/schema/context/spring-context-4.0.xsd
    http://www.springframework.org/schema/context
    

    그냥 인터체인지가 내 오류를 해결했습니다.

    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.0.xsd
    
  3. ==============================

    3.xsi : schemaLocation 안에 다음 두 가지 선언을 추가하여이 문제를 해결할 수있었습니다. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 나를 위해 일한 위의 추가

    xsi : schemaLocation 안에 다음 두 가지 선언을 추가하여이 문제를 해결할 수있었습니다. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 나를 위해 일한 위의 추가

  4. ==============================

    4.이것은 Spring 3.X + Hibernate + MySQL Maven에서 저에게 효과적입니다.

    이것은 Spring 3.X + Hibernate + MySQL Maven에서 저에게 효과적입니다.

    servlet-context.xml

    <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"
        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-2.5.xsd"
        xmlns:tx="http://www.springframework.org/schema/tx">
    
        <!-- 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/" />
    
        <!-- 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:annotation-config />
    
    
    
        <beans:bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <beans:property name="dataSource" ref="dataSource" />
            <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:property name="packagesToScan" value="com.hb.test.modal" />
        </beans:bean>
    
    
        <beans:bean id="dataSource" name="dataSource"
            class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />
            <beans:property name="url"
                value="jdbc:mysql://localhost:3306/mydb" />
            <beans:property name="username" value="root" />
            <beans:property name="password" value="root" />
        </beans:bean>
        <beans:bean id="transactionManager"
            class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <beans:property name="sessionFactory" ref="sessionFactory" />
        </beans:bean>
        <tx:annotation-driven transaction-manager="transactionManager" />
        <context:component-scan base-package="com.hb.test" />
    
    </beans:beans>
    

    Pom.hml

        <!--Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.6.0.Final</version>
        </dependency>
    
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0</version>
        </dependency>
    
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
    
    
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
    
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.32</version>
        </dependency>
        <!-- AOP dependency -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2</version>
        </dependency>
    
        <dependency>
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.12.1.GA</version>
        </dependency>
    
  5. ==============================

    5.xml 파일의 오류를 처리 할 때, Eclipse에 버그가 있으며, 오류가있는 줄을 잘라서 다시 붙여 넣으면 오류가 마술처럼 사라질 수 있습니다. 나는이 이클립스 버그를 여러 번 치렀다.

    xml 파일의 오류를 처리 할 때, Eclipse에 버그가 있으며, 오류가있는 줄을 잘라서 다시 붙여 넣으면 오류가 마술처럼 사라질 수 있습니다. 나는이 이클립스 버그를 여러 번 치렀다.

  6. from https://stackoverflow.com/questions/17566391/cvc-complex-type-2-4-c-the-matching-wildcard-is-strict-but-no-declaration-can by cc-by-sa and MIT license