You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Brad O'Hearne <br...@neurofire.com> on 2008/04/01 09:15:58 UTC

Problem loading REST service

Hello,

I have what is probably a fairly simple problem. I am trying to load a  
RESTful service in Tomcat 6.x using Spring. When I start Tomcat, I  
receive an Exception -- here's the Exception received:

INFO: Creating Service {http:// 
us.service.brad.com/}IUserServiceService from class  
com.brad.service.us.IUserService
Apr 1, 2008 12:01:48 AM org.apache.catalina.core.StandardContext  
listenerStart
SEVERE: Exception sending context initialized event to listener  
instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error  
creating bean with name 'userService' defined in ServletContext  
resource [/WEB-INF/beans.xml]: Invocation of init method failed;  
nested exception is java.lang.AbstractMethodError:  
org.apache.xerces.dom.DocumentImpl.getInputEncoding()Ljava/lang/String;
Caused by: java.lang.AbstractMethodError:  
org.apache.xerces.dom.DocumentImpl.getInputEncoding()Ljava/lang/String;
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at  
org 
.apache.ws.commons.schema.utils.DOMUtil.getInputEncoding(DOMUtil.java: 
594)
	at  
org 
.apache 
.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java: 
348)
	at  
org 
.apache 
.cxf 
.databinding 
.source.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java: 
73)
	at  
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:224)
	at  
org 
.apache 
.cxf 
.service 
.factory 
.ReflectionServiceFactoryBean 
.buildServiceFromClass(ReflectionServiceFactoryBean.java:293)
	at  
org 
.apache 
.cxf 
.service 
.factory 
.ReflectionServiceFactoryBean 
.initializeServiceModel(ReflectionServiceFactoryBean.java:333)
	at  
org 
.apache 
.cxf 
.service 
.factory 
.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java: 
151)
	at  
org 
.apache 
.cxf 
.jaxws 
.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:93)
	at  
org 
.apache 
.cxf 
.frontend 
.AbstractWSDLBasedEndpointFactory 
.createEndpoint(AbstractWSDLBasedEndpointFactory.java:74)
	at  
org 
.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java: 
108)
	at  
org 
.apache 
.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java: 
147)


Here is my web.xml:

<!DOCTYPE web-app
     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/beans.xml</param-value>
	</context-param>
	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>
	<servlet>
		<servlet-name>CXFServlet</servlet-name>
		<display-name>CXF Servlet</display-name>
		<servlet-class>
			org.apache.cxf.transport.servlet.CXFServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet>
		<servlet-name>NonCXFDispatcher</servlet-name>
		<display-name>Non-CXF Servlet</display-name>
		<servlet-class>
			org.springframework.web.servlet.DispatcherServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>NonCXFDispatcher</servlet-name>
		<url-pattern>/ncservices/*</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/services/*</url-pattern>
	</servlet-mapping>
</web-app>

Here is 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:jaxws="http://cxf.apache.org/jaxws"
	xsi:schemaLocation="
	http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans.xsd
	http://cxf.apache.org/jaxws
	http://cxf.apache.org/schemas/jaxws.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import
		resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

	<jaxws:endpoint id="userService"
		implementor="com.brad.service.us.UserService"
		address="/userService"
		bindingUri="http://apache.org/cxf/binding/http">
		<jaxws:serviceFactory>
			<bean
				class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
				<property name="wrapped" value="true" />
			</bean>
		</jaxws:serviceFactory>
	</jaxws:endpoint>
</beans>

Does anyone have any idea what the problem is? I have been through all  
of the documentation and I cannot see the problem. I am wondering if  
there is some potential dependency issue. I have tried both the 2.0.3  
and 2.0.4 versions of the CXF jars, and I have also tried using the  
spring bean approach in the beans.xml file instead of the jaxws  
endpoint approach. Everything produces the same error.

Your help is appreciated!

Thanks,

Brad