GlassFish远程调用EJB传输CachedRowSet问题

lilopeng 2009-10-28 10:14:56
为什么?在EJB里无法传输CachedRowSet 调用时老是报错。

下面是Ejb远程的一个方法。
 public CachedRowSet GetDataSet(String pSQL)
{
//定义离线数据集
CachedRowSet rs = null;
try
{
/**
* 从服务器连接池中初始化数据库连接
*/
rs = new CachedRowSetImpl();
rs.setDataSourceName("jdbc/OracleConn");
rs.setCommand(pSQL);
rs.execute();
} catch (SQLException ex) {
Logger.getLogger(NewSessionBean.class.getName()).log(Level.SEVERE, null, ex);
}
return rs;
}

下面是WebService里的一个调用方法。
@WebMethod(operationName = "GetDataSet")
public String GetDataSet(@WebParam(name = "pStr")
String pStr) {
String lResult = "";
ejb.NewSessionRemote EjbRef = GetEjbObject("127.0.0.1", "3700", "DBEjb");
RowSet rs = EjbRef.GetDataSet(pStr);
try
{
while(rs.next())
lResult += rs.getString(1);
}
catch(java.sql.SQLException err)
{
err.printStackTrace();
}
return lResult;
}
private ejb.NewSessionRemote GetEjbObject(String pIP, String pPort, String pJndi)
{
ejb.NewSessionRemote lEjbRef = null;
try {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", pIP);
props.setProperty("org.omg.CORBA.ORBInitialPort", pPort);
InitialContext ctx = new InitialContext(props);
lEjbRef = (ejb.NewSessionRemote) ctx.lookup(pJndi);
} catch (NamingException ex) {
Logger.getLogger(NewWebService.class.getName()).log(Level.SEVERE, null, ex);
}
return lEjbRef;
}

老是提示这样的错误
Service invocation threw an exception with message : null; Refer to the server log for more details
连接池中的数据库连接是没有问题的,以经测试过了。

忘高手大哥帮忙解决,小弟不胜感谢。
...全文
98 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lilopeng 2009-10-28
  • 打赏
  • 举报
回复
谢谢帮顶!自个再顶一下!小弟很急,望高手大侠们帮解决。或出个方案也行。
zl3450341 2009-10-28
  • 打赏
  • 举报
回复
不清楚

帮顶一下
lilopeng 2009-10-28
  • 打赏
  • 举报
回复
怎么没有人知道吗?高手们希忘帮忙解决,分不够的话可以再加,谢谢了。
lilopeng 2009-10-28
  • 打赏
  • 举报
回复
顶!有没有人会啊。
lilopeng 2009-10-28
  • 打赏
  • 举报
回复
顶没有人会吗?这问题这么难?

67,516

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