我正在使用Java和Spring开发一个应用程序,我正在尝试将其上传到AppFog。
应用程序运行正常,它在AppFog中工作,但在Eclipse中,我的applicationContext.xml
文件中出现了一个非常烦人的错误。
根据AppFog中的文档,我必须这样设置:Spring - AppFog Documentation
我的applicationContext.xml片段
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cloud="http://schema.cloudfoundry.org/spring"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://schema.cloudfoundry.org/spring
http://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd">
<cloud:data-source id="dataSource">
在标记cloud:data source
中,我收到错误:
Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://schema.cloudfoundry.org/spring/cloudfoundry-spring.xsd',
because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cloud:data-source'.
我尝试使用http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd
和不同的版本,但我总是遇到同样的错误。
我也在我的pom中包含了下一个图书馆:
<dependency>
<groupId>org.cloudfoundry</groupId>
<artifactId>cloudfoundry-runtime</artifactId>
<version>0.8.1</version>
</dependency>
一些想法?
谢谢!
答案 0 :(得分:0)
所以看起来你的应用程序在本地和AppFog上工作,但正如你所说,问题是Eclipse中的验证错误。您使用的是Spring Tool Suite插件吗?这里应该发生的是应该在Spring Jar文件中找到模式(源代码在Github上https://github.com/cloudfoundry/vcap-java/blob/master/cloudfoundry-runtime/src/main/resources/META-INF/spring.schemas) - 我想应该有一种方法告诉Eclipse在那里解决它,我怀疑STS实际上会知道如何解决它。