高手大侠看过来

xiaoxi777 厦门中软海晟信息有限公司 高级软件架构师  2001-11-08 09:27:02
如何在Tomcat的JSP中调用Weblogic中部署的EJB
我写的程序老是出现ClassCasting错误
...全文
72 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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
回复
相关推荐
发帖
Java SE
创建于2007-09-28

6.1w+

社区成员

Java 2 Standard Edition
申请成为版主
帖子事件
创建了帖子
2001-11-08 09:27
社区公告
暂无公告