Servlet和Session之间Collecion的传递问题,急~~~~在线等555....
SessionBean:
public java.util.Collection listalluser() {
customHome home = null;
try
{
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
Context ctx = new InitialContext(env);
home = (customHome) ctx.lookup("custom");
return home.findAllUser();
//home.findAllUser()是CMP的方法,返回类型:java.util.Collecion
}
然后到Servlet里面:
private void listalluser(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
Context ctx = null;
try
{
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ctx = new InitialContext(env);
Object ref = ctx.lookup("customsession");
customsessionHome home = (customsessionHome) PortableRemoteObject.narrow(ref,customsessionHome.class);
customsession session = home.create();
ArrayList alluser = new ArrayList(session.listalluser());
//上面的语句出错:(
//错误代码:<Error><HTTP><101017><[ServletContext(id=5563596,name=soundbox,context-path=/soundbox)]>Root cause of ServletException java.lang.AbstractMethodError at.....
System.out.println("OK ArrayList");
request.getSession().setAttribute("alluser",alluser);
response.sendRedirect("listuser.jsp");
}