org.xml.sax.SAXParseException; cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到声明 [英] org.xml.sax.SAXParseException;cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found
本文介绍了org.xml.sax.SAXParseException; cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这里要做的就是让邮件发件人从Java代码中正常工作.
All i'm trying to do here is get the Mail sender to work from my Java code.
我查看了类似的问题,并按照此处的建议删除了春季版本编号,但我仍然看到相同的错误.
I looked at a similar issue and also removed the spring version numbers as suggested here cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven' but I still see the same error.
Mar 21, 2017 9:04:53 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from ServletContext resource [/WEB-INF/applicationcontext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 86; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'bean'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:604)
我的applicationContext如下:
My applicationContext is as follows:
<?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"
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">
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="postman.mx.domain.com"/>
<property name="username" value="email@domain.com"/>
<property name="javaMailProperties" >
<props>
<prop key="mail.smtp.auth" >false</prop>
</props>
</property>
</bean>
我的pom.xml中还有一个javax邮件条目,如下所示:
I also have an entry in my pom.xml for javax mail as follows:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.2</version>
</dependency>
推荐答案
通过更改将适当的名称空间添加到bean
元素,
Add the proper namespace to the bean
element by changing,
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
到
<bean xmlns="http://www.springframework.org/schema/beans"
id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
您的错误将消失.
这篇关于org.xml.sax.SAXParseException; cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文