JBoss Community

Binding Dynamic Remote Object in Jboss 7.1.1

created by avi said in JNDI and Naming - View the full discussion

Hi,

 

I have been trynig to bind object to Jboss 7.1.1 JNDI using the following code:

 

public static void main(String[] args) {

  final Hashtable<String, Object> env = new Hashtable<String, Object>();

  env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

  env.put(Context.PROVIDER_URL, "remote://localhost:4447");

  env.put("jboss.naming.client.ejb.context", true);

  Context remoteContext = null;

  try {

   remoteContext = new InitialContext(env);

   remoteContext.bind("user:global/myName","user:Test");  

  } catch (NamingException e) {  

   e.printStackTrace();

  }

}

 

 

Getting the following error in the client JVM:

javax.naming.NamingException: Failed to bind [Root exception is java.io.IOException: Internal server error.]

at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)

 

In the server console I see:

JBAS011807: Unexpected internal error: java.lang.UnsupportedOperationException: JBAS011859: Naming context is read-only

at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:126)

at org.jboss.as.naming.WritableServiceBasedNamingStore.bind(WritableServiceBasedNamingStore.java:56)

at org.jboss.as.naming.NamingContext.bind(NamingContext.java:221)

 

I have found several discussion on JBAS011859 but the suggested solution is to run the code inside Jboss (as EJB) or as MSC Service.

 

The ability to bind object in JNDI from remote JVM was supported in Jboss 4, was this ability removed in Jboss 7? if yes, why?

Is there a workaround?

 

Regards

Avi

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community