3 Replies Latest reply on Feb 27, 2014 1:11 AM by ks.zealot

    Could not lookup Infinispan from JBoss

    ks.zealot

      Having a trouble with Infintispan.

       

      I trying to get Cache have imbedded into JBoss 7.1.1. In standalone.xml I describe cache like this

       

      <cache-container name="cluster" aliases="ha-partition" default-cache="default" jndi-name="java:jboss/infinispan/cluster">
                      <transport lock-timeout="60000"/>
                      <replicated-cache name="default" mode="SYNC" start="EAGER" batching="true" jndi-name="cache">
                          <locking isolation="REPEATABLE_READ"/>
                      </replicated-cache>
                  </cache-container>
      
      

      So, when i annotate cache with javax.naming.Resource, my cache is always null.

      @Resource(lookup = "java:jboss/infinispan/cluster")

          private static  CacheContainer container;

      When i tryed look up it directly,  i get next error

      11:32:59,093 SEVERE [com.alt1.ussd_sdp.util.CacheHolder] (MSC service thread 1-29) null: javax.naming.NameNotFoundException: Error looking up infinispan/cluster, service service jboss.naming.context.java.jboss.infinispan.cluster is not started
              at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:126)
              at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:74)
              at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
              at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:123)
              at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
              at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_05]
              at com.alt1.ussd_sdp.util.CacheHolder.getCache(CacheHolder.java:31)
      

      What am i doing wrong?

        • 1. Re: Could not lookup Infinispan from JBoss
          rpelisse

          My guess is the JNDI name is not the right one (since JEE6 there is "several" options). I would remove the "jndi-name" attribute for now and simply go for the "natural" one which look like more/less like that: java:jboss/infinispan/container/<cache-name>

           

          An other option, would be to use JBoss CLI to display the JNDI name and check if your cache is really registered under the name you set:

           

          [standalone@localhost:9999 /] /subsystem=naming:jndi-view 
          • 2. Re: Could not lookup Infinispan from JBoss
            ks.zealot

            I removed jndi-name paramatr and look into jndi tree. Nothing like infispan in cli and managment console.

            [standalone@172.16.100.63:9999 /] /subsystem=naming:jndi-view
            {
                "outcome" => "success",
                "result" => {
                    "java: contexts" => {
                        "java:" => {"TransactionManager" => {
                            "class-name" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate",
                            "value" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@1d7e805e"
                        }},
                        "java:jboss" => {
                            "TransactionManager" => {
                                "class-name" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate",
                                "value" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@1d7e805e"
                            },
                            "TransactionSynchronizationRegistry" => {
                                "class-name" => "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple",
                                "value" => "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@c5d4e0f"
                            },
                            "UserTransaction" => {
                                "class-name" => "org.jboss.tm.usertx.client.ServerVMClientUserTransaction",
                                "value" => "org.jboss.tm.usertx.client.ServerVMClientUserTransaction@5104c8be"
                            },
                            "jaas" => {
                                "class-name" => "$Proxy9",
                                "children" => {
                                    "jboss-ejb-policy" => {
                                        "class-name" => "org.jboss.as.security.plugins.SecurityDomainContext",
                                        "value" => "org.jboss.security.authentication.JBossCachedAuthenticationManager@33734d0b"
                                    },
                                    "other" => {
                                        "class-name" => "org.jboss.as.security.plugins.SecurityDomainContext",
                                        "value" => "org.jboss.security.authentication.JBossCachedAuthenticationManager@56c72790"
                                    },
                                    "jboss-web-policy" => {
                                        "class-name" => "org.jboss.as.security.plugins.SecurityDomainContext",
                                        "value" => "org.jboss.security.authentication.JBossCachedAuthenticationManager@2cf68b72"
                                    }
                                }
                            },
                            "mail" => {
                                "class-name" => "javax.naming.Context",
                                "children" => {"Default" => {
                                    "class-name" => "javax.mail.Session",
                                    "value" => "javax.mail.Session@2b0fb601"
                                }}
                            },
                            "datasources" => {
                                "class-name" => "javax.naming.Context",
                                "children" => {"ExampleDS" => {
                                    "class-name" => "org.jboss.jca.adapters.jdbc.WrapperDataSource",
                                    "value" => "org.jboss.jca.adapters.jdbc.WrapperDataSource@6f7c3b5d"
                                }}
                            }
                        },
                        "java:global" => undefined
                    },
                    "applications" => undefined
                }
            }
            
            • 3. Re: Could not lookup Infinispan from JBoss
              ks.zealot

              I still could not found the solution