访问 EJB3 时 JBoss 类强制转换异常

发布于 2024-08-05 09:19:10 字数 1592 浏览 10 评论 0原文

我在使用 EJB3 时遇到了一个奇怪的问题。已部署 EJB3,并尝试从已部署的实例访问业务方法。 执行查找时出现以下错误:

  • UserAuthenticationRemote 是远程 i/face
  • UserAuthenticationBean 是 Bean

代码(失败):

UserAuthenticationRemote remoteInterface = (UserAuthenticationRemote) context.lookup("UserAuthenticationBean/remote");

错误日志:

    java.lang.ClassCastException: javax.naming.Reference cannot be cast to eds.enhancedqc.authentication.UserAuthenticationRemote 
            at        eds.enhancedqc.client.application.LoginDialog$3.doInBackground(LoginDialog.java:220)
            at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)

    Exception "java.lang.ClassNotFoundException: org.openide.loaders.DataObject"while constructing DataFlavor for: application/x-java-openide-dataobjectdnd; mask=1; class=org.openide.loaders.DataObject
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    Exception "java.lang.ClassNotFoundException: org.openide.loaders.DataObject"while constructing DataFlavor for: application/x-java-openide-dataobjectdnd; mask=1; class=org.openide.loaders.DataObject
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)

请帮忙!

谢谢, 山姆

I am having a weird problem here with EJB3. Deployed and EJB3 and am trying to access the business method from the deployed instance.
I get the following error when the lookup is executed:

  • UserAuthenticationRemote is the remote i/face
  • UserAuthenticationBean is the Bean

Code (which fails):

UserAuthenticationRemote remoteInterface = (UserAuthenticationRemote) context.lookup("UserAuthenticationBean/remote");

Error log:

    java.lang.ClassCastException: javax.naming.Reference cannot be cast to eds.enhancedqc.authentication.UserAuthenticationRemote 
            at        eds.enhancedqc.client.application.LoginDialog$3.doInBackground(LoginDialog.java:220)
            at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)

    Exception "java.lang.ClassNotFoundException: org.openide.loaders.DataObject"while constructing DataFlavor for: application/x-java-openide-dataobjectdnd; mask=1; class=org.openide.loaders.DataObject
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    Exception "java.lang.ClassNotFoundException: org.openide.loaders.DataObject"while constructing DataFlavor for: application/x-java-openide-dataobjectdnd; mask=1; class=org.openide.loaders.DataObject
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)

Please help!

Thanks,
Sam

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慕烟庭风 2024-08-12 09:19:10

问题仅出在 jar 文件上。因此,从您的项目中删除所有 jar 文件,并从 jboss-6.0.0.Final\client 文件夹(这是您正在运行的服务器)中获取 jar 文件,并将其作为类路径,然后它将运行良好

The problem is with the jar file only. so remove all the jar file form you project and take the jar file from jboss-6.0.0.Final\client folder, which is your running server and put as class path then it will run fine

明明#如月 2024-08-12 09:19:10

导入 jbossall-client.jar 并从类路径中删除 jboss-client.jar

import jbossall-client.jar and remove jboss-client.jar from your classpath

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文