为什么在 Wildfly 8.2.1 中访问 EJB 2.1 时出现 ClassCastException?
Why I am getting ClassCastException when accessing EJB 2.1 in Wildfly 8.2.1?
我正在使用 Java 1.7、XDoclet 1.2.3、WildFly 8.2。1.Final、动态 Web 模块 2.5、Eclipse Luna 中的 EJB 2.1。
- 我有一个名为 P001_EAR.
的企业应用程序项目
- 我有一个名为 P001_WAR.
的动态 Web 项目
- 我有一个名为 P001_EJB.
的 EJB 项目
- 我有一个名为 P001_EJBClient.
的 EJB 客户端项目
在 P001_EJB 中,我创建了一个 XDoclet 无状态会话 Bean (EJB 2.1)。
这是它的远程接口:
package com.p001.ejb;
/**
* Remote interface for Test1SLB.
* @generated
* @wtp generated
*/
public interface Test1SLB extends javax.ejb.EJBObject
{
/**
* <!-- begin-xdoclet-definition -->
* @generated //TODO: Must provide implementation for bean method stub */
public java.lang.String foo( java.lang.String param )
throws java.rmi.RemoteException;
}
这是它的主页界面:
package com.p001.ejb;
/**
* Home interface for Test1SLB.
* @generated
* @wtp generated
*/
public interface Test1SLBHome extends javax.ejb.EJBHome
{
public static final String COMP_NAME="java:comp/env/ejb/Test1SLB";
public static final String JNDI_NAME="Test1SLB";
public com.p001.ejb.Test1SLB create()
throws javax.ejb.CreateException,java.rmi.RemoteException;
}
在P001_WAR中我创建了一个Listenerclass命名为P001Listener;在其 contextInitialized
方法中,我试图调用 Test1SLB EJB 的 foo
方法。这是它的代码:
public class P001Listener implements ServletContextListener {
public P001Listener() {
}
public void contextInitialized(ServletContextEvent sce) {
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): inside");
String test1SLBJNDIName = null;
Class test1SLBHomeClass = null;
InitialContext initialContext = null;
Object namedObject = null;
Object ejbHomeObject = null;
Test1SLBHome test1SLBHome = null;
Test1SLB test1SLB = null;
String rtnValue = null;
try {
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB";
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBJNDIName=" + test1SLBJNDIName);
test1SLBHomeClass = Test1SLBHome.class;
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBHomeClass=" + test1SLBHomeClass);
initialContext = new InitialContext();
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): initialContext=" + initialContext);
namedObject = initialContext.lookup(test1SLBJNDIName);
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): namedObject=" + namedObject);
ejbHomeObject = PortableRemoteObject.narrow(namedObject, test1SLBHomeClass);
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): ejbHomeObject=" + ejbHomeObject);
test1SLBHome = (Test1SLBHome) ejbHomeObject;
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBHome=" + test1SLBHome);
test1SLB = test1SLBHome.create();
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLB=" + test1SLB);
rtnValue = test1SLB.foo("pagal");
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): rtnValue=" + rtnValue);
} catch (NamingException ne) {
ne.printStackTrace();
} catch (ClassCastException cce) {
cce.printStackTrace();
} catch (RemoteException re) {
re.printStackTrace();
} catch (CreateException ce) {
ce.printStackTrace();
}
}
public void contextDestroyed(ServletContextEvent sce) {
System.out.println("P001Listener.java: contextDestroyed(ServletContextEvent sce): inside");
}
}
我在 WildFly 上部署了 P001_EAR。这是部署的样子:
P001_EAR.ear
里面P001_EAR.ear我有:
- 元信息
- P001_EJB.jar
- P001_WAR.war
- P001_EJBClient.jar
在META-INF里面我有:
- application.xml
里面P001_EJB.jar我有:
- META-INF\ejb-jar.xml
- META-INF\jboss.xml
- META-INF\MANIFEST.MF
- com\p001\ejb\Test1SLBBean.class
- com\p001\ejb\Test1SLBSession.class
里面P001_WAR.war我有:
- META-INF\MANIFEST.MF
- WEB-INF\web.xml
- WEB-INF\classes\com\p001\listener\P001Listener.class
- WEB-INF\lib
里面P001_EJBClient.jar我有:
- META-INF\MANIFEST.MF
- com\p001\ejb\Test1SLB.class
- com\p001\ejb\Test1SLBHome.class
- com\p001\ejb\Test1SLBLocal.class
- com\p001\ejb\Test1SLB本地Home.class
- com\p001\ejb\Test1SLBUtil.class
我运行野蝇。在 server.log
文件中,我看到 EJB 已成功部署:
2015-12-08 11:21:58,671 INFO
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor]
(MSC service thread 1-3) JNDI bindings for session bean named Test1SLB
in deployment unit subdeployment "P001_EJB.jar" of deployment
"P001_EAR.ear" are as follows:
java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome
java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome
java:module/Test1SLB!com.p001.ejb.Test1SLBHome
java:jboss/exported/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome
java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocalHome
java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocalHome
java:module/Test1SLB!com.p001.ejb.Test1SLBLocalHome
java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB
java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB
java:module/Test1SLB!com.p001.ejb.Test1SLB
java:jboss/exported/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB
java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocal
java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocal
java:module/Test1SLB!com.p001.ejb.Test1SLBLocal
但我在这一行得到 java.lang.ClassCastException
:
ejbHomeObject = PortableRemoteObject.narrow(namedObject, test1SLBHomeClass);
这是server.log
:
2015-12-08 11:21:59,158 INFO [stdout] (MSC service thread 1-9)
P001Listener.java: contextInitialized(ServletContextEvent sce): inside
2015-12-08 11:21:59,159 INFO [stdout] (MSC service thread 1-9)
P001Listener.java: contextInitialized(ServletContextEvent sce):
test1SLBJNDIName=java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB
2015-12-08 11:21:59,161 INFO [stdout] (MSC service thread 1-9)
P001Listener.java: contextInitialized(ServletContextEvent sce):
test1SLBHomeClass=interface com.p001.ejb.Test1SLBHome
2015-12-08 11:21:59,164 INFO [stdout] (MSC service thread 1-9)
P001Listener.java: contextInitialized(ServletContextEvent sce):
initialContext=javax.naming.InitialContext@2db02a6a
2015-12-08 11:21:59,171 INFO [org.jboss.ejb.client] (MSC service
thread 1-9) JBoss EJB Client version 2.0.1.Final 2015-12-08
11:21:59,177 INFO [stdout] (MSC service thread 1-9)
P001Listener.java: contextInitialized(ServletContextEvent sce):
namedObject=Proxy for remote EJB
StatelessEJBLocator{appName='P001_EAR', moduleName='P001_EJB',
distinctName='', beanName='Test1SLB', view='interface
com.p001.ejb.Test1SLB'}
2015-12-08 11:21:59,197 ERROR [stderr] (MSC service thread 1-9)
java.lang.ClassCastException
2015-12-08 11:21:59,198 ERROR [stderr] (MSC service thread 1-9) at
org.jboss.com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:246)
2015-12-08 11:21:59,200 ERROR [stderr] (MSC service thread 1-9) at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:158)
2015-12-08 11:21:59,201 ERROR [stderr] (MSC service thread 1-9) at
com.p001.listener.P001Listener.contextInitialized(P001Listener.java:59)
2015-12-08 11:21:59,202 ERROR [stderr] (MSC service thread 1-9) at
io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
2015-12-08 11:21:59,204 ERROR [stderr] (MSC service thread 1-9) at
io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:194)
2015-12-08 11:21:59,206 ERROR [stderr] (MSC service thread 1-9) at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
2015-12-08 11:21:59,208 ERROR [stderr] (MSC service thread 1-9) at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
2015-12-08 11:21:59,210 ERROR [stderr] (MSC service thread 1-9) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
2015-12-08 11:21:59,211 ERROR [stderr] (MSC service thread 1-9) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
2015-12-08 11:21:59,212 ERROR [stderr] (MSC service thread 1-9) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
2015-12-08 11:21:59,214 ERROR [stderr] (MSC service thread 1-9) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
2015-12-08 11:21:59,215 ERROR [stderr] (MSC service thread 1-9) at
java.lang.Thread.run(Thread.java:745)
2015-12-08 11:21:59,216 ERROR [stderr] (MSC service thread 1-9) Caused
by: java.lang.ClassCastException: com.sun.proxy.$Proxy21 cannot be
cast to org.omg.CORBA.Object
2015-12-08 11:21:59,218 ERROR [stderr] (MSC service thread 1-9) at
org.jboss.com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:225)
2015-12-08 11:21:59,219 ERROR [stderr] (MSC service thread 1-9) ...
11 more
收到此错误消息我做错了什么?
谢谢
更新
我找到了解决办法。当我更改此代码时:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB";
此代码:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome";
然后就成功了。所以基本上我现在正在查找 Home 的 JNDI 名称,然后将其转换为 Home Class。
在旧的 JBoss 4.2.X 中,我查找了 JNDI 名称 Test1SLB
,然后将其转换为 Home Class,它成功了。那么在旧的 JBoss 4.2.X 中是否有 1 个 JNDI 名称 Test1SLB
用于 Remote 和 Home?
我找到了解决办法。当我更改此代码时:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB";
此代码:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome";
然后就成功了。所以基本上我现在正在查找 Home,然后将其投射到 Home Class。
在旧的 JBoss 4.2.X 中,我查找了 JNDI 名称 Test1SLB
,然后将其转换为 Home Class,它成功了。所以在旧的 JBoss 4.2.X.
中有 1 个 JNDI 名称 Test1SLB
用于 Remote 和 Home
我正在使用 Java 1.7、XDoclet 1.2.3、WildFly 8.2。1.Final、动态 Web 模块 2.5、Eclipse Luna 中的 EJB 2.1。
- 我有一个名为 P001_EAR. 的企业应用程序项目
- 我有一个名为 P001_WAR. 的动态 Web 项目
- 我有一个名为 P001_EJB. 的 EJB 项目
- 我有一个名为 P001_EJBClient. 的 EJB 客户端项目
在 P001_EJB 中,我创建了一个 XDoclet 无状态会话 Bean (EJB 2.1)。
这是它的远程接口:
package com.p001.ejb;
/**
* Remote interface for Test1SLB.
* @generated
* @wtp generated
*/
public interface Test1SLB extends javax.ejb.EJBObject
{
/**
* <!-- begin-xdoclet-definition -->
* @generated //TODO: Must provide implementation for bean method stub */
public java.lang.String foo( java.lang.String param )
throws java.rmi.RemoteException;
}
这是它的主页界面:
package com.p001.ejb;
/**
* Home interface for Test1SLB.
* @generated
* @wtp generated
*/
public interface Test1SLBHome extends javax.ejb.EJBHome
{
public static final String COMP_NAME="java:comp/env/ejb/Test1SLB";
public static final String JNDI_NAME="Test1SLB";
public com.p001.ejb.Test1SLB create()
throws javax.ejb.CreateException,java.rmi.RemoteException;
}
在P001_WAR中我创建了一个Listenerclass命名为P001Listener;在其 contextInitialized
方法中,我试图调用 Test1SLB EJB 的 foo
方法。这是它的代码:
public class P001Listener implements ServletContextListener {
public P001Listener() {
}
public void contextInitialized(ServletContextEvent sce) {
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): inside");
String test1SLBJNDIName = null;
Class test1SLBHomeClass = null;
InitialContext initialContext = null;
Object namedObject = null;
Object ejbHomeObject = null;
Test1SLBHome test1SLBHome = null;
Test1SLB test1SLB = null;
String rtnValue = null;
try {
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB";
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBJNDIName=" + test1SLBJNDIName);
test1SLBHomeClass = Test1SLBHome.class;
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBHomeClass=" + test1SLBHomeClass);
initialContext = new InitialContext();
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): initialContext=" + initialContext);
namedObject = initialContext.lookup(test1SLBJNDIName);
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): namedObject=" + namedObject);
ejbHomeObject = PortableRemoteObject.narrow(namedObject, test1SLBHomeClass);
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): ejbHomeObject=" + ejbHomeObject);
test1SLBHome = (Test1SLBHome) ejbHomeObject;
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBHome=" + test1SLBHome);
test1SLB = test1SLBHome.create();
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLB=" + test1SLB);
rtnValue = test1SLB.foo("pagal");
System.out.println("P001Listener.java: contextInitialized(ServletContextEvent sce): rtnValue=" + rtnValue);
} catch (NamingException ne) {
ne.printStackTrace();
} catch (ClassCastException cce) {
cce.printStackTrace();
} catch (RemoteException re) {
re.printStackTrace();
} catch (CreateException ce) {
ce.printStackTrace();
}
}
public void contextDestroyed(ServletContextEvent sce) {
System.out.println("P001Listener.java: contextDestroyed(ServletContextEvent sce): inside");
}
}
我在 WildFly 上部署了 P001_EAR。这是部署的样子:
P001_EAR.ear
里面P001_EAR.ear我有:
- 元信息
- P001_EJB.jar
- P001_WAR.war
- P001_EJBClient.jar
在META-INF里面我有:
- application.xml
里面P001_EJB.jar我有:
- META-INF\ejb-jar.xml
- META-INF\jboss.xml
- META-INF\MANIFEST.MF
- com\p001\ejb\Test1SLBBean.class
- com\p001\ejb\Test1SLBSession.class
里面P001_WAR.war我有:
- META-INF\MANIFEST.MF
- WEB-INF\web.xml
- WEB-INF\classes\com\p001\listener\P001Listener.class
- WEB-INF\lib
里面P001_EJBClient.jar我有:
- META-INF\MANIFEST.MF
- com\p001\ejb\Test1SLB.class
- com\p001\ejb\Test1SLBHome.class
- com\p001\ejb\Test1SLBLocal.class
- com\p001\ejb\Test1SLB本地Home.class
- com\p001\ejb\Test1SLBUtil.class
我运行野蝇。在 server.log
文件中,我看到 EJB 已成功部署:
2015-12-08 11:21:58,671 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named Test1SLB in deployment unit subdeployment "P001_EJB.jar" of deployment "P001_EAR.ear" are as follows:
java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome java:module/Test1SLB!com.p001.ejb.Test1SLBHome java:jboss/exported/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocalHome java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocalHome java:module/Test1SLB!com.p001.ejb.Test1SLBLocalHome java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB java:module/Test1SLB!com.p001.ejb.Test1SLB java:jboss/exported/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocal java:app/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBLocal java:module/Test1SLB!com.p001.ejb.Test1SLBLocal
但我在这一行得到 java.lang.ClassCastException
:
ejbHomeObject = PortableRemoteObject.narrow(namedObject, test1SLBHomeClass);
这是server.log
:
2015-12-08 11:21:59,158 INFO [stdout] (MSC service thread 1-9) P001Listener.java: contextInitialized(ServletContextEvent sce): inside
2015-12-08 11:21:59,159 INFO [stdout] (MSC service thread 1-9) P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBJNDIName=java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB
2015-12-08 11:21:59,161 INFO [stdout] (MSC service thread 1-9) P001Listener.java: contextInitialized(ServletContextEvent sce): test1SLBHomeClass=interface com.p001.ejb.Test1SLBHome
2015-12-08 11:21:59,164 INFO [stdout] (MSC service thread 1-9) P001Listener.java: contextInitialized(ServletContextEvent sce): initialContext=javax.naming.InitialContext@2db02a6a
2015-12-08 11:21:59,171 INFO [org.jboss.ejb.client] (MSC service thread 1-9) JBoss EJB Client version 2.0.1.Final 2015-12-08 11:21:59,177 INFO [stdout] (MSC service thread 1-9) P001Listener.java: contextInitialized(ServletContextEvent sce): namedObject=Proxy for remote EJB StatelessEJBLocator{appName='P001_EAR', moduleName='P001_EJB', distinctName='', beanName='Test1SLB', view='interface com.p001.ejb.Test1SLB'}
2015-12-08 11:21:59,197 ERROR [stderr] (MSC service thread 1-9) java.lang.ClassCastException
2015-12-08 11:21:59,198 ERROR [stderr] (MSC service thread 1-9) at org.jboss.com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:246)
2015-12-08 11:21:59,200 ERROR [stderr] (MSC service thread 1-9) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:158)
2015-12-08 11:21:59,201 ERROR [stderr] (MSC service thread 1-9) at com.p001.listener.P001Listener.contextInitialized(P001Listener.java:59)
2015-12-08 11:21:59,202 ERROR [stderr] (MSC service thread 1-9) at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
2015-12-08 11:21:59,204 ERROR [stderr] (MSC service thread 1-9) at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:194)
2015-12-08 11:21:59,206 ERROR [stderr] (MSC service thread 1-9) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
2015-12-08 11:21:59,208 ERROR [stderr] (MSC service thread 1-9) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
2015-12-08 11:21:59,210 ERROR [stderr] (MSC service thread 1-9) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
2015-12-08 11:21:59,211 ERROR [stderr] (MSC service thread 1-9) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
2015-12-08 11:21:59,212 ERROR [stderr] (MSC service thread 1-9) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
2015-12-08 11:21:59,214 ERROR [stderr] (MSC service thread 1-9) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
2015-12-08 11:21:59,215 ERROR [stderr] (MSC service thread 1-9) at java.lang.Thread.run(Thread.java:745)
2015-12-08 11:21:59,216 ERROR [stderr] (MSC service thread 1-9) Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy21 cannot be cast to org.omg.CORBA.Object
2015-12-08 11:21:59,218 ERROR [stderr] (MSC service thread 1-9) at org.jboss.com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:225)
2015-12-08 11:21:59,219 ERROR [stderr] (MSC service thread 1-9) ... 11 more
收到此错误消息我做错了什么?
谢谢
更新
我找到了解决办法。当我更改此代码时:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB";
此代码:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome";
然后就成功了。所以基本上我现在正在查找 Home 的 JNDI 名称,然后将其转换为 Home Class。
在旧的 JBoss 4.2.X 中,我查找了 JNDI 名称 Test1SLB
,然后将其转换为 Home Class,它成功了。那么在旧的 JBoss 4.2.X 中是否有 1 个 JNDI 名称 Test1SLB
用于 Remote 和 Home?
我找到了解决办法。当我更改此代码时:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLB";
此代码:
test1SLBJNDIName = "java:global/P001_EAR/P001_EJB/Test1SLB!com.p001.ejb.Test1SLBHome";
然后就成功了。所以基本上我现在正在查找 Home,然后将其投射到 Home Class。
在旧的 JBoss 4.2.X 中,我查找了 JNDI 名称 Test1SLB
,然后将其转换为 Home Class,它成功了。所以在旧的 JBoss 4.2.X.
Test1SLB
用于 Remote 和 Home