Java &引用;匹配通配符是严格的,但找不到任何声明;错误和;“读取架构失败”;错误
我正在用春季和mybatis运动锻炼自己 从昨天开始,我一直在努力解决这两个错误: (一) 说明资源路径位置类型cvc复杂类型。2.4.c: 匹配通配符是严格的,但找不到的声明 要素 '上下文:注释配置'。ApplicationContext.xml/Example/WebContent/WEB-INF行 14 XML问题 对于这些线路:Java &引用;匹配通配符是严格的,但找不到任何声明;错误和;“读取架构失败”;错误,java,xml,spring,spring-mvc,xsd,Java,Xml,Spring,Spring Mvc,Xsd,我正在用春季和mybatis运动锻炼自己 从昨天开始,我一直在努力解决这两个错误: (一) 说明资源路径位置类型cvc复杂类型。2.4.c: 匹配通配符是严格的,但找不到的声明 要素 '上下文:注释配置'。ApplicationContext.xml/Example/WebContent/WEB-INF行 14 XML问题 对于这些线路: <context:component-scan base-package="Controller" /> <context:componen
<context:component-scan base-package="Controller" />
<context:component-scan base-package="service"/>
<context:component-scan base-package="test.dao.samp"/>
<context:component-scan base-package="test.model.samp"/>
这是:
(二)
说明资源路径位置类型
架构_引用。4:未能读取架构文档“”,
因为1)找不到文档;2) 无法保存该文件
阅读3) 文档的根元素不是
. ApplicationContext.xml/example/WebContent/WEB-INF行
14 XML问题
架构\u引用。4:无法读取架构文档
'',因为
1) 找不到该文档;2) 文件无法读取;3)
文档的根元素不是
. ApplicationContext.xml/example/WebContent/WEB-INF行
51 XML问题
这是我的ApplicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:annotation-config/>
<context:component-scan base-package="Controller" />
<context:component-scan base-package="service"/>
<context:component-scan base-package="test.dao.samp"/>
<context:component-scan base-package="test.model.samp"/>
<bean id='dataSource'
class='org.springframework.jdbc.datasource.SimpleDriverDataSource'>
<property name='driverClass' value='org.apache.derby.jdbc.EmbeddedDriver' />
<property name='url'
value='jdbc:derby:C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\com.ibm.datatools.db2.cloudscape.driver\SAMPLE;create=true' />
<property name='username' value='admin' />
<property name='password' value='admin' />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="WEB-INF\psaIbatisConf.xml" />
</bean>
<bean id="sqlMapClient" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg ref="sqlSessionFactory" />
</bean>
<!-- TRANSACTION MANAGER -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- ANNOTATION DRIVEN TRANSACTIONS -->
<tx:annotation-driven transaction-manager="transactionManager" />
</beans>
据我所知,错误来自错误的xsd声明,但我检查了很多次
我使用的罐子都是4.0.4版本
我正在使用RAD、Websphere、spring e myBatis和myBatis生成器
编辑:
我以以下方式更改了beans标记中的版本架构:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
第一个错误消失了,但最后一个错误(第51行)仍然存在 看看这个contex的例子,也许可以帮助你。我使用相同的事务管理器
<?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:jee="http://www.springframework.org/schema/jee"
xmlns:util="http://www.springframework.org/schema/util" xmlns:mockito="http://www.mockito.org/spring/mockito"
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.mockito.org/spring/mockito https://bitbucket.org/kubek2k/springockito/raw/tip/springockito/src/main/resources/spring/mockito.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config />
<tx:annotation-driven/>
<context:component-scan base-package="cat.base.gpt.logica" />
<import resource="classpath:tip-appConfiguration.xml" />
<bean id="gptServei" class="cat.base.gpt.logica.serveis.impl.ServeiGpt">
<property name="serveiSubjecte" ref="serveiSubjecte"/>
<property name="vwGptVBasicDAO" ref="vwGptVBasicDAO" />
<property name="vwGptVExpMSDAO" ref="vwGptVExpMSDAO" />
<property name="vwGptVObjectesBasicDAO" ref = "vwGptVObjectesBasicDAO"/>
<!--
Propietat per falicilitar el filtratge cat.base.gpt.multiens
true:Recuperem tots els ens
false: filtrem per ens
-->
<property name="filtratgeEns" value="${cat.base.gpt.multiens}"/>
<qualifier type="cat.base.gpt.domini.serveis.IServeiGpt" value="gptServei" />
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="connexioJdbctemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
<constructor-arg type="javax.sql.DataSource" ref="dataSource"/>
</bean>
<bean id="preparadorJdbctemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg type="javax.sql.DataSource" ref="dataSource"/>
</bean>
<bean id="vwGptVBasicDAO" class="cat.base.gpt.logica.dao.impl.VwGptVBasicDao">
<property name="template" ref="connexioJdbctemplate" />
</bean>
<bean id="vwGptVExpMSDAO" class="cat.base.gpt.logica.dao.impl.VwGptExpMSDao">
<property name="template" ref="connexioJdbctemplate" />
</bean>
<!-- DAO referent a objectes bàsics -->
<bean id="vwGptVObjectesBasicDAO" class="cat.base.gpt.logica.dao.impl.VwGptObjecteBasicDao">
<property name="template" ref="connexioJdbctemplate" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${cat.base.gpt.driverClassName}" />
<property name="url" value="${cat.base.gpt.url}" />
<property name="username" value="${cat.base.gpt.username}"/>
<property name="password" value="${cat.base.gpt.password}"/>
</bean>
<bean id="postprocess" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:cat/base/gpt/serveis/impl/logica.properties</value>
<value>classpath*:entorn-servidor.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="false" />
</bean>
</beans>
classpath*:cat/base/gpt/serveis/impl/logica.properties
类路径*:entorn-servidor.properties
我解决了导入spring tx库的错误,准确地说是spring-tx-4.0.4。发布
由于错误,我没有检查lib文件夹中是否有jar。第14行?是
?也许你的申报包不正确?第51行在哪里?是的,第51行是:
。我也这么认为,但我不知道我的错误在哪里。你什么时候得到这些例外?Eclipse(RAD就是这样)有时会显示错误,而不存在任何错误。另外,最好使用无版本模式的spring-beans.xsd
而不是spring-beans-4.0.xsd
。我在没有tx
的情况下编写了文件,一切都很好。之后,我需要添加tx
注释以使用事务。从那一刻起,我就犯了这些错误。之前我和tx有关,但是经过几次修改后,我把所有的东西都混在一起了。一个问题。我使用4.0
版本,因此我的jars文件是4.0。我必须使用模式的4.0
版本吗?或者我也可以使用2.5
?无论如何,我试过了。我得到了另一个错误没有为文档检测到语法约束(DTD或XML模式)。
也许其他人可以知道wtf是如何发生的。该版本很重要,只是作为声明事务管理器的示例。