Using WLS 12, I have the following EJB definition:
@Stateless
public class MyBean implements MyInterface { ... }
@Remote
public interface MyInterface { ... }
I have also the following weblogic-ejb-jar.xml
definition:
<weblogic-enterprise-bean>
<ejb-name>MyBean</ejb-name>
<enable-call-by-reference>true</enable-call-by-reference>
<jndi-binding>
<jndi-name>/ejb/myapp/server/MyBean</jndi-name>
</jndi-binding>
</weblogic-enterprise-bean>
The ejb-jar.xml
has no specific configuration to this bean.
My goal is to deploy the EJB under the following EJB-Name: /ejb/myapp/server/MyBean
I can achieve this using the annotation @weblogic.javaee.JNDIName("/ejb/myapp/server/MyBean")
on MyBean
but the annotation is specific to Weblogic. I try to find a way to define the JNDI-Name without any Weblogic specific annotation. Specific XML configuration is OK though.
The JNDI name must be the name I mentioned because it is referenced from another application where it is pratically impossible for technical reason to change the JNDI name reference.
Any idea how to configure the global JNDI name for this EJB?
You need to add the class name of your interface in the jndi binding :
<weblogic-enterprise-bean>
<ejb-name>MyBean</ejb-name>
<enable-call-by-reference>true</enable-call-by-reference>
<jndi-binding>
<class-name>org.package.MyInterface</class-name>
<jndi-name>/ejb/myapp/server/MyBean</jndi-name>
</jndi-binding>
</weblogic-enterprise-bean>