The first thing you can do is confirm that you've bound the entry into HA-JNDI. If you access the JNDIView mbean from the JMX Console, you can invoke the List method and see if the entry is bound into the HA-JNDI namespace. If it's there, then it should also be bound on your other server.
If instead, the entry is bound into the Global JNDI Namespace, it would only be accessible from the other server if you used an HA-JNDI server to perform the lookup. Since you didn't specify a HA-JNDI server in your context, you would need to use auto discovery to accomplish this.
Thank you Jerry Gauth for your answer,
i know the JNDIView from the JMX Console. But I can?t see the HA-JNDI there because of this bug http://jira.jboss.com/jira/browse/JBAS-3260 which is fixed on 4.0.5 not for 4.0.4. And I can?t switch to 4.0.5 because every thing is configured and tested under 4.0.4 of the already created projects on JBoss. And the bug occurs when there are nothing in the HA-JNDI registered. But where is it then registered ?
What I wander is that why, if I register the object in One Service and the lookup works there, even if I close and open again the context Set, but in other Service (by the Same Server) the lookup doesn?t work.
The Auto Discovery is also enabled.
Some hints? suggestions ?
I wasn't aware of that bug.
I could be mistaken but I don't think you can use auto discovery to actually bind something into HA-JNDI. If you want to bind explicitly into HA-JNDI, you should add the HA-JNDI provider url to your context object. So you would add an entry similar to the following, using your own server name.
Note that binding something to HA-JNDI causes the binding to be replicated across all nodes in your cluster. However you don't need to bind an object to HA-JNDI in order for it to be looked up from a remote node. You can bind it locally into the Global JNDI Namespace and use HA-JNDI (with or without autodiscovery) to find it from another node. This requires that you have configured everything correctly, including the cluster itself.
One more observation - I took a look at the fix for JBAS-3260 and it stated that the problem occurred when the HA-JNDI service wasn't deployed. So if you're seeing this problem in JNDIView, are you running a clustered server?
i have now changed to testing purposes my application to JBoss 4.0.5.
Now form JNDI View i see that the object is registered to the HA-JNDI.
But still the lookup form other Service doesn?t work, even if i specify the server by the providerURL ("ServerName":1100).
Note: I use the all configuration with clustering Services.
I have also tried with this context set (from wiki http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHAJNDIUseCluster)
Properties p=new Properties();
p.put(Context.PROVIDER_URL, "localhost:1100"); // HA-JNDI port.
return new InitialContext(p);
And still i cant?t find(NameNotFound) the object by ictx.lookup(?myobject?); from other Service.
I don?t understand what I make wrong, can someone explain me please ?
On the client, try prefixing the provider url with jnp://
If this doesn't help, check your server logs and ensure that your cluster nodes are actually seeing each other.
Thank you Jerry Gauth for your so quick Answer,
Now works, with ?localhost:1100? .
The Problem was that JBoss doesn?t really apply my changes in the Sar file (Hot deployment doesn?t work properly).
After every changes I must restart the JBoss.
Which was confusing because JBoss AS starts and stops the Service by replacing the Sar file, but my changes wasn?t applied.