访问 EJB3 时 JBoss 类强制转换异常
我在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题仅出在 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
导入 jbossall-client.jar 并从类路径中删除 jboss-client.jar
import jbossall-client.jar and remove jboss-client.jar from your classpath