在两只耳朵中的无国籍豆 [英] Same stateless bean in two ears
问题描述
我可以有这种情况吗?
由于我收到此错误 http://justpaste.it/gfs3
没有理解如何解决它。
你有堆栈跟踪中的答案:
短格式默认绑定'com.demo.view.RitornaPersonaRemote'
是不明确的,因为多个bean实现了接口:
[ RitornaPersonaSenzaClientEAR#RitornaPersonaSenzaClient.jar#RitornaPersona,
RitornaPersonaWebSenzaClientEAR#RitornaPersonaSenzaClient.jar#RitornaPersona]。
提供一个特定于接口的绑定或使用查询上的长格式默认绑定。]
如果您询问您是否可以在多个项目中使用相同的EJB jar,那么答案是可以的。但是在部署期间,您必须使用长格式的JNDI,为其他模块中的bean提供不同的JNDI名称或禁用短名称。您不能以同名的方式注册两个bean。
长名称的格式为 RitornaPersonaSenzaClientEAR#RitornaPersonaSenzaClient.jar#com.demo.view.RitornaPersonaRemote
请参阅这里的详细信息 - EJB 3.0和EJB 3.1应用程序绑定概述
更新
要禁用短名称执行以下步骤:
- 转到
应用服务器> server1>流程定义> Java虚拟机>定制属性
- 定义新的自定义属性
com.ibm.websphere.ejbcontainer.disableShortDefaultBindings
,值*
可以禁用所有应用程序的短绑定,或者禁用AppName1 | AppName2
在所选应用程序中禁用短绑定。
示例默认绑定显示在SystemOut.log中:
绑定位置是:ejblocal:JPADepEar / JPADepEJB.jar / TableTester#ejb.TableTester
绑定位置是:ejblocal:ejb.TableTester
绑定位置是:java:global / JPADepEar / JPADepEJB /TableTester!ejb.TableTester
与 disableShortDefaultBindings
属性集没有简短的形式:
绑定位置是:ejblocal:JPADepEar / JPADepEJB.jar / TableTester#ejb。 TableTester
绑定位置是:java:global / JPADepEar / JPADepEJB / TableTester!ejb.TableTester
有一个错误在文档中和正确的属性是 com.ibm.websphere.ejbcontainer.disableShortDefaultBindings 不是 com.ibm.websphere.ejbcontainer.disableShortFormBinding
I have the same EJB module with a bean inside an EAR that is server side and an EAR that is the client side. Can I have this situation?
Because I'm getting this error http://justpaste.it/gfs3 without understand how to fix it.
You have answer in the stack trace:
The short-form default binding 'com.demo.view.RitornaPersonaRemote'
is ambiguous because multiple beans implement the interface :
[RitornaPersonaSenzaClientEAR#RitornaPersonaSenzaClient.jar#RitornaPersona,
RitornaPersonaWebSenzaClientEAR#RitornaPersonaSenzaClient.jar#RitornaPersona].
Provide an interface specific binding or use the long-form default binding on lookup.]
If you are asking whether you may have same EJB jar in multiple project - the answer is yes you can. However during deployment you have to use long-form JNDI, provide different JNDI name for beans in other module or disable short names. You cannot register two beans under same name.
Long name would be in the form RitornaPersonaSenzaClientEAR#RitornaPersonaSenzaClient.jar#com.demo.view.RitornaPersonaRemote
See detailed info here - EJB 3.0 and EJB 3.1 application bindings overview
UPDATE
To disable short names perform the following steps:
- Go to
Application servers > server1 > Process definition > Java Virtual Machine > Custom properties
- Define new custom property
com.ibm.websphere.ejbcontainer.disableShortDefaultBindings
with value*
to disable short bindings for all apps orAppName1|AppName2
to just disable short bindings in selected apps.
Example default bindings are shown in SystemOut.log:
The binding location is: ejblocal:JPADepEar/JPADepEJB.jar/TableTester#ejb.TableTester
The binding location is: ejblocal:ejb.TableTester
The binding location is: java:global/JPADepEar/JPADepEJB/TableTester!ejb.TableTester
And with disableShortDefaultBindings
property set there is no short form:
The binding location is: ejblocal:JPADepEar/JPADepEJB.jar/TableTester#ejb.TableTester
The binding location is: java:global/JPADepEar/JPADepEJB/TableTester!ejb.TableTester
There is a bug in the documentation and the correct property is com.ibm.websphere.ejbcontainer.disableShortDefaultBindings not com.ibm.websphere.ejbcontainer.disableShortFormBinding
这篇关于在两只耳朵中的无国籍豆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!