Main Tutorials

java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler

Problem

Developing jax-ws with Spring, using jdk1.6 + jaxws-spring-1.8.jar + Spring-2.5.6.jar. See following Spring XML configuration file :


<?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:ws="http://jax-ws.dev.java.net/spring/core"
       xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"

       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://jax-ws.dev.java.net/spring/core
       http://jax-ws.dev.java.net/spring/core.xsd
       http://jax-ws.dev.java.net/spring/servlet
       http://jax-ws.dev.java.net/spring/servlet.xsd"
>
 
    <wss:binding url="/ws">
        <wss:service>
            <ws:service bean="#UserWs"/>
        </wss:service>
    </wss:binding>

    <!-- this bean implements web service methods -->
    <bean id="UserWs" class="com.mkyong.user.ws.UserWS">
        <property name="UserBo" ref="com.mkyong.user.bo.UserBo" />
    </bean>

</beans>

But, it hits following error message :


java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler

Solution

The “org.apache.xbean.spring.context.v2.XBeanNamespaceHandler” is belong to xbean-spring.jar. You can get it from Maven central repository here or declare xbean’s dependency in your pom.xml file.

File : pom.xml


<dependency>
	<artifactId>xbean</artifactId>
	<groupId>org.apache.xbean</groupId>
	<version>3.7</version>
</dependency>

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
4 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
marcos
10 years ago

i have problems with wss and ws.

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Premature end of file.

Shivam
11 years ago

Was getting the error mentioned below:
Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.IllegalArgumentException: Class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] does not implement the NamespaceHandler interface

Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.IllegalArgumentException: Class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] does not implement the NamespaceHandler interface

Turns out was missing the xbean-spring.jar mentioned in your post.

Thanks a lot.

art
11 years ago

The artifact-id should be “xbean-spring”. Otherwise, thank you!

1badninja
11 years ago
Reply to  art

Yes, the artifact should be xbean-spring. I just verified that also.