-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: RegionFactoryCacheProviderBridge: NullPointerException?
PostPosted: Wed Nov 12, 2008 9:43 pm 
Newbie

Joined: Wed Nov 12, 2008 9:03 pm
Posts: 2
I'm trying to get caching working in Hibernate Core, but I'm getting a NullPointerException when I access a cached object the second time (i.e. when Hibernate actually resorts to a cache). Here is the full stack trace:

Code:
SEVERE: Servlet.service() for servlet default threw exception
java.lang.NullPointerException
   at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.nextTimestamp(RegionFactoryCacheProviderBridge.java:85)
   at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:526)
   at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:535)
   at org.apache.jsp.cms.index_jsp._jspService(index_jsp.java:61)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
   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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
   at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:139)
   at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)


Note: I'm using Struts2 so there's more to this stack dump, but I don't think the rest is relevant.

At any rate, in my hibernate configuration I have:

Code:
<property name="hibernate.cache.provider_class">
   net.sf.ehcache.hibernate.EhCacheProvider
</property>


And here is my EhCache configuration:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
   <defaultCache
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"
        />
   <cache name="DataObj"
      maxElementsInMemory='2000'
      eternal='true'
      timeToIdleSeconds='0'
      timeToLiveSeconds='0'
      overflowToDisk='false'
   />
</ehcache>


I looked at RegionFactoryCacheProviderBridge, and it appears that cacheProvider has not been initialized, which is weird. Any ideas?

Thanks.

-- delsvr


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 22, 2009 7:12 am 
Newbie

Joined: Sun Feb 22, 2009 7:04 am
Posts: 1
Dear delsvr,

do you already have a solution for you problem?

I had the same problem, but without working with a cache, and it turned out that I accidentally called

PersistenceUtil.getEntityManagerFactory().close();

somewhere in the code. After commenting it out, it worked!

Cheers,
Floh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.