用JBuilder6.0+WebLogic6.0開發EJB的一個問題?

andyzhu98 2002-11-13 01:47:45
我用http://bdn.borland.com/article/images/28943/12289_3jbweblogic.pdf上的Working with entity beans的例子,在JBuilder6.0+WebLogic6.0環境上開發,make成功後在運行時提示如下錯誤;
C:\JBuilder6\jdk1.3.1\bin\javaw -classpath "D:\Zhunian\MyProject\TestEntity\TestEnt\classes;C:\bea\wlserver6.1\lib\weblogic_sp.jar;C:\bea\wlserver6.1\lib\weblogic.jar;C:\JBuilder6\lib\jdsserver.jar;C:\JBuilder6\lib\beandt.jar;C:\JBuilder6\lib\dx.jar;C:\JBuilder6\lib\jbuilder.jar;C:\JBuilder6\lib\help.jar;C:\JBuilder6\lib\gnuregexp.jar;C:\JBuilder6\jdk1.3.1\demo\jfc\Java2D\Java2Demo.jar;C:\JBuilder6\jdk1.3.1\jre\lib\i18n.jar;C:\JBuilder6\jdk1.3.1\jre\lib\jaws.jar;C:\JBuilder6\jdk1.3.1\jre\lib\rt.jar;C:\JBuilder6\jdk1.3.1\jre\lib\sunrsasign.jar;C:\JBuilder6\jdk1.3.1\lib\dt.jar;C:\JBuilder6\jdk1.3.1\lib\htmlconverter.jar;C:\JBuilder6\jdk1.3.1\lib\tools.jar" testent.EmpSesTestClient
-- Initializing bean access.
javax.naming.NameNotFoundException: Unable to resolve EmployeeSes. Resolved: '' Unresolved:'EmployeeSes' ; remaining name ''
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:85)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)-- Failed initializing bean access.

at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy0.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at testent.EmpSesTestClient.<init>(EmpSesTestClient.java:27)
at testent.EmpSesTestClient.main(EmpSesTestClient.java:155)
-- Calling create()
java.lang.NullPointerException
at testent.EmpSesTestClient.create(EmpSesTestClient.java:79)
at testent.EmpSesTestClient.main(EmpSesTestClient.java:157)
-- Failed: create()
-- Return value from create(): null.
Error in getEmpName(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.
Employee Name from the Test Client is =

我又試著部署,提示如下錯誤;
C:\JBuilder6\jdk1.3.1\bin\javaw -classpath ";C:\bea\wlserver6.1\lib\weblogic_sp.jar;C:\bea\wlserver6.1\lib\weblogic.jar;" weblogic.deploy -component TestEntMod:myserver deploy 19781025 TestEntMod D:/Zhunian/MyProject/TestEntity/TestEnt/TestEntMod.jar
weblogic.j2ee.DeploymentException: Error deploying application TestEntMod:

Unable to deploy EJB: Employee from TestEntMod.jar:

The DataSource with the JNDI name: DemoDataSource could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.



at weblogic.deploy.deploy(deploy.java:665)
at weblogic.deploy.runBody(deploy.java:358)
at weblogic.utils.compiler.Tool.run(Tool.java:79)
at weblogic.deploy.main(deploy.java:1601)
Error deploying application TestEntMod:

Unable to deploy EJB: Employee from TestEntMod.jar:

The DataSource with the JNDI name: DemoDataSource could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.

不知是何故,請指教,謝謝.
...全文
97 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
cenjava 2002-11-28
  • 打赏
  • 举报
回复
没用过,好用吗?有没有人能不能回答以上问题啊?
Carlson Wang 2002-11-28
  • 打赏
  • 举报
回复
哪有讲如何用JB在WEBSPHERE下配置EJB的文章啊?能贴出来吗?
cenjava 2002-11-27
  • 打赏
  • 举报
回复
seaarmory(aaa) 朋友请回话啊
cenjava 2002-11-27
  • 打赏
  • 举报
回复
up
jery_lee 2002-11-27
  • 打赏
  • 举报
回复
为什么没有人用WEBSPHERE?
cenjava 2002-11-26
  • 打赏
  • 举报
回复
我也出现楼主同样的问题,不知那一位热心朋友能够回答一下,seaarmory(aaa) 朋友能不能说的详细一点,究竟是哪个目录下的web.xml文件需要修改,我被这个问题困扰很长时间了,感谢了!
worldheart 2002-11-22
  • 打赏
  • 举报
回复
你可以参考这篇文章。

http://www.csdn.net/develop/read_article.asp?id=15283

如果还是不行,可以找我。

MSN:worldheart@msn.com

因为我最近很忙,不能细看您的问题。不好意思。
yankk 2002-11-19
  • 打赏
  • 举报
回复
我也是这个问题
是在Object ref = ctx.lookup("yourEJBname");这个地方出的问题
我的ejb名字是Enterprise1
*******In the main function()********

Creating Enterprise1TestClient1

-- ************Initializing bean access.

-- *********8Begin to lookup jndi name

javax.naming.NameNotFoundException: Unable to resolve Enterprise1. Resolved: '' Unresolved:'Enterprise1' ; remaining name ''

at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:85)

