Enable JMS access to a docker container

My application is running in a karaf server inside the docker container.
I’ve added the following properties for init JNDI:

prop.setProperty(“java.naming.factory.initial”, “org.jboss.naming.remote.client.InitialContextFactory”);
prop.setProperty(“java.naming.provider.url”, “remote://”);
prop.setProperty(“jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT”, “false”);
prop.setProperty(Context.SECURITY_PRINCIPAL, “admin”);
prop.setProperty(Context.SECURITY_CREDENTIALS, “12345”);
prop.put(“jboss.naming.client.connect.timeout”, 180000);

When I try to lookup the TopicConnectionFactory, I receive the following error:
javax.naming.NamingException: Unable to invoke lookup, status=WAITING

But i’m testing on main method in eclipse i can’t see that exception and it run normally.
Can you give me some clue, some idea about the reason of this error? And how can i fix it?
Thanks in advance guys