我在学习用jboss,tomcat 搭建ejb服务时,报以下异常,请问这代表什么意思呀!!
谢谢各位了!!
-------------------------------------------------------------
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
java.lang.ClassCastException
com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
org.apache.jsp.common_jsp.jspInit(common_jsp.java:28)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:78)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:155)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:315)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.17
----------------解决方案--------------------------------------------------------
出错页程序:
<%@ page import="mypack.*"%>
<%@ page import="java.util.Properties"%>
<%@ page errorPage="errorpage.jsp"%>
<%@ page import="javax.ejb.*"%>
<%@ page import="javax.naming.*"%>
<%@ page import="javax.rmi.PortableRemoteObject"%>
<%@ page import="java.rmi.RemoteException"%>
<%
private BookDBEJB bookDB;
public void jspInit(){
bookDB = (BookDBEJB)getServletContext.getAttribute("bookDB");
if(bookDB==null){
try{
InitialContext ic = new InitialContext();
Object objRef=ic.lookup("java:comp/env/ejb/BookDBEJB");
BookDBEJBHome home=(BookDBEJBHome)PortableRemoteObject.narrow(objRef,mypack.BookDBEJBHome.class);
bookDB=home.create();
getServletContext().setAttribute("bookDB",bookDB);
}catch(RemoteException ex){
System.out.println("Could not create database bean."+ex.getMessage());
}catch(CreateException ex){
System.out.println("Could not create database bean."+ex.getMessage());
}catch(NamingException ex){
System.out.println("Unable to look up home:"+"java:comp/env/ejb/BookDBEJB"+ex.getMessage());
}
}
}
public void jspDestroy(){
bookDB=null;
}
public String convert(String s){
try{
return new String(s.getBytes("ISO-8859-1"),"GB2312");
}catch(Exception e){
return null;
}
}
%>
------------------------------------------------------------------
谢谢!!!!!
----------------解决方案--------------------------------------------------------