Ok, so the definition of ConnectionFactory in JCA-ds.xml is added to global JNDI namespace (the use-java-context parameter is set to false).
I have turned the TRACE level for org.jboss.ha package.
When I try to find this entry from Eclipse via simple call as
java.util.Properties p = new java.util.Properties();
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(javax.naming.Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
// HA-JNDI is registered under the partition name passed to JBoss via -g
//String partitionName = System.getProperty("jboss.partition.name", "DefaultPartition");
p.put(javax.naming.Context.PROVIDER_URL, "hostname:1200");
InitialContext context = new javax.naming.InitialContext(p);
Object o = context.lookup("QueueName");
System.out.println(o);
Object connFactory = context.lookup("ConnectionFactoryName");
System.out.println(connFactory);
I get the following result:
- QueueName is found. It is defined as AdminObject
- ConnectionFactoryName is null
the logs are as follows:
2011-12-16 19:08:06,691 TRACE [org.jboss.ha.jndi.HANamingService] Accepted bootstrap client: Socket[addr=/MY_IP_ADDRESS,port=2706,localport=1200]
2011-12-16 19:08:06,691 TRACE [org.jboss.ha.jndi.HANamingService] Accepted bootstrap client: Socket[addr=/MY_IP_ADDRESS,port=2706,localport=1200]
2011-12-16 19:08:06,920 TRACE [org.jboss.ha.jndi.impl.jbc.JBossCacheDistributedTreeManager] lookup, name=QueueName
2011-12-16 19:08:06,920 TRACE [org.jboss.ha.jndi.impl.jbc.JBossCacheDistributedTreeManager] lookup, name=QueueName
2011-12-16 19:08:06,920 TRACE [org.jboss.ha.jndi.HAJNDI] lookupLocally, name=QueueName
2011-12-16 19:08:06,920 TRACE [org.jboss.ha.jndi.HAJNDI] lookupLocally, name=QueueName
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] Partition PARTITION_NAME received msg
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] full methodName: HAJNDI.lookupLocally
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] handlerName: HAJNDI methodName: lookupLocally
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] Handle: HAJNDI.lookupLocally
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.jndi.HAJNDI] lookupLocally, name=ConnectionFactoryName
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] rpc call return value: Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] Partition PARTITION_NAME received msg
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] full methodName: HAJNDI.lookupLocally
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] handlerName: HAJNDI methodName: lookupLocally
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] Handle: HAJNDI.lookupLocally
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.jndi.HAJNDI] lookupLocally, name=ConnectionFactoryName
2011-12-16 19:08:06,935 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] rpc call return value: Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Now, when I try to execute code from application deployed on JBoss on one of the nodes, which does the same lookup the result in log is as follows:
2011-12-16 19:46:24,433 TRACE [org.jboss.ha.jndi.HAJNDI] calling lookupLocally(ConnectionFactoryName) on HAJNDI cluster
2011-12-16 19:46:24,433 TRACE [org.jboss.ha.framework.interfaces.HAPartition.PARTITION_NAME] callMethodOnCluster(true), objName=HAJNDI, methodName=lookupLocally, members=[10.70.13.18:55500, 10.70.13.18:55400, 10.70.13.18:55200]
2011-12-16 19:46:24,433 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] dests=[10.70.13.18:55500, 10.70.13.18:55400, 10.70.13.18:55200], method_call=HAJNDI.lookupLocally(ConnectionFactoryName), mode=2, timeout=60000
2011-12-16 19:46:24,431 TRACE [org.jboss.ha.jndi.HAJNDI] lookupLocally failed, name=ConnectionFactoryName
javax.naming.NameNotFoundException: ConnectionFactoryName not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jboss.ha.jndi.HAJNDI.lookupLocally(HAJNDI.java:131)
at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:318)
at $Proxy153.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at pl.com.CustomHandler.processRequestInner(EngineAPI.java:399)
at sun.reflect.GeneratedMethodAccessor329.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.GeneratedMethodAccessor310.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.GeneratedMethodAccessor309.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Container.java:1092)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:436)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
at $Proxy136.invokeEngine(Unknown Source)
at sun.reflect.GeneratedMethodAccessor325.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:905)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:592)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2036)
at java.lang.Thread.run(Thread.java:619)
2011-12-16 19:46:24,434 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] real_dests=[10.70.13.18:55500, 10.70.13.18:55400, 10.70.13.18:55200]
2011-12-16 19:46:24,433 TRACE [org.jboss.ha.jndi.HAJNDI] calling lookupLocally(ConnectionFactoryName) on HAJNDI cluster
2011-12-16 19:46:24,433 TRACE [org.jboss.ha.framework.interfaces.HAPartition.PARTITION_NAME] callMethodOnCluster(true), objName=HAJNDI, methodName=lookupLocally, members=[10.70.13.18:55500, 10.70.13.18:55400,10.70.13.18:55200]
2011-12-16 19:46:24,433 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] dests=[10.70.13.18:55500,10.70.13.18:55400, 10.70.13.18:55200], method_call=HAJNDI.lookupLocally(ConnectionFactoryName), mode=2, timeout=60000
2011-12-16 19:46:24,434 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] real_dests=[10.70.13.18:55500, 10.70.13.18:55400, 10.70.13.18:55200]
2011-12-16 19:46:24,437 TRACE [org.jboss.ha.jndi.LookupSucceededFilter] isAcceptable (Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
) from 10.70.13.18:1099
2011-12-16 19:46:24,437 TRACE [org.jboss.ha.jndi.LookupSucceededFilter] Lookup succeded from 10.70.13.18:1099
2011-12-16 19:46:24,437 TRACE [org.jboss.ha.jndi.LookupSucceededFilter] isAcceptable (Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
) from 10.70.13.18:1099
2011-12-16 19:46:24,437 TRACE [org.jboss.ha.jndi.LookupSucceededFilter] Lookup succeded from 10.70.13.18:1099
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] responses: [sender=10.70.13.18:55400, retval=null, received=false, suspected=false]
[sender=10.70.13.18:55500, retval=null, received=false, suspected=false]
[sender=10.70.13.18:55200, retval=Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
, received=true, suspected=false]
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.framework.server.ClusterPartition$RpcHandler] responses: [sender=10.70.13.18:55400, retval=null, received=false, suspected=false]
[sender=10.70.13.18:55500, retval=null, received=false, suspected=false]
[sender=10.70.13.18:55200, retval=Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
, received=true, suspected=false]
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.framework.interfaces.HAPartition.PARTITION_NAME] Ignoring non-received response: sender=10.70.13.18:55400, retval=null, received=false, suspected=false
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.framework.interfaces.HAPartition.PARTITION_NAME] Ignoring non-received response: sender=10.70.13.18:55400, retval=null, received=false, suspected=false
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.framework.interfaces.HAPartition.PARTITION_NAME] Ignoring non-received response: sender=10.70.13.18:55500, retval=null, received=false, suspected=false
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.framework.interfaces.HAPartition.PARTITION_NAME] Ignoring non-received response: sender=10.70.13.18:55500, retval=null, received=false, suspected=false
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.jndi.HAJNDI] Returned results size: 1
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.jndi.HAJNDI] Returned results size: 1
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.jndi.HAJNDI] lookupLocally, i=0, value=Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
, type=javax.naming.Reference
2011-12-16 19:46:24,438 TRACE [org.jboss.ha.jndi.HAJNDI] lookupLocally, i=0, value=Reference Class Name: pl.com.CustomConnectionFactory
Type: nns
Content: NewAdapter
, type=javax.naming.Reference
So it seems that the entry is found in the local JNDI tree of one of the nodes, but the result is not returned. Why?
Regards