1 2 Previous Next 20 Replies Latest reply: Jun 23, 2013 10:08 AM by Scott Marlow RSS

Upgraded to AS 7.1.1, null pointer exception inside Infinispan

Darrell Burgan Newbie

Hello, we are in process of upgrading to 7.1.1, which seems to resolve a number of issues for us, but one new issue has cropped up. Even in standalone mode, I can't run our web app inside AS7.1.1 because Infinispan is throwing a NPE:

 

16:25:12,399 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-5) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonShardEntityManagerFactory' defined in "/home/dburgan/bin/jboss-as-7.1.1.Final/standalone/deployments/pa-testing-web.war/WEB-INF/lib/pa-persistence-1.0.0.M3-SNAPSHOT.jar/META-INF/spring/applicationContext-jpa.xml": Invocation of init method failed; nested exception is java.lang.NullPointerException

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:728) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:449) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384) [spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) [spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_02]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_02]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonShardEntityManagerFactory' defined in "/home/dburgan/bin/jboss-as-7.1.1.Final/standalone/deployments/pa-testing-web.war/WEB-INF/lib/pa-persistence-1.0.0.M3-SNAPSHOT.jar/META-INF/spring/applicationContext-jpa.xml": Invocation of init method failed; nested exception is java.lang.NullPointerException

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:400) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:275) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:99) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1475) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1443) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          ... 18 more

