Max Korn
2013-01-15 09:45:46 UTC
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&containerType=14&container=2044]
"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&containerType=14&container=2044]