jestem w stanie skompilować i uruchomić mój projekt wiosna użyciu Maven:Wyjątek zastosowanie począwszy Wiosna z Java
mvn -e clean compile exec:java -Dexec.mainClass=de.fraunhofer.fkie.tet.vmware.manager.Test
Jednak, kiedy zebranie wszystkich słoików w pojedynczym pliku przy użyciu maven-assembly-plugin
(w tym applicationContext.xml
), zawsze uzyskać Exception
podczas wykonywania java
:
java -cp target/test-jar-with-dependencies.jar:. de.fraunhofer.fkie.tet.vmware.manager.Test
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Sep 6, 2010 10:37:21 AM org.springframework.util.xml.SimpleSaxErrorHandler warning
WARNING: Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context.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>.
...
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 10 in XML document from class path resource [applicationContext.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 'context:annotation-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 'context:annotation-config'.
próbowałem też dołączyć do definicji schematu, tzn spring-context.xsd
itd bezpośrednio do ścieżki klasy, ale bez powodzenia.
less src/main/resources/applicationContext.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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="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">
<context:annotation-config /> <!-- wegen '@PostConstruct' -->
<!--<context:component-scan base-package="de.fraunhofer" /> -->
...
</beans>
Czy możesz umieścić swój wniosekContext.xml - lub przynajmniej sekcja nagłówka. Podejrzewam, że jest problem z twoim nagłówkiem/dtd, itp. –
"applicationContext.xml" jest zamieszczony powyżej. O dziwo, aplikacja działa bez problemu, jeśli do jej uruchomienia użyto polecenia "mvn exec: java". – rmv