Caused by: java.lang.NullPointerException

          at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCache(InfinispanRegionFactory.java:445) [hibernate-infinispan-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.cache.infinispan.InfinispanRegionFactory.buildEntityRegion(InfinispanRegionFactory.java:198) [hibernate-infinispan-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:339) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:257) [spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) [spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

          ... 33 more

 

I've traced it into the code and it gets as far as org.infinispan.factories.AbstractComponentRegistry line 406:

 

   @SuppressWarnings("unchecked")

   public <T> T getComponent(String componentClassName, String name, boolean nameIsFQCN) {

      Component wrapper = lookupComponent(componentClassName, name, nameIsFQCN);

      if (wrapper == null) return null;

 

 

      return (T) unwrapComponent(wrapper);

   }

 

Basically the wrapper == null, so it returns null, and this sets off the NPE at InfinispanRegionFactory line 445 as shown above.


We're using the Infinispan provided by AS7.1.1, so it is 5.1.2 final.

 

Here is the standalone.xml:

 

http://pastebin.com/sznrbNCY

 

Kind of at a loss here. This app was working fine under AS7.1. We go live in a few weeks, so I'd really like to set the precedent of using 7.1.1 since it fixes so many issues. Any suggestions?

 

Thanks!
Darrell

  • 1. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Darrell Burgan Newbie

    One more bit of data. Here are the values passed in to:

     

    public <T> T getComponent(String componentClassName, String name, boolean nameIsFQCN)

     

    componentClassName: org.hibernate.cache.infinispan.util.CacheCommandInitializer

    name: org.hibernate.cache.infinispan.util.CacheCommandInitializer

    nameIsFQCN: true


  • 2. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Darrell Burgan Newbie

    Still more information:

     

    We're running inside of Spring 3.1, so I think this means we are a "standalone hibernate" application from the perspective of AS7.1.1.

     

    When I annotate the cache container to start eagerly, the NPE above happens:

     

            <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">

                <cache-container name="hibernate" default-cache="local-query" start="EAGER" jndi-name="java:jboss/infinispan/container/hibernate">

                    <local-cache name="entity">

                        <transaction mode="NON_XA"/>

                        <eviction strategy="LRU" max-entries="10000"/>

                        <expiration max-idle="100000"/>

                    </local-cache>

                    <local-cache name="local-query">

                        <transaction mode="NONE"/>

                        <eviction strategy="LRU" max-entries="10000"/>

                        <expiration max-idle="100000"/>

                    </local-cache>

                    <local-cache name="timestamps">

                        <transaction mode="NONE"/>

                        <eviction strategy="NONE"/>

                    </local-cache>

                </cache-container>

            </subsystem>

     

    When I take away the eager loading annotation, I get an exception saying the cache manager cannot be found via JNDI:

     

    Caused by: org.hibernate.cache.CacheException: Unable to retrieve CacheManager from JNDI [java:jboss/infinispan/container/hibernate]

              at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.locateCacheManager(JndiInfinispanRegionFactory.java:75) [hibernate-infinispan-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.createCacheManager(JndiInfinispanRegionFactory.java:64) [hibernate-infinispan-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:275) [hibernate-infinispan-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:271) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              ... 39 more

     

    Here is an excerpt from our Spring application context which defines the Hibernate settings:

     

    <util:map id="jpaPropertyMap" map-class="java.util.HashMap">

              <entry key="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />

              <entry key="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.DefaultNamingStrategy" />

              <entry key="hibernate.connection.charSet" value="UTF-8" />

              <entry key="hibernate.show_sql" value="false"/>

              <entry key="hibernate.validator.apply_to_ddl" value="false" />

              <entry key="hibernate.validator.autoregister_listeners" value="false" />

              <entry key="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>

              <entry key="hibernate.cache.use_second_level_cache" value="true" />

              <entry key="hibernate.cache.use_minimal_puts" value="true" />

              <entry key="hibernate.cache.use_query_cache" value="true" />

              <entry key="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/container/hibernate"/>

              <entry key="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory"/>

              <!-- <entry key="hibernate.cache.region.factory_class" value="com.pa.persistence.tools.cache.ListeningJndiInfinispanRegionFactory"/> -->

              <!-- <entry key="hibernate.cache.region.factory_class" value="com.pa.persistence.tools.cache.trivial.TrivialCacheRegionFactory" /> -->

    </util:map>

     

    If I change our app to use the "trivial cache", the app stands up great. So this is directly related to Infinispan or how we are using it.

     

    I turned on DEBUG in the root logger and here is the server.log from an AS7.1.1 startup that generates the NPE:

     

    http://momerath.info/tmp/debug.server.log.zip

     

    Any help anyone can provide would be really great. We are completely stuck and cannot get our app to stand up inside AS7.1.1 standalone. Again, it works fine in AS7.1 standalone ... so it is something different between those two releases.

     

    Thanks,

    Darrell

  • 3. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Galder Zamarreño Master

    If you're running 2LC within AS7, you need to configure it according to: https://docs.jboss.org/author/x/LoJ7

     

    IOW, don't set hibernate.cache.infinispan.cachemanager nor hibernate.cache.region.factory_class.

     

    This is because internally, we need to do some magic so that Infinispan can see Hibernate's command extensions and we do that using a specific region factory for AS7. Without that, Infinispan cannot see Hibernate's command extensions and so you see that NPE.

     

    Btw, the same applies to both JPA and native Hibernate apps.

     

    p.s. We're in the process of updating https://docs.jboss.org/author/x/FgY5 to clarify this.

  • 4. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Darrell Burgan Newbie

    Okay thanks, I'll dig into it. On first blush, when I took hibernate.cache.infinispan.cachemanager and hibernate.cache.region.factory_class out of our app context, when I started up Hibernate complained it could not figure out who the cache manager was. But maybe I have something else going on.

     

    One thing I did notice is that there is a big difference in the packaging of hibernate-infinispan between 7.1.0 and 7.1.1. The hibernate-infinispan jar is no longer under /modules/org/hibernate/infinispan/main; it got moved to under /modules/org/hibernate/main. I don't know if this has anything to do with anything, but it seemed significant.

     

    I'll post back results after I read through https://docs.jboss.org/author/x/LoJ7 ... thanks!

  • 5. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Darrell Burgan Newbie

    Well, I'm not getting any where with this. No matter what I do, if I do not set hibernate.cache.infinispan.cachemanager and hibernate.cache.region.factory_class, I get the following:

     

    14:35:46,411 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/pa-testing-web]] (MSC service thread 1-15) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonShardEntityManagerFactory' defined in "/home/dburgan/bin/jboss-as-7.1.1.Final/standalone/deployments/pa-testing-web.war/WEB-INF/lib/pa-persistence-1.0.0.M3-SNAPSHOT.jar/META-INF/spring/applicationContext-jpa.xml": Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: commonShardPU] Unable to build EntityManagerFactory

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:728) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:449) [spring-context-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384) [spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) [spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_02]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_02]

              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonShardEntityManagerFactory' defined in "/home/dburgan/bin/jboss-as-7.1.1.Final/standalone/deployments/pa-testing-web.war/WEB-INF/lib/pa-persistence-1.0.0.M3-SNAPSHOT.jar/META-INF/spring/applicationContext-jpa.xml": Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: commonShardPU] Unable to build EntityManagerFactory

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:400) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:275) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

              at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

              at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

              at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:99) [spring-tx-3.0.6.RELEASE.jar:3.0.6.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1475) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1443) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              ... 18 more

    Caused by: javax.persistence.PersistenceException: [PersistenceUnit: commonShardPU] Unable to build EntityManagerFactory

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:257) [spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) [spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]

              ... 33 more

    Caused by: org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]

              at org.hibernate.cache.internal.NoCachingRegionFactory.buildEntityRegion(NoCachingRegionFactory.java:68) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:339) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

              ... 39 more

     

    I'm really confused by how I wire Spring and JBoss together to play ball on this. I'm getting fairly anxious about it, too, because I have to be able to stand up JBoss + Spring + Infinispan, all using XA transactions, all by our deadline next month, and so far I have not been able to do it. Is this just not a doable configuration?

     

    Thanks for your help and patience ....

  • 6. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    John Jacobs Newbie

    Hi Galder,

     

    I'm working with Darrell on this problem. To completely isolate it we've stripped our JPA configuration down to the "bare minimum" and configured it exactly like https://docs.jboss.org/author/x/LoJ7. So Hibernate is being bootstrapped by JBoss AS in this example.

     

    Here's our persistence.xml: http://pastebin.com/Bdnhsycc

     

    I can start our application just fine with an out-of-the-box standalone.xml from 7.1.1, nothing but our datasources added to it. However, as soon as I add back start="EAGER" at either the cache-container or local-cache level it fails with the NullPointerException Darrell included in his original post.

     

    Here is my cache configuration:

     

            <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">

                <cache-container name="hibernate" default-cache="local-query" start="EAGER">

                    <local-cache name="entity">

                        <transaction mode="NON_XA"/>

                        <eviction strategy="LRU" max-entries="10000"/>

                        <expiration max-idle="100000"/>

                    </local-cache>

                    <local-cache name="local-query">

                        <transaction mode="NONE"/>

                        <eviction strategy="LRU" max-entries="10000"/>

                        <expiration max-idle="100000"/>

                    </local-cache>

                    <local-cache name="timestamps">

                        <transaction mode="NONE"/>

                        <eviction strategy="NONE"/>

                    </local-cache>

                </cache-container>

            </subsystem>

     

    Since our production configuration will be standalone hibernate we really need the eager start to work. According to https://community.jboss.org/message/648238 and the associated JIRA this configuration should be working. Are we missing something?

     

    Thanks,

     

    John

  • 7. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Galder Zamarreño Master

    John, you shouldn't need EAGER to be enabled, because the AS internals will make sure these caches are started when the JPA entities are deployed.

     

    I'd suggest leaving cache configuration as is and see if your app behaves as expected

     

    In the mean time I'll check with the AS guys to see what's up with EAGER in these caches.

  • 8. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Scott Marlow Master

    Could you try again with the AS7 nightly build.  I don't think that AS7-4315 helps your situation but I'd still like to see what happens when you try (a few other fixes have also gone in that might help).

     

    Since your not using EE container managed JPA, you should configure to use org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory. 

    Try setting hibernate.cache.region.factory_class to "org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory". 

     

    The hibernate.cache.region.factory_class property is only automatically set for you, if your EE container managed JPA.  That doesn't happen for Hibernate native applications or Spring apps.https://docs.jboss.org/author/display/AS71/JPA+Reference+Guide#JPAReferenceGuide-Persistenceunitproperties

     

    Regarding the "EAGER" setting, I don't disagree with Galder (about leaving it unspecified unless you have to enable it).

     

    Please attach the server.log after you have pulled these changes together.  Perhaps, also enable TRACE logging for org.jboss.as.jpa, org.jboss.jpa, org.infinispan, org.hibernate.  See link here about how to enable logging.

  • 9. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Charles Akalugwu Newbie

    I am having the exact same problems as described by Darrell Burgan. Only difference is that I am developing a seam 2.3 app. Was this resolved? I will try Scott Marlows suggestion and report back.

  • 10. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Charles Akalugwu Newbie

    Since your not using EE container managed JPA, you should configure to use org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory.

    Try setting hibernate.cache.region.factory_class to "org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory".

     

    The hibernate.cache.region.factory_class property is only automatically set for you, if your EE container managed JPA.  That doesn't happen for Hibernate native applications or Spring apps.https://docs.jboss.org/author/display/AS71/JPA+Reference+Guide#JPAReferenceGuide-Persistenceunitproperties

     

    This was the right answer. Spot on!

  • 11. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Darrell Burgan Newbie

    Charles Akalugwu wrote:

     

    Since your not using EE container managed JPA, you should configure to use org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory.

    Try setting hibernate.cache.region.factory_class to "org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory".

     

    The hibernate.cache.region.factory_class property is only automatically set for you, if your EE container managed JPA.  That doesn't happen for Hibernate native applications or Spring apps.https://docs.jboss.org/author/display/AS71/JPA+Reference+Guide#JPAReferenceGuide-Persistenceunitproperties

     

    This was the right answer. Spot on!

     

    Oh good, let me give this a try.

     

    We ran out of time and ended up having to slap a webapp-specific ehcache in to get us past our deadline. But I'm not happy with this solution for a number of reasons, not the least of which is that I believe Infinispan to be a far more robust and well designed product. The open source ehcache feels like a local cache that has clustering grafted on as an afterthought, whereas Infinispan is designed from the ground up to be a clustered cache. I have no knowledge of the commercial Terracotta product, but I don't want to shell out precious IT budget for software when an excellent open source solution exists.

     

    Anyway, I'm hoping to change back to using JBoss-provided caches via Infinispan, so we have one caching solution across the board. When I can make some time, I'll see if I can reconfigure our app to use the Infinispan caching.

  • 12. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Dmitri Zamysloff Newbie

    Hi, have also NPE in InfinispanRegionFactory (names of deployment unit and persistence unit are changed).

     

    11:42:24,789 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."XXXXX-1.0-SNAPSHOT.war#XXXXXXX": org.jboss.msc.service.StartException in service jboss.persistenceunit."XXXXX-1.0-SNAPSHOT.war#XXXXXXX": Failed to start service

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_05]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_05]

              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05]

    Caused by: java.lang.NullPointerException

              at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCache(InfinispanRegionFactory.java:445)

              at org.hibernate.cache.infinispan.InfinispanRegionFactory.buildEntityRegion(InfinispanRegionFactory.java:198)

              at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:339)

              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)

              at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)

              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)

              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              ... 3 more

     

     

     

     

     

    Use Jboss 7.1.1.Final

     

    standalone.xml infinispan part:

     

    <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">

                <cache-container name="hibernate" default-cache="local-query">

                    <local-cache name="entity">

                        <transaction mode="NON_XA"/>

                        <eviction strategy="LRU" max-entries="10000"/>

                        <expiration max-idle="100000"/>

                    </local-cache>

                    <local-cache name="local-query">

                        <transaction mode="NONE"/>

                        <eviction strategy="LRU" max-entries="10000"/>

                        <expiration max-idle="100000"/>

                    </local-cache>

                    <local-cache name="timestamps">

                        <transaction mode="NONE"/>

                        <eviction strategy="NONE"/>

                    </local-cache>

                </cache-container>

            </subsystem>

     

    I am deploying war archive which has jar with

    persistence.xml

     

    <?xml version="1.0" encoding="UTF-8"?>

    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

      <persistence-unit name="orbis-os-sys" transaction-type="JTA">

                <jta-data-source>OracleDS</jta-data-source>

            <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>

                          <class>...</class>

             

              <property name="hibernate.show_sql" value="false"/>

          <property name="hibernate.format_sql" value="true"/>

          <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>

     

         <property name="hibernate.cache.use_second_level_cache" value="true"/>

          </properties>

      </persistence-unit>

    </persistence>

    war has following dependencies in META-INF/manifest.mf

     

    Dependencies: org.infinispan,org.hibernate

     

     

    The exception occures by startup. By redeploy it works.

    Any fixes?

  • 13. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    m.improta Newbie

    Experiencing the same problem of Dmitri Zamysloff.

  • 14. Re: Upgraded to AS 7.1.1, null pointer exception inside Infinispan
    Tristan Tarrant Master

    My recommendation is to try with AS 7.1.2 or with EAP 6.1.

1 2 Previous Next