gpt4 book ai didi

java - 部署 CXF Restful WebServices 时如何避免与 Spring 相关的警告

转载 作者:行者123 更新时间:2023-12-01 09:43:45 24 4
gpt4 key购买 nike

将 war 文件部署到 JBOSS 服务器时,我遇到了一些与 spring-beans.xsd 相关的警告。

我有我的警告和我的 beans.xml,如下所述。任何人都可以帮助我解决这个问题......

我的警告:

11:23:59,945 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015960:Class Path entry jaxb-api.jar in /C:/Desktop/jbdevstudio/runtimes
/jboss-eap/standalone/deployments/MyWebService.war/WEB-INF/lib/jaxb-impl-2.1.13.jar does not point to a valid jar for a Class-Path reference.

11:24:21,564 WARN [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016010: Warning while parsing vfs:/C:/Desktop/jbdevstudio/runtimes/jboss-eap/standalone/deployments/MyWebService.war/WEB-INF/beans.xml:12 schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-4.1.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>.

我的 Web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>SBPWebService</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/beans.xml</param-value>
</context-param>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>

我的 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:context="http://www.springframework.org/schema/context"
xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd">
....
....
</beans>

我的 pom.xml 依赖项:

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<!-- Apache CXF Dependencies -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.7.13</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.7.13</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>2.7.13</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.7.13</version>
</dependency>
<!-- Jackson The JSON Producer dependency -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.13</version>
</dependency>

<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.2.2</version>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

</dependencies>

最佳答案

Class Path entry jaxb-api.jar in /C:/Desktop/jbdevstudio/runtimes /jboss-eap/standalone/deployments/MyWebService.war/WEB-INF/lib/jaxb-impl-2.1.13.jar does not point to a valid jar for a Class-Path reference.

您不需要将 jaxb 与您的应用程序捆绑在一起,因为自 JDK1.6 起它们已经是 JDK/App 服务器的一部分。从 classpah 中删除 jaxb*

Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-4.1.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。尝试使用无版本架构。在升级 spring 版本时,无版本也应该起作用,并且是推荐的用法。请参阅Spring configuration XML schema: with or without version?

http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd

必要的模式可以在 META-INF/spring.schemas 中找到 spring-beans.jar 并包含在 jar 中,因此不需要互联网正在下载

http://www.springframework.org/schema/beans/spring-beans-4.1.xsd=org/springframework/beans/factory/xml/spring-beans-4.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-4.1.xsd

关于java - 部署 CXF Restful WebServices 时如何避免与 Spring 相关的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38238592/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com