是否可以使用 Java 1.5 通过客户端调用在 Java 1.4 上运行的 EJB?
我们有一种情况,我们不想更改在 Java 1.4 上运行的服务器 JVM。但客户端使用的是 Java 1.5,并且我们在调用 EJB 时遇到异常。我们不确定这是我们的应用程序问题还是 EJB 服务器-客户端 JVM 兼容性问题。
We have one scenario where we don't want to change the server JVM which is running on Java 1.4. But the client is using Java 1.5, and we are getting exceptions while calling the EJB. We are not sure whether it's our application issue or an EJB server-client JVM compatibility issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您处理前向兼容性 (FC),因为您尝试在旧服务器 (1.4) 上运行新客户端 (1.5)。 Java不保证FC。它只是保证向后兼容性 (BC),如 自 1.4.2 以来 J2SE 5.0 中的不兼容性中所述(www.oracle.com 上的镜像) :
注意:Sun 文档编写者将术语向后兼容性称为向上兼容性(他们将其描述为“使用版本 1.4.2 编译器构建的类文件将跑步
在 JDK 5.0 中正确”),但这是一个错误,因为:向后==向下 (wiki) 和向前==向上 (wiki)。
You deal with forward compatibility (FC) because you are trying to run new client (1.5) with old server (1.4). Java is not guarantee FC. It's just guarantee backward compatibility (BC) as described in Incompatibilities in J2SE 5.0 since 1.4.2 (mirror at www.oracle.com):
Note: Sun documentation writers call the term backward compatibility as upward compatibility (they describe it as "class files built with version 1.4.2 compilers will run
correctly in JDK 5.0") , but this is a mistake, because: backward==downward (wiki) and forward==upward (wiki).
不确定这是否会影响您正在做的事情...
但是您可以让 EJB 3 与 EJB 2 进行对话。但是您必须采用 EJB 2 风格的通信。因此,在使用 Java 1.5 的情况下,您可能需要确保客户端在 EJB 2 样式查找中查找 EJB 2(或 2.1,因为您是 JDK 1.4)。
Not sure if this plays into what you are doing or not....
But you can get EJB 3's to talk to EJB 2's. However you have to do the communication EJB 2 style. So in your case with Java 1.5, you may need to make sure the client is looking up the EJB 2 (or 2.1 since you are JDK 1.4) in EJB 2 style lookup's.