2010-12-14 4 views
3

Я пытаюсь использовать Spring's Schema Based AOP Support в Eclipse и получаю ошибки при попытке загрузить конфигурацию в Tomcat.Почему XML-схема Spring AOP не загружается должным образом, когда Tomcat загружает и читает beans.xml

Там нет ошибок в Eclipse, и автозаполнение корректно работает для имен АОПА, однако, когда я пытаюсь загрузить проект в затмение я получаю эту ошибку:

09:17:59,515 WARN XmlBeanDefinitionReader:47 - Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/aop/spring-aop-2.5.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .

Далее следует:

SEVERE: StandardWrapper.Throwable org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 39 in XML document from /WEB-INF/beans.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 'aop:config'.

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.

Исходя из этого, кажется, что схема не читается, когда Tomcat анализирует файл beans.xml, что приводит к тому, что элемент <aop:config> не распознается.

Мой файл beans.xml выглядит следующим образом:

<?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:jaxws="http://cxf.apache.org/jaxws" 
    xmlns:aop="http://www.springframework.org/schema/aop" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
     http://cxf.apache.org/jaxws 
     http://cxf.apache.org/schemas/jaxws.xsd 
     http://www.springframework.org/schema/aop 
     http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> 

    <!--import resource="classpath:META-INF/cxf/cxf.xml" /--> 
    <!--import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /--> 
    <!--import resource="classpath:META-INF/cxf/cxf-servlet.xml" /--> 

    <!-- NOTE: endpointName attribute maps to wsdl:[email protected] & should 
       be the same as the portName attribute 
       in the @WebService annotation on the IWebServiceImpl class --> 
    <!-- NOTE: serviceName attribute maps to wsdl:[email protected] & should be 
       the same as the serviceName attribute in the @WebService 
       annotation on the ASDIWebServiceImpl class --> 
    <!-- NOTE: address attribute is the actual URL of the web service 
       (relative to web app location) --> 
    <jaxws:endpoint 
      xmlns:tns="http://iwebservices.ourdomain/" 

      id="iwebservices" 
      implementor="ourdomain.iwebservices.IWebServiceImpl" 
      endpointName="tns:IWebServiceImplPort" 
      serviceName="tns:IWebService" 
      address="/I" 
      wsdlLocation="wsdl/I.wsdl"> 
      <!-- To have CXF auto-generate WSDL on the fly, comment out the above wsdl 
      attribute --> 

      <jaxws:features> 
        <bean class="org.apache.cxf.feature.LoggingFeature" /> 
      </jaxws:features> 
    </jaxws:endpoint> 


    <aop:config> 
    <aop:aspect id="myAspect" ref="aBean"> 

    </aop:aspect> 
    </aop:config> 


</beans> 

<aop:config> элемент в моем beans.xml файла копии вставили из Spring website, чтобы попытаться устранить любой возможный источник ошибки

Может кто-нибудь пролить свет на то, почему эта ошибка происходит и что я могу сделать, чтобы исправить это?

+1

Попробуйте 'http: // www.springframework.org/schema/aop/spring-aop.xsd' вместо' http: // www.springframework.org/schema/aop/spring-aop-2.5.xsd' , см., если это имеет значение. – skaffman

+0

Пробовал 'http: // www.springframework.org/schema/aop/spring-aop.xsd' вместо' http: // www.springframework.org/schema/aop/spring-aop-2.5.xsd': Сделано нет разницы, произошли те же ошибки – chrisbunney

+0

Спасибо за улучшение форматирования org.life.java, мне было интересно, что я должен сделать, чтобы сделать исключения более читаемыми – chrisbunney

ответ

2

Убедитесь, что в папке WEB-INF/lib вашего веб-сервера установлена ​​пружинная банка AOP (spring-aop.jar).

Этот jar contais указанный XSD.

Смежные вопросы