当前位置: 首页 > 面试题库 >

Spring 3匹配的通配符很严格,但是找不到元素'jee:jndi-lookup'的声明

翁烨霖
2023-03-14
问题内容

所以我遇到了类似这里的问题…

Spring3.0错误:匹配的通配符很严格,但是找不到元素的声明、

我的pom看起来像这样

<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:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
      http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">
...
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/db" resource-ref="true" />

但是,当我尝试在Websphere上运行该服务时,得到以下信息…

Line 16 in XML document from ServletContext resource [/WEB-INF/context/loyalty-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'jee:jndi-lookup'.

看来这与我的链接有所不同,因为我已经在名称空间中有了模式。有任何想法吗?


问题答案:

请注意xsi:schemaLocation-中的其他项的模式-来自xmlns:*属性的每个名称空间URI 后面都应带有其各自的XSD位置:

 xsi:schemaLocation="
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd       
     http://www.springframework.org/schema/mvc 
     http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
     http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context/spring-context-3.0.xsd        
     http://www.springframework.org/schema/aop 
     http://www.springframework.org/schema/aop/spring-aop-3.0.xsd       
     http://www.springframework.org/schema/tx 
     http://www.springframework.org/schema/tx/spring-tx.xsd       
     http://www.springframework.org/schema/jee
     http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">


 类似资料:
  • 问题内容: 尝试我的第一个春季项目时遇到以下错误: 这是: 是什么导致错误? 问题答案: 您尚未指定上下文名称空间的架构位置,这是此特定错误的原因:

  • 问题内容: 我正在尝试配置JSF + Spring + hibernate,并且想运行一个测试,但是当我在application-context.xml文件中使用此“ tx:annotation-driven”时,出现此错误: 匹配的通配符是严格的,但是找不到元素’tx:annotation-driven’的声明 这是我的application-context.xml: 这是我的CourseSer

  • 问题内容: 我正在尝试配置NTLM身份验证,但收到错误: cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素’http’的声明。 我阅读了很多类似错误的主题,但是找不到解决我问题的方法。 我的导致错误的security.xml文件是: 因为从3.X版本开始,Spring Security不再包含NTLM扩展,所以我从http://aloiscochard.blogs

  • 问题内容: 我已经在我的lib文件夹中添加了spring-security-config-3.1.0.RC3.jar,但仍然出现此错误。可能是什么原因? 这是我的dispatcher-servlet.xml 问题答案: 你有这个: 但您在这里没有提及它: 要解决这个问题,您应该 那里,就像 注意:模式引用实际上没有提到Spring版本,以便于升级,这是很常见的做法,因此您应该使用like之类的引用

  • 我知道很多人都问过这个问题。我正在张贴,因为我尝试了所有的选项,但仍然得到错误。 我正在使用Spring4.01释放罐

  • 摘要:ZUUL没有为输入路径选择正确的目标url,因为它没有严格匹配输入路径。 以下是我的zuul路线: 对于输入路径:"/v1/顾客/卡片/产品/",它应该选择-http://localhost:8800/v1/customer/card/product但它选择http://localhost:8400/v1/composite.我的期望是路径模式匹配按照指定的顺序发生,并且更严格,但似乎不是这