xFire 出现的问题 , 请各位大师们帮忙看看, 谢谢。。。

:( 刚学习WebService,就发现问题啦, 一直没有解决, 真烦, 现在将遇到的问题贴出来, 给大家看看。。

程序报的错误是:
org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't instantiate class. com.northking.pojo.Student
org.codehaus.xfire.fault.XFireFault: Couldn't instantiate class. com.northking.pojo.Student

Student类:
ublic class Student {
String userName;

String userNo;

String userAge;

public Student(String name, String userNo, String age) {
this.userName = name;
this.userAge = age;
this.userNo = userNo;
}

public String getUserAge() {
return userAge;
}

public void setUserAge(String userAge) {
this.userAge = userAge;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}

public String getUserNo() {
return userNo;
}

public void setUserNo(String userNo) {
this.userNo = userNo;
}

}

Service.xml :

colStudent
com.northking.wsdemo.ICollStudent

com.northking.wsdemo.CollStudentImpl


literal
application


ICollStudent:

public interface ICollStudent {
/**
* 获取student信息
*
* @return
*/
public Collection getStudentInfo();

}

CollstudentImpl:
public class CollStudentImpl implements ICollStudent {

/**
* 获取student信息
*
* @return
*/
public Collection getStudentInfo() {
Collection col = new ArrayList();
col.add(new Student("cheng", "001", "29"));
col.add(new Student("Li", "002", "29"));

return col;

}

}


上面这些是用xfire定义了实现WebService的接口,类,以及service.xml。 下面, 我是在客户端调用这个service.

Service srvcModel = new ObjectServiceFactory()
.create(ICollStudent.class);
XFireProxyFactory factory = new XFireProxyFactory(XFireFactory
.newInstance().getXFire());
String serviceWSDL = "http://localhost:8080/StudyWebService/services/colStudent";

try {

ICollStudent compService = (ICollStudent) factory.create(srvcModel,
serviceWSDL);

[b]Collection studentCol = compService.getStudentInfo();[/b]

} catch (Exception e) {
e.printStackTrace();

}
当一开始调用service时,就报错啦, 出错的日志如下:
org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't instantiate class. com.northking.pojo.Student
org.codehaus.xfire.fault.XFireFault: Couldn't instantiate class. com.northking.pojo.Student
at org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:221)
at org.codehaus.xfire.aegis.type.basic.ArrayType.readCollection(ArrayType.java:80)
at org.codehaus.xfire.aegis.type.collection.CollectionType.readObject(CollectionType.java:36)
at org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:154)
at org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206)
at org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50)
at org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Client.onReceive(Client.java:382)
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
at org.codehaus.xfire.client.Client.invoke(Client.java:335)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy0.getStudentInfo(Unknown Source)
at com.northking.client.ServiceClient.main(ServiceClient.java:37)
Caused by: java.lang.InstantiationException: com.northking.pojo.Student
at java.lang.Class.newInstance0(Class.java:335)
at java.lang.Class.newInstance(Class.java:303)
at org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:124)
... 18 more


请问,各位大师们, 这个问题该如何解决啊, 刚学就遇到了这个问题, 给我的打击特别大啊。。。。。。 求各位大师帮忙。。。 谢。

你可能感兴趣的:(xFire 出现的问题 , 请各位大师们帮忙看看, 谢谢。。。)