访问EJB3时JBoss类转换异常

时间:2009-09-16 21:16:10

标签: java jboss ejb-3.0 jndi classcastexception

我在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)

请帮忙!

谢谢, 萨姆

2 个答案:

答案 0 :(得分:2)

问题在于只有jar文件。所以删除你项目的所有jar文件形式,并从jboss-6.0.0.Final \ client文件夹中取出jar文件,这是你正在运行的服务器,并作为类路径放置然后它将运行良好

答案 1 :(得分:2)

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