I've got a little Problem with my Websphere Application Server and the ejb remote lookup between two different EAR files on the same Server.
There is a main System (EAR File) from which I want to consume a Service of another System (EAR File). So I'am trying to use a remote lookup to get the Bean. But unfortunately I always receive a Exception that this Bean is not defined by the caller Bean:
Main-System: main_b.ear ---- Main-Bean: XMLSessionProxyBean
Metadata-System: metadata_b.ear ---- Metadata-Bean: MetadataServiceBean
Caused by: java.lang.IllegalArgumentException: ejb/metadata_b/metadata-service.jar/MetadataServiceBean#de.metadata.service.MetadataServiceRemote was not defined for main_b#main-ejbs.jar#XMLSessionProxyBean
at com.ibm.ws.ejbcontainer.runtime.SharedEJBRuntimeImpl.javaColonLookup(SharedEJBRuntimeImpl.java:692)
at com.ibm.ejs.container.BeanO.lookup(BeanO.java:1333)
Here is my lookup Method in the Main-System. Iam using the sessionContext (dont want to create a InitialContext since I'am already in a session):
private static String METADATA_BEAN_LOOKUP =
"ejb/metadata_b/metadata-service.jar/MetadataServiceBean#de.metadata.service.MetadataServiceRemote";
public MetadataServiceRemote getMetadataService() {
return getLocalEJB(METADATA_BEAN_LOOKUP);
}
@SuppressWarnings("unchecked")
private <T> T getLocalEJB(final String jndiName) {
T localEjb = null;
final SessionContext sContext = objContext.getSessionContext();
localEjb = (T) sContext.lookup(jndiName);
return localEjb;
}
It's no Option for me to use injections like @EJB
and also not to use local lookups with WAS shared libraries. I think I have to use ejb-jar.xml and ibm-ejb-jar-bnd.xml or something rather. At the moment there is no ejb-jar.xml or other deployment descriptors. So I just use default bindings.
Does anyone has a clue?
Thanks in advance!
Using the global namespace jndiname did the job: java:global/metadata_b/metadata-service/MetadataServiceBean!de.metadata.service.MetadataServiceRemote
:-)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.