Hi Dan,
Thank you very much for your valuable input, in fact it saved me a lot
of time.
We made the following changes on the configuration given by you and it
is working fine now
<simple:dataBinding>
<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding">
<property name="aegisContext">
<bean class="org.apache.cxf.aegis.AegisContext">
<property name="enableJDOMMappings" value="true" />
</bean>
</property>
</bean>
</simple:dataBinding>
Thanks & Regards
Melbin Paulose
On 3/29/2011 12:34 AM, Daniel Kulp wrote:
I think, by default, the jdom support is disabled as it's not used much
anymore and required additional jars and such that we don't normally ship.
Thus, you could need to configure it like:
<simple:dataBinding>
<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding">
<property name="enableJDOMMappings" value="true"/>
</bean>
</simple:dataBinding>
Dan
On Monday 28 March 2011 2:42:57 AM Melbin Paulose wrote:
Hi,
We are going through XFire to CXF migration
We already have lot of webservices developed using XFire and these
webservices using org.jdom.Element as argument in between on interfaces,
So we tried to migrate using CXF simple frontend without annotations
When we tried to deploy, we got the following exceptions
Exceptions from server
---------------------------------
INFO: Creating Service {http://server.hw.demo/}HelloWorld from class
demo.hw.server.HelloWorld
Mar 25, 2011 6:20:11 PM
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
destroySingletons
INFO: Destroying singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@e90943
: defining beans [pojoservice]; parent:
org.springframework.beans.factory.support.DefaultListableBeanFactory@185ad7
9 Mar 25, 2011 6:20:11 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
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
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.createBean(AbstractAutowireCapableBeanFactory.java:456) at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(A
bstractBeanFactory.java:291) at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getS
ingleton(DefaultSingletonBeanRegistry.java:222) at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abs
tractBeanFactory.java:288) at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstr
actBeanFactory.java:190) at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preIns
tantiateSingletons(DefaultListableBeanFactory.java:580) at
org.springframework.context.support.AbstractApplicationContext.finishBeanFa
ctoryInitialization(AbstractApplicationContext.java:895) at
org.springframework.context.support.AbstractApplicationContext.refresh(Abst
ractApplicationContext.java:425) at
org.apache.cxf.transport.servlet.CXFServlet.loadAdditionalConfig(CXFServlet
.java:190) at
org.apache.cxf.transport.servlet.CXFServlet.updateContext(CXFServlet.java:1
58) at
org.apache.cxf.transport.servlet.CXFServlet.loadSpringBus(CXFServlet.java:1
04) at
org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:73)
at
org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet
.java:84) at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1
161) at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
ava:133) at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j
ava:175) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:12
8) at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:10
5) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav
a:109) at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Htt
p11Protocol.java:634) at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:341)
at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBin
dings(AbstractServiceFactoryBean.java:86) at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFro
mClass(ReflectionServiceFactoryBean.java:442) at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServi
ceModel(ReflectionServiceFactoryBean.java:505) at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Reflecti
onServiceFactoryBean.java:242) at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(Abs
tractWSDLBasedEndpointFactory.java:101) at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:148
) 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)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) ... 26 more
Caused by:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1
counts of IllegalAnnotationExceptions
org.jdom.Namespace does not have a no-arg default constructor.
this problem is related to the following location:
at org.jdom.Namespace
at public org.jdom.Namespace org.jdom.Element.getNamespace()
at org.jdom.Element
at
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.ch
eck(Unknown Source)
at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown
Source)
at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.bui
ld(Unknown Source)
at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
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)
at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
at javax.xml.bind.ContextFinder.find(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at
org.apache.cxf.jaxb.JAXBDataBinding.createContext(JAXBDataBinding.java:563)
at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBin
ding.java:497) at
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:324)
... 39 more
when we added the following data Binding in cxf-servlet.xml, deploy is
succeeded but got null value for element inside server
<simple:dataBinding>
<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
</simple:dataBinding>
If any solution for this problem, any idea to pinpoint the solution is
highly appreciated
Thanks& Regards
Melbin Paulose
Web service snippets and used libraries are following
libraries used
---------------
aopalliance-1.0.jar
commons-logging-1.1.1.jar
cxf-2.3.3.jar
jdom1.1.1.jar
neethi-2.0.4.jar
spring-aop-3.0.5.RELEASE.jar
spring-asm-3.0.5.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-core-3.0.5.RELEASE.jar
spring-expression-3.0.5.RELEASE.jar
spring-web-3.0.5.RELEASE.jar
wsdl4j-1.6.2.jar
XmlSchema-1.4.7.jar
1) Interface
-------------
package demo.hw.server;
import org.jdom.Element;
public interface HelloWorld {
Element getEelement(Element element);
}
2) Implementation
-----------------
package demo.hw.server;
import org.jdom.Element;
public class HelloWorldImpl implements HelloWorld {
public Element getEelement(Element element) {
System.out.println("element "+element);// here we get value as
"null" when invoking client
return element;
}
}
3) cxf-servlet.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: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.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:dataBinding>
<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
</simple:dataBinding>-->
</simple:server>
</beans>
4) 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>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
5) client.java
--------------
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.jdom.Element;
public class TestClient {
public static void main(String args[]) throws Exception {
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setAddress("http://localhost:8080/CodeFirst/hello_world");
HelloWorld client = factory.create(HelloWorld.class);
Element carrot = new Element("hai");
System.out.println(client.getEelement(carrot));
}
}
------------------------------------------------------------------------
The information contained in this electronic message and its attachments
(the "message") is intended solely for the addressees and is confidential
and privileged. If you are not the intended recipient, please notify the
sender by reply e-mail and then destroy the message. Any dissemination,
distribution, forwarding, copying, printing or disclosure, either whole
or partial, is prohibited and may be unlawful.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
------------------------------------------------------------------------
------------------------------------------------------------------------
The information contained in this electronic message and its attachments
(the "message") is intended solely for the addressees and is confidential
and privileged. If you are not the intended recipient, please notify the
sender by reply e-mail and then destroy the message. Any dissemination,
distribution, forwarding, copying, printing or disclosure, either whole
or partial, is prohibited and may be unlawful.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
------------------------------------------------------------------------