如果我在wildfly上部署我的web服务,我会得到SAXParseException。它确实在jboss 7上运行(不同的maven依赖项)。 我将spring模块添加到wildfly模块中。 有没有人知道我错过了什么。 非常感谢您抽出宝贵的时间和美好的一天。
的web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="3.1"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_2.5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<!-- param-value>WEB-INF/cxf-servlet.xml</param-value -->
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<resource-env-ref>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager
</resource-env-ref-type>
</resource-env-ref>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>services/*</url-pattern>
</servlet-mapping>
的applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint xmlns:e="http://www.de/namespace/service/Druckagent/v1"
id="druckagent" address="/druckagent"
implementor="druckagent.druck.impl.DruckagentImpl"
endpointName="e:DruckagentPort" />
</beans>
的JBoss部署-structure.xml
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<!-- subsystem name="webservices" / -->
</exclude-subsystems>
<dependencies>
<module name="org.apache.cxf" />
<module name="org.apache.cxf.impl" />
<module name="org.springframework.spring" />
</dependencies>
</deployment>
</jboss-deployment-structure>
webservice.xml
<webservices xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_2.xsd"
xmlns:ger="http://ciaows.org/wsdl" version="1.1">
<webservice-description>
<webservice-description-name>Druckagent</webservice-description-name>
<port-component>
<port-component-name>DruckagentImpl</port-component-name>
<wsdl-port>DruckagentPort</wsdl-port>
<service-endpoint-interface>broker.verwaltung.Druckagent</service-endpoint-interface>
<service-impl-bean>
<ejb-link>DruckagentImpl</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
的pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webXml>${basedir}/src/main/resources/WEB-INF/web.xml</webXml>
<webResources>
<webResource>
<directory>${basedir}/src/main/resources/WEB-INF</directory>
<includes>
<include>applicationContext.xml</include>
<include>web.xml</include>
<include>beans.xml</include>
<include>jboss-webservices.xml</include>
<include>webservices.xml</include>
<include>ejb-jar.xml</include>
<include>jboss-deployment-structure.xml</include>
</includes>
<targetPath>WEB-INF</targetPath>
</webResource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<!-- AS7scope>compile</scope-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<!-- AS7scope>compile</scope-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
</profiles>
异常
16:15:03,189 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-1) Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
16:15:03,192 DEBUG [org.springframework.beans.factory.xml.DefaultDocumentLoader] (MSC service thread 1-1) Using JAXP provider [__redirected.__DocumentBuilderFactory]
16:15:03,194 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] (MSC service thread 1-1) Loading schema mappings from [META-INF/spring.schemas]
16:15:03,194 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] (MSC service thread 1-1) Loaded schema mappings: {}
16:15:06,473 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name
16:15:24,198 WARN[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-1) Ignored XML validation warning: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; schema_reference.4: Schemadokument "http://www.springframework.org/schema/beans/spring-beans-3.2.xsd" konnte nicht gelesen werden, da 1) das Dokument nicht gefunden werden konnte; 2) das Dokument nicht gelesen werden konnte; 3) das Root-Element des Dokuments nicht <xsd:schema> ist.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:433) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:347) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4128) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:4119) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument1(XSDHandler.java:2463) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2167) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:562) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:588) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2448) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1767) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:602) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3065) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:881) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:237) [rt.jar:1.7.0_25]
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300) [rt.jar:1.7.0_25]
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) [spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) [spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451) [spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:194) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_25]
16:15:24,211 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Context initialization failed: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) [spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE]
Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) [rt.jar:1.7.0_25]
16:15:24,218 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT": org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:223) Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements "beans" kann nicht gefunden werden.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) [rt.jar:1.7.0_25]
16:15:24,229 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host.\"/druckserver-0.0.1-SNAPSHOT\"" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host.\"/druckserver-0.0.1-SNAPSHOT\": Failed to start service Caused by: java.lang.RuntimeException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 83; cvc-elt.1: Deklaration des Elements \"beans\" kann nicht gefunden werden. 16:15:24,255 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018565: Replaced deployment "druckserver-0.0.1-SNAPSHOT.war" with deployment "druckserver-0.0.1-SNAPSHOT.war"16:15:24,255 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report JBAS014777: Services which failed to start: service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT" service jboss.undertow.deployment.default-server.default-host."/druckserver-0.0.1-SNAPSHOT": org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default- host."/druckserver-
0.0.1-SNAPSHOT": Failed to start service>
答案 0 :(得分:1)
这是问题的解决方案。可能是其他方法来修复它,但这个对我有用。只需要这两个文件和beans.xml
的web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="3.1"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_2.5.xsd">
</web-app>
的JBoss部署-structure.xml
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<!-- subsystem name="webservices" / -->
</exclude-subsystems>
<dependencies>
<module name="org.apache.cxf" />
<module name="org.apache.cxf.impl" />
<module name="org.springframework.spring" export="true" meta-inf="export"/>
</dependencies>
</deployment>
</jboss-deployment-structure>