-->
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.  [ 1 post ] 
Author Message
 Post subject: need help to use hibernate with jboss cluster and cache
PostPosted: Thu Aug 26, 2010 11:18 am 
Newbie

Joined: Sat Feb 06, 2010 1:45 am
Posts: 1
I want to develop web application with following requirements.
=> use jsp and Servlet.
=> dont need ejb.
=> use hibernate
=> must be distributed so Jboss cluster is one preference.

I have tried one sample example having one Contact table and Tried to enable second level cache in hibernate but did not succeeded.
I tried using Jboss Cache2 and then Infinispan also.
Read from some where that I need JTA supported application as I am not using ejb.

Following is my hibernate.cfg.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://127.0.0.1:5432/testDb</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">pwd</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>

<property name="hibernate.generate_statistics">true</property>

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

<property name="hibernate.cache.region.factory_class">org.hibernate.cache.infinispan.JndiInfinispanRegionFactory</property>

<property name="hibernate.cache.infinispan.cachemanager">java:CacheManager</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>

<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.cache.infinispan.statistics">true</property>
<property name="hibernate.cache.infinispan.cfg">infinispan.xml</property>
<property name="hibernate.cache.infinispan.entity.cfg">bean.Contact</property>

<property name="hibernate.cache.infinispan.entity.eviction.strategy">LRU</property>
<property name="hibernate.cache.infinispan.entity.eviction.wake_up_interval">10000</property>
<property name="hibernate.cache.infinispan.entity.eviction.max_entries">5000</property>
<property name="hibernate.cache.infinispan.entity.expiration.lifespan">60000</property>
<property name="hibernate.cache.infinispan.entity.expiration.max_idle">30000</property>

<property name="hibernate.cache.infinispan.AccountRegion.eviction.strategy">FIFO</property>
<property name="hibernate.cache.infinispan.AccountRegion.eviction.wake_up_interval">10000</property>

<mapping resource="contact.hbm.xml" />
</session-factory>
</hibernate-configuration>

But I am getting this error when I try to run my program.

20:46:17,792 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
20:46:17,807 INFO [org.hibernate.cache.infinispan.JndiInfinispanRegionFactory] Unable to retrieve CacheManager from JNDI [java:CacheManager]: javax.naming.NameNotFoundException: CacheManager not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final]
at org.jnp.server.NamingServer.lookup(NamingServer.java:443) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
at javax.naming.InitialContext.lookup(Unknown Source) [:1.6.0_06]
at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.locateCacheManager(JndiInfinispanRegionFactory.java:75) [:3.5.4-Final]
at org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.createCacheManager(JndiInfinispanRegionFactory.java:68) [:3.5.4-Final]
at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:246) [:3.5.4-Final]
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:250) [:3.5.4-Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) [:3.5.4-Final]
at manager.First.init(First.java:37) [:]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [:1.0.0.Beta2]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1208) [:6.0.0.20100721-M4]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:955) [:6.0.0.20100721-M4]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [:6.0.0.20100721-M4]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.20100721-M4]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.20100721-M4]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.CR3]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.CR3]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.20100721-M4]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:93) [:6.0.0.20100721-M4]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.20100721-M4]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.20100721-M4]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.20100721-M4]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.20100721-M4]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.20100721-M4]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.20100721-M4]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.20100721-M4]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [:6.0.0.20100721-M4]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.20100721-M4]
at java.lang.Thread.run(Unknown Source) [:1.6.0_06]


May be I am missing some configuration or any other help is appreciated.


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

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.