Hi,
I have in an Eclipse EJB-Project a remote bean with an interface annotated with "@Remote"
@Remote
public interface SessionBeanLocalStatelessIF {
void addMember(String memberName);
List<String> getMembers();
}
The initial context is definied as following:
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.wildfly.naming.client.WildFlyInitialContextFactory");
properties.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
properties.put(Context.SECURITY_PRINCIPAL, "User");
properties.put(Context.SECURITY_CREDENTIALS, "Password");
initialContext = new InitialContext(properties);
The jndi name is
"ejb:"+appName+"/"+moduleName+"/"+ distinctName +"/"+beanName+"!"+interfaceName;
I had no problem to invoke/run it. But when I change the Remote bean to Local, I get the error:"javax.naming.NameNotFoundException: global -- service jboss.naming.context.java.jboss.exported.global"
The initial context is the same as before. Only the interface has now the "@Local" annotation:
@Local
public interface SessionBeanLocalStatelessIF {
void addMember(String memberName);
List<String> getMembers();
}
The client is in the same app as the bean. I tried all the published JNDI-Names existing in the server log without success:
java:global/ExempleEJBSessionBean/SessionBeanLocalStateless!com.ejb.local.SessionBeanLocalStatelessIF
java:app/ExempleEJBSessionBean/SessionBeanLocalStateless!com.ejb.local.SessionBeanLocalStatelessIF
java:module/SessionBeanLocalStateless!com.ejb.local.SessionBeanLocalStatelessIF
java:global/ExempleEJBSessionBean/SessionBeanLocalStateless
java:app/ExempleEJBSessionBean/SessionBeanLocalStateless
java:module/SessionBeanLocalStateless
Could anyone help me understand, what's the problem here? Thank's in advance !
Found the solution here: Local JNDI Lookup only via global namespace possible in Wildfly 10 ??