at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)

at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)-- ***************Failed initializing bean access.
不知道怎么解决
等待!

to seaarmory(aaa):
我怎么找不到你说的文件和路径?
麻烦说的清楚一点,谢谢!

seaarmory 2002-11-15
  • 打赏
  • 举报
回复
我想可能是在bea下又一个目录叫WEB_INF有两个.xml文件一个是web.xml.还有一个我忘记了,在同一目录下面的。这里面改成你的开发路径就好了我以前也碰到这样的问题不能发布,直接修改就好了!
chen_2001 2002-11-14
  • 打赏
  • 举报
回复
uo
weilinwu 2002-11-13
  • 打赏
  • 举报
回复
DemoDataSource 这个东东没在Weblogic里配置吧?

建议你看看http://www.ccw.com.cn/htm/center/prog/02_5_23_4.asp
andyzhu98 2002-11-13
  • 打赏
  • 举报
回复
我用的是http://bdn.borland.com/article/images/28943/12289_3jbweblogic.pdf
中的Working with entity beans中的例子,主要的代碼如下:
Import a database schema部分
Driver: com.borland.datastore.jdbc.DataStoreDriver
URL: jdbc:borland:dsremote://localhost//C:\JBuilder6\samples\JDataStore\datastores\employee.jds
JNDI name: DemoDataSource.

接著根據EMPLOYEE表Create Entity Bean(Employee);

session bean部分(EmployeeSes)
Add a method to EmployeeSes and provide the following parameters.
Method name: getEmpName
Return type: String
Input parameters : Short empNo
Interfaces: remote
public String getEmpName(Short empNo) {
String empName = "name not found";
try {
javax.naming.Context context = new javax.naming.InitialContext();
Object object = context.lookup("java:comp/env/ejb/Employee");
EmployeeHome empHome = (EmployeeHome) javax.rmi.PortableRemoteObject.narrow(object,
EmployeeHome.class);
Employee emp = empHome.findByPrimaryKey(empNo);
empName = emp.getFirstName() + " " + emp.getLastName();
}catch (NamingException ex) {
ex.printStackTrace();
}catch (ClassCastException ex) {
ex.printStackTrace();
}catch (Exception ex){
ex.printStackTrace();
}
return empName;
}

然後就是Assign entity bean reference to session bean

test client部分(EmpSesTestClient)
public static void main(String[] args) {
EmployeeSesTestClient client = new EmployeeSesTestClient();
try {
client.create();
String empName = client.getEmpName(new Short("2"));
System.out.println("Employee Name from the Test Client is = " + empName);
}
catch (Exception ex) {
ex.printStackTrace();
}
}

開始的時候我沒有用連接池,添加後依然不能使用.
我換了數據庫oracle創建Entity bean依然顯示同樣的問題,請大家賜教.
萬分感謝.
tuhongyu 2002-11-13
  • 打赏
  • 举报
回复
原代码呢?

1,220

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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