weblogic EJB分布式部署的问题,急~~~~~~~在线等,高分送,分多多
公司系统:认证模块的 Message-Dirven bean 和几个Session bean部署在远端机,Web application 和其他EJB部署在本机。本机的Bean 发送消息驱动远端的Message Bean,Message Bean调用 Session Bean做出相应的响应和操作。Session Bean中操作数据库插入一条有Blob数据时发生异常:NotSerializableException :oracle.sql.BLOB ;.............。但是我在本机写了一个client 程序调用远端的session bean的接口操作没问题。
报错代码如下:
public String createDataLog(DataLog data) throws Exception {
Connection c = null;
PreparedStatement ps = null;
ResultSet rs = null;
java.sql.Blob blob = null;
OutputStream out = null;
String returncode = "0";
try {
c = DB.getConnection();
ps = c.prepareStatement(this.INS_SQL);
ps.setString(1, data.getTime());
ps.setTimestamp(2, data.getTrans_date());
ps.setString(3, data.getEntitle_index());
ps.setString(4, data.getEntitlecode());
ps.setString(5, data.getFactory());
ps.setString(6, data.getPackage_id());
ps.setString(7, data.getPackage_data());
ps.setString(8, data.getState());
ps.execute();
ps.close();
String transdate = data.getTrans_date().toString();
transdate = transdate.substring(0, transdate.length() - 2);
String query =
"select v_package_buffer from ca_datacmd_log where c_entitle_index= '" +
data.getEntitle_index() + "' for update";
ps = c.prepareStatement(query);
rs = ps.executeQuery();
while (rs.next()) { //这里抛出异常~~~~~~~~~~~~~~~~~~~~~``
System.out.println(rs.getBlob(1).getClass());
blob = (java.sql.Blob)rs.getBlob("v_package_buffer");
}
ps = c.prepareStatement(
"update ca_datacmd_log set v_package_buffer=? where c_entitle_index= '" +
data.getEntitle_index() + "'");
out = ( (OracleThinBlob) blob).getBinaryOutputStream();
out.write(data.getPackage_buffer());
ps.setBlob(1, blob);
ps.executeUpdate();
rs.close();
returncode = "1";
}
catch (Exception e) {
e.printStackTrace();
this.sessionContext.setRollbackOnly();
throw e;
}
finally {
try {
if (out != null) {
out.close();
}
if (ps != null) {
ps.close();
}
if (c != null) {
c.close();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
return returncode;
}