错误:org.springframework.web.servlet.DispatcherServlet-457上下文初始化失败

时间:2018-07-26 22:19:44

标签: java spring apache netbeans

规格: 内部版本:Java 1.7 Tomcat 6.0.26 JRE:Java 1.7

当我的tomcat尝试部署我的应用程序时,我遇到以下问题:

  

INFO:初始化Spring FrameworkServlet'dispatcher'2018-07-26   17:07:59,250 [main]错误:   org.springframework.web.servlet.DispatcherServlet-457上下文   初始化失败   org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:   ServletContext资源中XML文档的第13行   [/WEB-INF/dispatcher-servlet.xml]无效;嵌套异常为   org.xml.sax.SAXParseException; lineNumber:13; columnNumber:63;   cvc-elt.1:找不到元素'beans'的声明。

我的调度程序servlet是这样的:

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


   <context:property-placeholder location="/WEB-INF/configuration.properties"/>

    <dwr:configuration />
     <dwr:annotation-config id="dwr" />
    <dwr:url-mapping />


<dwr:controller id="dwrController" debug="true">
</dwr:controller>

 <dwr:annotation-scan  base-package="com.vanja.pepsico.autos" scanDataTransferObject="true" scanRemoteProxy="true"/>   

    <context:component-scan base-package="com.vanja.pepsico.autos"  />

<beans:bean id="interceptor" class="com.vanja.pepsico.autos.interceptors.AutosInterceptor" />

    <beans:bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
        <property name="interceptors">
            <list>
                <ref bean="interceptor" />
            </list>
        </property>
    </beans:bean>

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

<beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!-- one of the properties available; the maximum file size in bytes -->
        <property name="maxUploadSize" value="27262976"/>
    </beans:bean>
    <!--<context:annotation-config />-->
<mvc:annotation-driven/>

  <mvc:interceptors>
         <beans:bean id="interceptor" class="com.vanja.pepsico.autos.interceptors.AutosInterceptor" />
  </mvc:interceptors>

</beans>

这是我的applicationContext:

<?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:context="http://www.springframework.org/schema/context"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.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.xsd">
     <context:component-scan base-package="com.vanja.pepsico.autos"  />
     <context:property-placeholder location="/WEB-INF/configuration.properties"/>


    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:comp/env/jdbc/edc_desarrollo"></property>
        <!--produccion<property name="jndiName" value="java:comp/env/jdbc/edc"></property>-->
        <property name="lookupOnStartup" value="false"></property>
        <property name="cache" value="false"></property>
        <property name="proxyInterface" value="javax.sql.DataSource"></property>
    </bean>

    <bean id="dataSourceAdc" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:comp/env/jdbc/adc_desarrollo"></property>
        <!--produccion<property name="jndiName" value="java:comp/env/jdbc/adc"></property-->
        <property name="lookupOnStartup" value="false"></property>
        <property name="cache" value="false"></property>
        <property name="proxyInterface" value="javax.sql.DataSource"></property>
    </bean>

 <bean id="dataSourceJBPM" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:comp/env/jdbc/jbpm"></property>
        <property name="lookupOnStartup" value="false"></property>
        <property name="cache" value="false"></property>
        <property name="proxyInterface" value="javax.sql.DataSource"></property>
    </bean>

<!--configuracion de las plantillas de email-->
<!--<bean id="freemarkerMailConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">-->
<bean id="freemarkerMailConfiguration" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
   <property name="templateLoaderPath" value="/WEB-INF/freemarker/"/>
</bean>

 <!--#Configuración del servicio de Spring: MailSernder -->
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host" value="${mail.host}"/>
        <property name="username" value="${mail.username}"/>
        <property name="defaultEncoding" value="UTF-8"/>

        <!--quitar en producion

        <property name="port" value="587"/>   
         <property name="password" value="${mail.password}"/>
        <property name="javaMailProperties" >
             <props>               
                <prop key="mail.transport.protocol">smtp</prop>               
                <prop key="mail.smtp.auth">true</prop>               
                <prop key="mail.smtp.starttls.enable">true</prop>
                <prop key="mail.debug">true</prop>
            </props>
         </property>

    quitar en producion-->   

    </bean>

    <!--#Configuración de nuestro servicio:MailService--> 
    <bean id="mailService" class="com.vanja.pepsico.autos.services.impl.MailServiceImpl">
      <property name="freemarkerMailConfiguration" ref="freemarkerMailConfiguration" />
        <property name="active" value="true"/>
        <property name="mailSender" ref="mailSender"/>
        <property name="from" value="${mail.from}"/>  
    </bean>

</beans>

你们有线索吗?

这是来自tomcat的错误日志:

  

由以下原因引起:org.xml.sax.SAXParseException; lineNumber:13;   columnNumber:63; cvc-elt.1:找不到元素的声明   '豆子'。在   com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)     在   com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)     在   com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)     在   com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)     在   com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)     在   com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1906)     在   com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:746)     在   com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:379)     在   com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl $ NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:605)     在   com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $ FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3138)     在   com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl $ PrologDriver.next(XMLDocumentScannerImpl.java:880)     在   com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)     在   com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)     在   com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)     在   com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)     在   com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)     在   com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)     在   com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)     在   com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)     在   org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)     在   org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)     ...另外34个

感谢您的时间和帮助!

0 个答案:

没有答案