Max Korn [
https://community.jboss.org/people/developer251] created the discussion
"No-arg default constructor error when deploying Web Service"
To view the discussion, visit:
https://community.jboss.org/message/791939#791939
--------------------------------------------------------------
Hi all !
I'm badly stuck with a weird exception that I get when I deploy a Webservice on JBoss
As 7.1.1.
The Web Service itself is simple and returns in a method a List of Counters:
@XmlRootElement
public class Counter implements Serializable {
private Counter() {
}
private Counter(int price) {
this.price = price;
}
private int id;
private String desc
private int price;
. . . .
}
@WebService
public class CounterWS implements CounterWSItf, Serializable {
@Inject InfoService service;
@Override
public List<Counter> getCounters() {
return service.getCounters();
}
However I get the following exception once I deploy it:
*Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions*
*com.telco.model.Counter does not have a no-arg default constructor.*
* this problem is related to the following location:*
* at com.telco.model.Counter*
* at private java.util.List
com.telco.ws.jaxws_asm.GetCounterssResponse._return*
* at com.telco.ws.jaxws_asm.GetCountersResponse*
at
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
[rt.jar:1.6.0_31]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:392) [rt.jar:1.6.0_31]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618) [rt.jar:1.6.0_31]
at org.apache.cxf.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:260)
at
org.apache.cxf.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:169)
at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:423)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:291)
... 24 more
As you can see, there is a default constructor in the Counter class. I've tried also
removing the other constructor without success.
By removing the type <Counter> from the List it actually deploys but once I invoke
it from the Client, I get another type of Error, that the Counter type is unknown (!!).
Is it a bug or something else I'm missing ?
Thanks a lot
Max
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/791939#791939]
Start a new discussion in JBoss Web Services at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]