我已经实现了一个简单的Web服务,Web服务的方法签名是:
public OperationResult createUser(int systemId, int refId, String name,
String password, int planId, BigDecimal amount)
OperationResult类如下:
public class OperationResult implements Serializable {
private static final long serialVersionUID = 1L;
int resultType;
String result;
public OperationResult(int resultType, String result) {
super();
this.resultType = resultType;
this.result = result;
}
public int getResultType() {
return resultType;
}
public void setResultType(int resultType) {
this.resultType = resultType;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
}
当我尝试使用该服务时,它会抛出这个除了
java.rmi.RemoteException: java.lang.InstantiationException: com.pardis.quota.core.OperationResult; nested exception is:
com.bea.xml.XmlRuntimeException: java.lang.InstantiationException: com.pardis.quota.core.OperationResult
at com.pardis.quota.webservice.Quota_Stub.createUser(Quota_Stub.java:216)
at Test.main(Test.java:20)
Caused by: com.bea.xml.XmlRuntimeException: java.lang.InstantiationException: com.pardis.quota.core.OperationResult
at com.bea.staxb.runtime.internal.ClassLoadingUtils.newInstance(ClassLoadingUtils.java:139)
at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.createIntermediary(ByNameRuntimeBindingType.java:207)
at com.bea.staxb.runtime.internal.AttributeUnmarshaller.unmarshal(AttributeUnmarshaller.java:36)
at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalBindingType(UnmarshalResult.java:179)
at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalType(UnmarshalResult.java:217)
at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshalType(UnmarshallerImpl.java:127)
at weblogic.wsee.bind.runtime.internal.LiteralDeserializerContext.unmarshalType(LiteralDeserializerContext.java:72)
at weblogic.wsee.bind.runtime.internal.BaseDeserializerContext.internalDeserializeType(BaseDeserializerContext.java:172)
at weblogic.wsee.bind.runtime.internal.BaseDeserializerContext.deserializeType(BaseDeserializerContext.java:86)
at weblogic.wsee.bind.runtime.internal.BaseDeserializerContext.deserializeWrappedElement(BaseDeserializerContext.java:135)
at weblogic.wsee.codec.soap11.SoapDecoder.decodePart(SoapDecoder.java:486)
at weblogic.wsee.codec.soap11.SoapDecoder.decodeReturn(SoapDecoder.java:404)
at weblogic.wsee.codec.soap11.SoapDecoder.decodeParts(SoapDecoder.java:174)
at weblogic.wsee.codec.soap11.SoapDecoder.decode(SoapDecoder.java:125)
at weblogic.wsee.codec.soap11.SoapCodec.decode(SoapCodec.java:180)
at weblogic.wsee.ws.dispatch.client.CodecHandler.decodeOutput(CodecHandler.java:127)
at weblogic.wsee.ws.dispatch.client.CodecHandler.decode(CodecHandler.java:104)
at weblogic.wsee.ws.dispatch.client.CodecHandler.handleResponse(CodecHandler.java:81)
at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:287)
at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:271)
at weblogic.wsee.ws.dispatch.client.ClientDispatcher.handleResponse(ClientDispatcher.java:213)
at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDispatcher.java:150)
at weblogic.wsee.ws.WsStub.invoke(WsStub.java:87)
at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:337)
at com.pardis.quota.webservice.Quota_Stub.createUser(Quota_Stub.java:207)
... 1 more
Caused by: java.lang.InstantiationException: com.pardis.quota.core.OperationResult
at java.lang.Class.newInstance0(Class.java:340)
at java.lang.Class.newInstance(Class.java:308)
at com.bea.staxb.runtime.internal.ClassLoadingUtils.newInstance(ClassLoadingUtils.java:137)
... 25 more
我正在使用weblogic 10,当我使用weblogic测试服务时,它成功运行
但是当我通过java代码使用它时它会失败。
提前致谢
答案 0 :(得分:5)
我的猜测是,您需要添加无参数构造函数:
public OpreationResult() {
}
stacktrace指向那个方向。
我希望它有所帮助。