dev777
dev777

Reputation: 1019

How to avoid warnings related to Spring while deployment of CXF Restful WebServices

While deploying my war file into my JBOSS server,I'm facing some warnings related to spring-beans.xsd.

I've my warnings and my beans.xml as mentioned below.Can anyone please help me out regarding this issue .....

My Warnings :

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>.

My 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>

My 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>

My pom.xml dependencies:

<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>

Upvotes: 0

Views: 612

Answers (1)

pedrofb
pedrofb

Reputation: 39241

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.

You do not need to bundle jaxb with your application as they are already part of JDK/App server since JDK1.6. Remove jaxb* from classpah

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 .

The system could not read the pointed XSD. Try to use the version-less schema. The version-less should work also when upgrading spring version and is the recommended usage. See 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

The necessary schemas can be found at META-INF/spring.schemas into spring-beans.jar and are included in jar, so there is not need of internet downloading

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

Upvotes: 1

Related Questions