Topic: JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符

  Print this page

1.JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 Copy to clipboard
Posted by: gj13966288
Posted on: 2003-06-19 21:56

环境是:jb9 和 weblogic6.1sp2 和mysql
客户调用为:
public String linkEJB() {
FruitRemoteHome home = null;

try {
Context ctx = new InitialContext(System.getProperties());
home = (FruitRemoteHome)ctx.lookup("FruitRemote");
Enumeration enum = home.findByName(name3); //就这个name3出错!
FruitRemote fruitRemote = (FruitRemote)enum.nextElement();
fruitRemote.remove();
} catch(Exception e) {
System.out.println("111");
}
return "linkEJB success";
}

编译出错为:
"DeleteAction.java": incompatible types;found : ex15.FruitRemote,required: java.util.Enumeration at line 33, column 41

我的ejb定义的Finder方法是FindByName
input parameter 为String
ejb-ql也写对了
编译通过

可是为什么我的客户端编译出错?请朋友指点。先谢过!

2.Re:JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 [Re: gj13966288] Copy to clipboard
Posted by: ww77721
Posted on: 2003-06-19 22:04

find 结果应该是个 collection 吧

3.Re:JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 [Re: gj13966288] Copy to clipboard
Posted by: gj13966288
Posted on: 2003-06-19 22:35

感谢ww77721
改成collection也不行,我不知道毛病在什么地方,没方向,咳!

4.Re:JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 [Re: gj13966288] Copy to clipboard
Posted by: gj13966288
Posted on: 2003-06-20 15:55

难道就没有高人回答吗?

5.Re:JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 [Re: gj13966288] Copy to clipboard
Posted by: fly2fire
Posted on: 2003-06-20 16:39

胡乱说说.
"DeleteAction.java": incompatible types;found : ex15.FruitRemote,required: java.util.Enumeration at line 33, column 41.
这个说得是findByName的返回值的类型不匹配吧.检查一下这个.

6.Re:JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 [Re: gj13966288] Copy to clipboard
Posted by: gj13966288
Posted on: 2003-06-20 17:31

返回值就2种啊 collection和FruitRemote 我都试验了 怎么能不行呢?我还是没思路。感谢fly2fire。你太谦虚啦。

7.Re:JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 [Re: gj13966288] Copy to clipboard
Posted by: BlurEyes
Posted on: 2003-06-20 17:32

返回的该是FruitRemote吧

FruitRemote fruitRemote = home.findByName(name3);

8.Re:JB9调试CMP,客户端调用Finder方法时,出现incompatible types类型不符 [Re: gj13966288] Copy to clipboard
Posted by: supermy
Posted on: 2003-06-28 15:22

Enumeration enum = home.findByName(name3); //就这个name3出错!
注意 findByName 返回的类型 改为 远程接口 就可。


   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