10 Replies Latest reply on Feb 16, 2010 5:10 PM by parmodmehta

    JBoss cache deployment problem

      I have an application running under jboss-4.2.2 using hibernate 3.3.2. For the jboss cache2 I added this dependency to my pom

       

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-jbosscache2</artifactId>

                  <version>3.3.2.GA</version>

              </dependency>

       

      Following dependencies were added:

       

      • Maven: jgroups:jgroups:2.6.7.GA
      • Maven: org.hibernate:hibernate-jbosscache2:3.3.2.GA
      • Maven: org.jboss.cache:jbosscache-core:3.1.0.GA
      • Maven: org.jboss:jboss-common-core:2.2.10.GA

      Now when I load the application I get this exception which was not there before adding pom dependency for jboss cache

       

      Caused by: javax.naming.NameNotFoundException: JNDI object with [java:MYDS] not found: JNDI implementation returned null

      at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:157)

      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)

      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)

      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)

      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)

      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)

      at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:200)

      at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:186)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)

       

       

      Is this a class loading problem?

       

      thanks

        • 1. Re: JBoss cache deployment problem

            <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-jbosscache2</artifactId>

                      <version>3.3.2.GA</version>

                      <exclusions>

                          <exclusion>

                              <groupId>org.jboss</groupId>

                              <artifactId>jboss-common-core</artifactId>

                          </exclusion>

                      </exclusions>

                  </dependency>

           

          When I add exclusion for jboss-common-core application deploys with no problem. Anyone knows if there is a known problem with hibernate-jbosscache2 3.3.2.GA, Spring 2.5 and JBoss 4.2.2.GA?

           

          thanks

          • 2. Re: JBoss cache deployment problem
            galder.zamarreno
            4.2 uses JBC 1.x and you're trying to hook JBC 2.x or higher into the 2nd level cache, so you'd need to do some classloader isolation. Simply upgrade to JBoss 5 and you'll be better off.
            • 3. Re: JBoss cache deployment problem
              Galder can you shed some light on what classloader issue I need to handle because upgrade to JBoss 5 is non-trivial as we have quite a few applications deployed on JBoss 4.x. thanks
              • 4. Re: JBoss cache deployment problem

                I noticed during debugging in org.jboss.util.naming.NonSerializableFactory

                 

                    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env)

                        throws Exception

                    { // Get the nns value from the Reference obj and use it as the map key

                        Reference ref = (Reference) obj;

                        RefAddr addr = ref.get("nns");

                        String key = (String) addr.getContent();

                        Object target = wrapperMap.get(key);

                        return target;

                    }

                 

                 

                The Name name that is coming through the caller is "MyDs" with wrapper map keyed the values as "java:MyDs" instead. Is this the expected behavior? thanks

                • 5. Re: JBoss cache deployment problem

                  Almost the same problem with jboss cache1

                   

                          <dependency>

                              <groupId>org.hibernate</groupId>

                              <artifactId>hibernate-jbosscache</artifactId>

                              <version>3.3.2.GA</version>

                          </dependency>

                   

                   

                  Caused by: javax.naming.NameNotFoundException: MyDS not bound

                  at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)

                  at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)

                  at org.jnp.server.NamingServer.getObject(NamingServer.java:543)

                  at org.jnp.server.NamingServer.lookup(NamingServer.java:296)

                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)

                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)

                  at javax.naming.InitialContext.lookup(InitialContext.java:392)

                  at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)

                  at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)

                  at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)

                  at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)

                  at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)

                  at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)

                  at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:200)

                  at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:186)

                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)

                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)

                  • 6. Re: JBoss cache deployment problem
                    Clearly the problem is coming from some of JBoss caching dependencies. can you somebody shed some light on this problem?
                    • 7. Re: JBoss cache deployment problem
                      galder.zamarreno

                      Most likely the issue is due to some jboss client jar or system or jnp jar being pulled into your deployment and then your deployment trying to to find the datasource in the wrong namespace. Check your dependencies in the deployment archive. Start by removing *all your dependencies* and then slowly add each. Leave any jboss jars that are out except jboss cache jar.

                       

                      And again, *there is nothing wrong about JBoss Cache here*

                      • 8. Re: JBoss cache deployment problem

                        Thanks for your reply!

                         

                        I will surely remove/add jars from the distribution. What's surprising is I pulled JBoss 4.2.2 distribution and still having problems with the JBoss cache.

                         

                        I will post a reply later....thanks

                        • 9. Re: JBoss cache deployment problem

                          Here is the list of jars get bundled with my war file

                           

                          antlr-2.7.6.jar

                          javassist-3.4.GA.jar

                          antlr-runtime-3.0.jar

                          jboss-common-core-2.2.10.GA.jar

                          aopalliance-1.0.jar

                          jboss-logging-spi-2.0.5.GA.jar

                          aspectjrt-1.6.0.jar

                          jbosscache-core-3.1.0.GA.jar

                          aspectjweaver-1.6.0.jar

                          jgroups-2.6.7.GA.jar

                          cglib-nodep-2.1_3.jar

                          commons-collections-3.1.jar

                          junit-4.4.jar

                          commons-dbcp-1.2.2.jar

                          jxl-2.4.2.jar

                          commons-lang-2.4.jar

                          commons-logging-1.1.jar

                          commons-pool-1.3.jar

                          mvel-1.3.1-java1.4.jar

                          drools-analytics-4.0.7.jar

                          persistence-api-1.0.jar

                          drools-ant-4.0.7.jar

                          poi-3.5-FINAL.jar

                          drools-compiler-4.0.7.jar

                          slf4j-api-1.5.5.jar

                          drools-core-4.0.7.jar

                          slf4j-log4j12-1.5.5.jar

                          drools-decisiontables-4.0.7.jar

                          spring-2.5.5.jar

                          drools-jsr94-4.0.7.jar

                          spring-beans-2.5.5.jar

                          ejb3-persistence-1.0.2.GA.jar

                          spring-context-2.5.5.jar

                          hibernate-annotations-3.4.0.GA.jar

                          spring-context-support-2.5.5.jar

                          hibernate-commons-annotations-3.1.0.GA.jar

                          spring-core-2.5.5.jar

                          spring-test-2.5.5.jar

                          hibernate-jbosscache2-3.3.2.GA.jar

                          hibernate-core-3.3.2.GA.jar

                          spring-web-2.5.5.jar

                          hibernate-validator-3.1.0.GA.jar

                          spring-webmvc-2.5.5.jar

                           

                          I can deploy the app by removing jboss-common-core-2.2.10.GA.jar from the bundle, but that means I can't use cache. There is no "non-cache" jar that I would think could cause this problem.

                           

                          thanks

                          • 10. Re: JBoss cache deployment problem

                            hey galder attached is the compress test project.

                             

                            When you uncompress the zip file you will find mysql-ds.xml (provided you have local mysql running with root/root; else change the config) that you can drop in your deploy directory along with the war file that you can create using the pom file

                             

                            Let me know if you can start the application without any problems.

                             

                            thanks