You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Sinkinson,Andrew [NCR]" <An...@ec.gc.ca> on 2007/10/25 20:20:49 UTC

Running java_first_pojo sample in a Servlet container

Hi All,

I am trying to run the java_first_pojo sample in Tomcat 5.5 but I am
getting the following error:

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 'pojoservice': Invocation of init method failed; nested
exception is org.apache.cxf.service.factory.ServiceConstructionException
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
	at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:
129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
	at java.lang.reflect.Method.invoke(Unknown Source)

Here is my Web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!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>
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <display-name>CXF Servlet</display-name>
    <servlet-class>
        org.apache.cxf.transport.servlet.CXFServlet
    </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>WEB-INF/services.xml</param-value>
</context-param>
<listener>
	<listener-class>
		org.springframework.web.context.ContextLoaderListener
	</listener-class>
</listener>
</web-app>

Here is the configuration file :

<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:simple="http://cxf.apache.org/simple"
      xmlns:soap="http://cxf.apache.org/bindings/soap"
      xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">

  <simple:server id="pojoservice"
serviceClass="demo.hw.server.HelloWorld" address="/hello_world">
  	<simple:serviceBean>
  		<bean class="demo.hw.server.HelloWorldImpl" />
  	</simple:serviceBean>
  </simple:server>
</beans>

I am new to using CXF and any help would be much appreciated.

Thanks




Re: Running java_first_pojo sample in a Servlet container

Posted by Jeff Yu <je...@iona.com>.
Hi,

please remove the below fragment from your web.xml, and then restart it, 
it should work fine.

  <context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>WEB-INF/services.xml</param-value>
</context-param>
<listener>
	<listener-class>
		org.springframework.web.context.ContextLoaderListener
	</listener-class>
</listener>

well, it seems you want to use CXF with spring, please refer to java_first_spring_support for detail.

Thanks
Jeff.



Sinkinson,Andrew [NCR] wrote:
> Hi All,
>
> I am trying to run the java_first_pojo sample in Tomcat 5.5 but I am
> getting the following error:
>
> 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 'pojoservice': Invocation of init method failed; nested
> exception is org.apache.cxf.service.factory.ServiceConstructionException
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException
> 	at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:
> 129)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
>
> Here is my Web.xml:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!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>
>   <servlet>
>     <servlet-name>CXFServlet</servlet-name>
>     <display-name>CXF Servlet</display-name>
>     <servlet-class>
>         org.apache.cxf.transport.servlet.CXFServlet
>     </servlet-class>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>CXFServlet</servlet-name>
>     <url-pattern>/services/*</url-pattern>
>   </servlet-mapping>
>   <context-param>
> 	<param-name>contextConfigLocation</param-name>
> 	<param-value>WEB-INF/services.xml</param-value>
> </context-param>
> <listener>
> 	<listener-class>
> 		org.springframework.web.context.ContextLoaderListener
> 	</listener-class>
> </listener>
> </web-app>
>
> Here is the configuration file :
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:simple="http://cxf.apache.org/simple"
>       xmlns:soap="http://cxf.apache.org/bindings/soap"
>       xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/bindings/soap
> http://cxf.apache.org/schemas/configuration/soap.xsd
> http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">
>
>   <simple:server id="pojoservice"
> serviceClass="demo.hw.server.HelloWorld" address="/hello_world">
>   	<simple:serviceBean>
>   		<bean class="demo.hw.server.HelloWorldImpl" />
>   	</simple:serviceBean>
>   </simple:server>
> </beans>
>
> I am new to using CXF and any help would be much appreciated.
>
> Thanks
>
>
>
>
>