高手大侠看过来

xiaoxi777 2001-11-08 09:27:02
如何在Tomcat的JSP中调用Weblogic中部署的EJB
我写的程序老是出现ClassCasting错误
...全文
127 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
guohong98 2001-11-16
  • 打赏
  • 举报
回复
做不到,j2ee是一套规范,各家的实现不一样,不能兼容。
haichuang 2001-11-16
  • 打赏
  • 举报
回复
你的Test13Home是你在weblogic中发布的EJB的Home类吗?,以及你的weblogic中的jndi是指向这个Home类的吗?
xiaoxi777 2001-11-15
  • 打赏
  • 举报
回复
50分没人拿啊?
xiaoxi777 2001-11-09
  • 打赏
  • 举报
回复
其实主要的错误就是
java.lang.ClassCastException

在Test13Home test13Home = (Test13Home) PortableRemoteObject.narrow(ref, Test13Home.class);这一行

就是说已经lookup到了,但不能转换类型
inzaghizxy 2001-11-09
  • 打赏
  • 举报
回复
不会把,如此多的errors.
xiaoxi777 2001-11-09
  • 打赏
  • 举报
回复
没有人能解决吗?
xiaoxi777 2001-11-08
  • 打赏
  • 举报
回复
jsp代码:
<%@page import="java.util.*,javax.naming.*,javax.rmi.*"%>
<%@ page contentType="text/html; charset=GBK" %>
<%
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try
{
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null)
{
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
}
Context ctx= new InitialContext(properties);
Object ref = ctx.lookup("Test13");
Test13Home test13Home = (Test13Home) PortableRemoteObject.narrow(ref, Test13Home.class);
}
catch(Exception e)
{
System.out.println("Unable to connect to WebLogic server at " + url);
System.out.println("Please make sure that the server is running.");
throw e;
}
%>
。。。。


出错提示:
2001-11-08 12:25:34 - Ctx( /WebApp ): Exception in: R( /WebApp + /Jsp1.jsp + null) - javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
at _0002fJsp_00031_0002ejspJsp1_jsp_0._jspService(_0002fJsp_00031_0002ejspJsp1_jsp_0.java:98)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at _0002fJsp_00031_0002ejspJsp1_jsp_0._jspService(_0002fJsp_00031_0002ejspJsp1_jsp_0.java:82)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
supershot 2001-11-08
  • 打赏
  • 举报
回复
类型转换错误
nielinjie 2001-11-08
  • 打赏
  • 举报
回复
paste your code

62,635

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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