Topic: 请教EJB的一个问题

  Print this page

1.请教EJB的一个问题 Copy to clipboard
Posted by: ancin
Posted on: 2006-06-16 08:55

在EJB的Lookup JNDI的时候为什么会出现如此的错误呢。请各位英雄指教:

13:22:41,890 ERROR [STDERR] java.lang.ClassCastException
13:22:41,890 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
13:22:41,890 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
13:22:41,890 ERROR [STDERR] at org.apache.jsp.Myjsp.TestTree_jsp._jspService(TestTree_jsp.java:104)
13:22:41,890 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
13:22:41,890 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
13:22:41,890 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
13:22:41,890 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
13:22:41,890 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
13:22:41,890 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
13:22:41,890 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
13:22:41,890 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
13:22:41,890 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
13:22:41,890 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
13:22:41,890 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
13:22:41,890 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
13:22:41,890 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
13:22:41,890 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
13:22:41,890 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
13:22:41,890 ERROR [STDERR] Caused by: java.lang.ClassCastException: $Proxy85
13:22:41,890 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
13:22:41,890 ERROR [STDERR] ... 26 more

在我JSP的页面的一个简单Test代码段如下:
<%
try {
Context jndiContext = new InitialContext();
Object ref = jndiContext.lookup("TravelAgentHomeRemote");
TravelAgentHomeRemote home = (TravelAgentHomeRemote) PortableRemoteObject
.narrow(ref, TravelAgentHomeRemote.class);
TravelAgentRemote travelAgent = home.create();

String list[] = travelAgent.listCabins(1, 3);
for (int i = 0; i < list.length; i++) {
System.out.println(list[i]);
}

} catch (java.rmi.RemoteException re) {
re.printStackTrace();
} catch (Throwable t) {
t.printStackTrace();
}
%>
请高手指教;为什么会出现此错误呢。
谢谢。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923