You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by lio axis <li...@gmail.com> on 2005/05/02 17:55:37 UTC
client default constructor ?
Hello World,
My web-services genrated with axis crashes (see the stack trace) after
received the whole response structure.
the constructor of the mentionned class is ;
// Constructor
protected EnumerationStatus(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
I don't understand why as this class has been used by other clients
with other web-services ...
What's wrong?
Any body could help?
Thx,
org.xml.sax.SAXException: Unable to create JavaBean of type
com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
Missing default constructor? Error was:
java.lang.InstantiationException:
com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
at org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:159)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
at org.apache.axis.client.Call.invoke(Call.java:2272)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at com.equant.refce.ipcfm.bouchon.getConfiguration.GetConfigurationV2SOAPBindingStub.getConfiguration(GetConfigurationV2SOAPBindingStub.java:228)
at com.equant.refce.ipcfm.bouchon.testu.GetConfigurationV2ServiceTestCase.test1GetConfigurationV2GetConfiguration(GetConfigurationV2ServiceTestCase.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Re: client default constructor ?
Posted by lio axis <li...@gmail.com>.
maybe it coul be useful for somebody someday :
Don't add empty constructor, just check two things :
- On the server side, the wsdd file must define the proper
serializer/deseralizer when mapping your Enum type :
<typeMapping
xmlns:ns="http://myUrl/myService""
qname="ns:EnumerationConfType"
type="java:org.....MyEnumType"
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
>
- On the client side, the stub defines the same in an other manner :
java.lang.Class enumsf =
org.apache.axis.encoding.ser.EnumSerializerFactory.class;
java.lang.Class enumdf =
org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
qName = new javax.xml.namespace.QName("http://myUrl/myService", "MyEnumType");
cachedSerQNames.add(qName);
cls = EnumerationStatus.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(enumsf);
cachedDeserFactories.add(enumdf);
so long,
On 5/2/05, lio axis <li...@gmail.com> wrote:
> I was suspected so...
> Notice this bean has been generated by axis itself ...
> Moreover it works with other clients...
> Is the enumeration type has a kind of special treatment?
>
> here the generated code by axis :
>
> /**
> * EnumerationStatus.java
> *
> * This file was auto-generated from WSDL
> * by the Apache Axis WSDL2Java emitter.
> */
>
> package ipcfm.GetConfigurationV2;
>
> public class EnumerationStatus implements java.io.Serializable {
> private java.lang.String _value_;
> private static java.util.HashMap _table_ = new java.util.HashMap();
>
> // Constructor
> protected EnumerationStatus(java.lang.String value) {
> _value_ = value;
> _table_.put(_value_,this);
> }
>
> public static final java.lang.String _Success = "Success";
> public static final java.lang.String _Warning = "Warning";
> public static final java.lang.String _Failure = "Failure";
> public static final EnumerationStatus Success = new
> EnumerationStatus(_Success);
> public static final EnumerationStatus Warning = new
> EnumerationStatus(_Warning);
> public static final EnumerationStatus Failure = new
> EnumerationStatus(_Failure);
> public java.lang.String getValue() { return _value_;}
> public static EnumerationStatus fromValue(java.lang.String value)
> throws java.lang.IllegalStateException {
> EnumerationStatus enum = (EnumerationStatus)
> _table_.get(value);
> if (enum==null) throw new java.lang.IllegalStateException();
> return enum;
> }
> public static EnumerationStatus fromString(java.lang.String value)
> throws java.lang.IllegalStateException {
> return fromValue(value);
> }
> public boolean equals(java.lang.Object obj) {return (obj == this);}
> public int hashCode() { return toString().hashCode();}
> public java.lang.String toString() { return _value_;}
> public java.lang.Object readResolve() throws
> java.io.ObjectStreamException { return fromValue(_value_);}
> }
>
> On 5/2/05, Anne Thomas Manes <at...@gmail.com> wrote:
> > You must define the bean with a default constructor.
> >
> > On 5/2/05, lio axis <li...@gmail.com> wrote:
> > > Hello World,
> > >
> > > My web-services genrated with axis crashes (see the stack trace) after
> > > received the whole response structure.
> > >
> > > the constructor of the mentionned class is ;
> > >
> > > // Constructor
> > > protected EnumerationStatus(java.lang.String value) {
> > > _value_ = value;
> > > _table_.put(_value_,this);
> > > }
> > >
> > > I don't understand why as this class has been used by other clients
> > > with other web-services ...
> > >
> > > What's wrong?
> > > Any body could help?
> > >
> > > Thx,
> > >
> > > org.xml.sax.SAXException: Unable to create JavaBean of type
> > > com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
> > > Missing default constructor? Error was:
> > > java.lang.InstantiationException:
> > > com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
> > > at org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:159)
> > > at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
> > > at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
> > > at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
> > > at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
> > > at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
> > > at org.apache.axis.client.Call.invoke(Call.java:2272)
> > > at org.apache.axis.client.Call.invoke(Call.java:2171)
> > > at org.apache.axis.client.Call.invoke(Call.java:1691)
> > > at com.equant.refce.ipcfm.bouchon.getConfiguration.GetConfigurationV2SOAPBindingStub.getConfiguration(GetConfigurationV2SOAPBindingStub.java:228)
> > > at com.equant.refce.ipcfm.bouchon.testu.GetConfigurationV2ServiceTestCase.test1GetConfigurationV2GetConfiguration(GetConfigurationV2ServiceTestCase.java:52)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > at java.lang.reflect.Method.invoke(Method.java:324)
> > > at junit.framework.TestCase.runTest(TestCase.java:154)
> > > at junit.framework.TestCase.runBare(TestCase.java:127)
> > > at junit.framework.TestResult$1.protect(TestResult.java:106)
> > > at junit.framework.TestResult.runProtected(TestResult.java:124)
> > > at junit.framework.TestResult.run(TestResult.java:109)
> > > at junit.framework.TestCase.run(TestCase.java:118)
> > > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
> > > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
> > > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
> > >
> >
>
Re: client default constructor ?
Posted by lio axis <li...@gmail.com>.
I was suspected so...
Notice this bean has been generated by axis itself ...
Moreover it works with other clients...
Is the enumeration type has a kind of special treatment?
here the generated code by axis :
/**
* EnumerationStatus.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package ipcfm.GetConfigurationV2;
public class EnumerationStatus implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected EnumerationStatus(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _Success = "Success";
public static final java.lang.String _Warning = "Warning";
public static final java.lang.String _Failure = "Failure";
public static final EnumerationStatus Success = new
EnumerationStatus(_Success);
public static final EnumerationStatus Warning = new
EnumerationStatus(_Warning);
public static final EnumerationStatus Failure = new
EnumerationStatus(_Failure);
public java.lang.String getValue() { return _value_;}
public static EnumerationStatus fromValue(java.lang.String value)
throws java.lang.IllegalStateException {
EnumerationStatus enum = (EnumerationStatus)
_table_.get(value);
if (enum==null) throw new java.lang.IllegalStateException();
return enum;
}
public static EnumerationStatus fromString(java.lang.String value)
throws java.lang.IllegalStateException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws
java.io.ObjectStreamException { return fromValue(_value_);}
}
On 5/2/05, Anne Thomas Manes <at...@gmail.com> wrote:
> You must define the bean with a default constructor.
>
> On 5/2/05, lio axis <li...@gmail.com> wrote:
> > Hello World,
> >
> > My web-services genrated with axis crashes (see the stack trace) after
> > received the whole response structure.
> >
> > the constructor of the mentionned class is ;
> >
> > // Constructor
> > protected EnumerationStatus(java.lang.String value) {
> > _value_ = value;
> > _table_.put(_value_,this);
> > }
> >
> > I don't understand why as this class has been used by other clients
> > with other web-services ...
> >
> > What's wrong?
> > Any body could help?
> >
> > Thx,
> >
> > org.xml.sax.SAXException: Unable to create JavaBean of type
> > com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
> > Missing default constructor? Error was:
> > java.lang.InstantiationException:
> > com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
> > at org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:159)
> > at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
> > at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
> > at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
> > at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
> > at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
> > at org.apache.axis.client.Call.invoke(Call.java:2272)
> > at org.apache.axis.client.Call.invoke(Call.java:2171)
> > at org.apache.axis.client.Call.invoke(Call.java:1691)
> > at com.equant.refce.ipcfm.bouchon.getConfiguration.GetConfigurationV2SOAPBindingStub.getConfiguration(GetConfigurationV2SOAPBindingStub.java:228)
> > at com.equant.refce.ipcfm.bouchon.testu.GetConfigurationV2ServiceTestCase.test1GetConfigurationV2GetConfiguration(GetConfigurationV2ServiceTestCase.java:52)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:324)
> > at junit.framework.TestCase.runTest(TestCase.java:154)
> > at junit.framework.TestCase.runBare(TestCase.java:127)
> > at junit.framework.TestResult$1.protect(TestResult.java:106)
> > at junit.framework.TestResult.runProtected(TestResult.java:124)
> > at junit.framework.TestResult.run(TestResult.java:109)
> > at junit.framework.TestCase.run(TestCase.java:118)
> > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
> > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
> > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
> >
>
Re: client default constructor ?
Posted by Anne Thomas Manes <at...@gmail.com>.
You must define the bean with a default constructor.
On 5/2/05, lio axis <li...@gmail.com> wrote:
> Hello World,
>
> My web-services genrated with axis crashes (see the stack trace) after
> received the whole response structure.
>
> the constructor of the mentionned class is ;
>
> // Constructor
> protected EnumerationStatus(java.lang.String value) {
> _value_ = value;
> _table_.put(_value_,this);
> }
>
> I don't understand why as this class has been used by other clients
> with other web-services ...
>
> What's wrong?
> Any body could help?
>
> Thx,
>
> org.xml.sax.SAXException: Unable to create JavaBean of type
> com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
> Missing default constructor? Error was:
> java.lang.InstantiationException:
> com.equant.refce.ipcfm.bouchon.getConfiguration.EnumerationStatus.
> at org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:159)
> at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
> at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
> at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
> at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
> at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
> at org.apache.axis.client.Call.invoke(Call.java:2272)
> at org.apache.axis.client.Call.invoke(Call.java:2171)
> at org.apache.axis.client.Call.invoke(Call.java:1691)
> at com.equant.refce.ipcfm.bouchon.getConfiguration.GetConfigurationV2SOAPBindingStub.getConfiguration(GetConfigurationV2SOAPBindingStub.java:228)
> at com.equant.refce.ipcfm.bouchon.testu.GetConfigurationV2ServiceTestCase.test1GetConfigurationV2GetConfiguration(GetConfigurationV2ServiceTestCase.java:52)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
>