最近做项目需要用到webService 在客户端调用服务端添加用户的一个方法 。。传的是一个参数数组Object[] ,我在客户端把String,blob这些放进去以后。。调用方法。。结果报错。。下面这个是异常信息:
java.lang.UnsupportedOperationException: Blob may not be manipulated from creating session
at org.hibernate.lob.BlobImpl.excep(BlobImpl.java:104)
at org.hibernate.lob.BlobImpl.getBytes(BlobImpl.java:50)
at org.hibernate.lob.SerializableBlob.getBytes(SerializableBlob.java:35)
at com.ehome.dao.UserDao.addObject(UserDao.java)
at com.ehome.biz.UserBiz.addUser(UserBiz.java)
at com.ehome.actions.UserAction.doRegister(UserAction.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
看了一下应该就是Blob有问题。。但是我在客户端没有直接放Blob。。而是把Blob转成 byte[] ,
java Code:
userInterface.addOjbect(new Object[]{t.getUserName(),t.getUserPwd(),t.getRealName(),t.getUserSex(),t.getHeadImg().getBytes(0, new Long(t.getHeadImg().length()).intValue())}); //这里是转换
t 是这我的一个pojo对象。。顺便贴一下映射文件:
seq_userid
请各位大虾们指教一下。。。小弟初次做ssh+XFire这种 项目 。。。好多问题。。。请多多指教一下。
然后在客户端再转成blob的。。 服务端还没被调用 就报了这个错。。不知道该怎么解决 。。
作者: zhaolonggui
发布时间: 2010-09-14