jsp调用EJB出错,请大侠帮忙看看,急急急

dotcom 2002-08-28 06:44:48
我用jbuilder6和Weblogic结合,用jbuilder发布到weblogic后,用jsp调用,lookup()是没有报异常,但是接下来我用到jar里面的类的时候却报错

InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("TimeFunction");

TimeFunctionHome timeFunctionHome;
timeFunctionHome = (TimeFunctionHome) PortableRemoteObject.narrow(ref, TimeFunctionHome.class);
TimeFunction timeFunction = timeFunctionHome.create();
//以上最后三句执行的时候出错:
cannot resolve symbol
probably occurred due to an error in /hello.jsp line 62:
TimeFunctionHome timeFunctionHome;
。。。。。。

...全文
16 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
dragon_lxl 2002-09-02
  • 打赏
  • 举报
回复
把你的.jar import 进去
dotcom 2002-08-29
  • 打赏
  • 举报
回复
唉,我现在只要在jsp文件出现jar里面的class名都说找不到!不知道什么原因
wjmmml 2002-08-28
  • 打赏
  • 举报
回复
给你一个webshpere下的我测试通过的离子,本质上映该一向样的,你看看。


<%@ page import="Converter,ConverterHome,javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>
<%!
private Converter converter = null;

public void jspInit() {
try {
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");
ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objRef, ConverterHome.class);
converter = home.create();
} catch (RemoteException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (CreateException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (NamingException ex) {
System.out.println("Unable to lookup home: "+ "TheConverter "+ ex.getMessage());
}
}

public void jspDestroy() {
converter = null;
}
%>
<html>
<head>
<title>Converter</title>
</head>

<body bgcolor="white">
<h1><b><center>Converter</center></b></h1>
<hr>
<p>Enter an amount to convert:</p>
<form method="get">
<input type="text" name="amount" size="25">
<br>
<p>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>

<%
String amount = request.getParameter("amount");
if ( amount != null && amount.length() > 0 ) {
BigDecimal d = new BigDecimal (amount);
%>
<p>
<%= amount %> dollars are <%= converter.dollarToYen(d) %> Yen.
<p>
<%= amount %> Yen are <%= converter.yenToEuro(d) %> Euro.
<%
}
%>

</body>
</html>
Joeblackyang 2002-08-28
  • 打赏
  • 举报
回复
没有 import 进来吧?

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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