4 Replies Latest reply: Dec 19, 2011 5:39 AM by apph_ apph_ RSS

HAJNDI problem

apph_ apph_ Newbie

Hello,

 

First of all I will try to describe goal we would like to achieve plus the configuration we are using.

 

Application server version is JBoss 5.

There are 4 nodes which form a cluster. All nodes are on the same machine, having the same IP address. Only ports configuration is different.

 

We have enterprise application which uses JCA adapter to connect to some EIS. ConnectionFactory in JCA adapter is defined under some name in JNDI. This is working perfectly fine. Now, what we would like to do, is to have this JNDI name for ConnectionFactory to be seen on every node (not to have different pools on each node).

The first very basic idea, since it is a JCA adapter, is to deply the RAR file on the other nodes also so that classes used from the adapter are seen, but without the adapterName-ds.xml file, so that JBoss does not create JNDI entry on every node for ConnectionFactory.

Instead we would like to use HAJNDI, so basicaly have the connection pool shared on all nodes.

 

But there is a problem, because in such configuration the JNDI entry is only found on the Node1 which has both: RAR adapter plus the adapterName-ds.xml configuration for JNDI entry. On all other nodes the JNDI lookup does not return anything.

 

We have tried http://docs.jboss.org/jbossclustering/cluster_guide/5.1/html/clustering-jndi.html and to be more specific configuration described for running clients inside application server using jnp.partitionName.

 

There are no errors, but JNDI lookup fails.

We have also the hajndi-jboss-beans.xml file on all nodes in the 'cluster' directory as shown in http://docs.jboss.org/jbossclustering/cluster_guide/5.1/html/clustering-jndi.html#clustering-jndi-jboss

 

What is wrong, or what is missing? Maybe it is not the best configuration for our problem?

Of course I can provide any additional informations...

 

Thanks and regards

  • 1. Re: HAJNDI problem
    Wolf-Dieter Fink Master

    I makes no sense to have only one instance that holds the JCA-EIS connection pool, I will give you examples.

     

    I asume that you use cluster for failover and loadbalancing.

    - each access on a node force a 'remote' access to lookup and use the connection

       it is not a big difference (except the network traffic and latency) whether the nodes are on same/different systems

    - if loadbalanced the sum of connection is the same if you use it in parallel, nevertheless it is one node with 40 or even 4 with 10

    - If the node with the connection pool crash your application is down

    - distributed XA transactions (I suppose that you are using the EIS system together with database access) are not supported by default

      which you have to use in that case

     

    So for me the best cluster configuration is to configure all nodes in the same way (number of connections, JVM params, deployed apps ...)

  • 2. Re: HAJNDI problem
    apph_ apph_ Newbie

    Wolf,

     

    I pretty much understand you points. I will try to refer to them later and elaborate a bit more.

     

    Besides of the sense of making such configuration, what is wrong with it that it is not working?

    What about the concept of binding ConnectionFactory to the global cluster-wide context?

     

    Regards

  • 3. Re: HAJNDI problem
    Wolf-Dieter Fink Master

    I suppose that the JCA-ds.xml definition will not be added to the global JNDI namespace (similar for database).

    In case of database it is strongly recommend to not use such approach.

     

    And in this case the JNDI is not propagated within the cluster, as i.e. it will propagated if you deploy clustered SLSB only on a few instances a client will be routed to a instance that have the bean.

  • 4. Re: HAJNDI problem
    apph_ apph_ Newbie

    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