我按照这个指南http://jonas.ow2.org/doc/JONAS_5_1_7/doc/doc-en/html/ejb3_programmer_guide.html来学习如何编写EJB3.0,但是我被2.3. Writing the Client Code
这一章卡住了。
我使用的是RAD 8.5和WAS 7.0。我创建了EJB项目和会话bean,但是当我运行客户端时(即在相同的项目和bean的EAR中),我总是得到这样的错误:
22-lug-2014 12.33.15 null null
WARNING: WSVR0072W
22-lug-2014 12.33.15 null null
WARNING: WSVR0072W
22-lug-2014 12.33.15 null null
WARNING: WSVR0072W
22-lug-2014 12.33.15 null null
WARNING: WSVR0072W
22-lug-2014 12.33.15 null null
INFO: Client code attempting to load security configuration
Exception in thread "P=194786:O=0:CT" java.lang.ClassCastException: org.omg.stub.java.rmi._Remote_Stub incompatible with HelloWorldInterface
at Client.main(Client.java:26)
我尝试了几种解决方案,但都没有结果。有关于如何解决这个错误的想法吗?
发布于 2014-09-27 17:18:35
在java main或JUnit上下文中,您必须使用createEJBStubs.bat生成EJB3存根。我正在使用ANT task为我生成它...
was.home - WAS安装的根目录
locationName - EAR文件的位置
<target name="export_ear">
<earExport earProjectName="MyProject" earExportFile="${locationName}/MyProject.ear" exportSource="false" overwrite="true"/>
</target>
<target name="createStubs" depends="export_ear">
<exec executable="${was.home}/bin/createEJBStubs.bat">
<arg line="${locationName}/MyProject.ear" />
</exec>
</target>
生成存根后,必须从MyProject.ear中提取MyProject.jar和MyProjectClient.jar,并将它们包含到构建路径中。
https://stackoverflow.com/questions/24885058
复制相似问题