Http invoker求高人指点
Http Invoker是否能返回对象?
代码如下
PrintApplay.java(服务端与客户端的都一样)
public class PrintApply implements Serializable { private static final long serialVersionUID = 1L; private String yybs; private String sjbbs; private String fqbs; public String getYybs() { return yybs; } public void setYybs(String yybs) { this.yybs = yybs; } public String getSjbbs() { return sjbbs; } public void setSjbbs(String sjbbs) { this.sjbbs = sjbbs; } public String getFqbs() { return fqbs; } public void setFqbs(String fqbs) { this.fqbs = fqbs; }
import com.hxsmart.sicard.si.model.PrintApply;public interface RemoteService { public PrintApply receivePrintApply(String name,String idcd,String bankId,String nodeName,String nodeId);}
public class RemoteServiceImpl implements RemoteService { private ClientService clientService; @Override public PrintApply receivePrintApply(String name, String idcd, String bankId, String nodeName, String nodeId) { StringBuffer sb = new StringBuffer(); sb.append(name).append(idcd).append(bankid).append(nodeName).append(nodeId); List<PrintApply> list = clientService.sentMsg(sb.toString()); PrintApply printApply = list.get(0); return printApply; }}
public class RemoteExchgsvrServerImpl implements RemoteExchgsvrServer { @Override public List PrintInfoApply(String idcd, String name, String bankId, String nodeId, String nodeName) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("remote.xml"); try { RequestService service = (RequestService) applicationContext.getBean("remoteService"); PrintApply printApply = service.receivePrintApply(name, idcd, bankId, nodeName, nodeId); } catch (Exception e) { e.printStackTrace(); } return null; }}
PrintApply printApply = service.receivePrintApply(name, idcd, bankId, nodeName, nodeId);
at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.doReadRemoteInvocationResult(AbstractHttpInvokerRequestExecutor.java:225)
at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.readRemoteInvocationResult(AbstractHttpInvokerRequestExecutor.java:174)
at org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor.doExecuteRequest(SimpleHttpInvokerRequestExecutor.java:64)
at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:69)
at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:146)
at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:120)
... 86 more
客户端是没有任何地方声明或使用com.hxsmart.sicard.si.model.PrintApply这个的,确定没有,可是为什么提示找不到这个呢?求解!
[解决办法]
在你的xml中是否有声明 PrintApply 这个类,如果没有你客户端肯定会报java.lang.ClassNotFoundException: com.hxsmart.sicard.si.model.PrintApply
因为这个类应该是在你的服务端的,但是你现在客户端要用到,不声明的话一定会报错