[jboss-user] [JBoss Cache] - caching the entities using EJB 3.0 for JBoss.
prabha ramasamy
do-not-reply at jboss.com
Tue Nov 1 06:22:49 EDT 2011
prabha ramasamy [http://community.jboss.org/people/psadha] created the discussion
"caching the entities using EJB 3.0 for JBoss."
To view the discussion, visit: http://community.jboss.org/message/634406#634406
--------------------------------------------------------------
We are using the following approach to cache the entities using EJB 3.0 for JBoss.
Persistnce.xml changes :
<persistence-unit name="OracleDatabase" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/ClientPointeDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
<property name="hibernate.show_sql" value="true" />
<!-- These are the default for JBoss EJB3 -->
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/oracleDatabase" />
<!-- JBoss Cache Related Changes -->
<!-- <property name="hibernate.cache.use_second_level_cache" value="true"/>-->
<!-- <property name="hibernate.cache.use_query_cache" value="true"/>-->
<!-- <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/>-->
<!-- <property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/>-->
<!-- <property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/>-->
<!-- <property name="hibernate.cache.region.jbc2.cfg.query" value="local-query"/>-->
<!-- <property name="hibernate.show_sql" value="true"/>-->
<property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
<property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>
<!-- <property name="hibernate.ejb.classcache.services.entities.InstitutionData" value="transactional"/>
<property name="hibernate.ejb.classcache.services.entities.InstitutionStatus" value="transactional"/> -->
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/>
<property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/>
<property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/>
<property name="hibernate.cache.region.jbc2.cfg.collection" value="mvcc-entity"/>
</properties>
@XmlRootElement(name="institutionData")
@XmlType(propOrder={})
@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
public class InstitutionData {
/**
* Apache Logger reference
*/
}
We are getting the following Exception
[SessionFactoryImpl] building session factory
15:50:44,520 INFO [JndiMultiplexingCacheInstanceManager] Unable to retreive Cache from JNDI [java:CacheManager]
[SessionFactoryImpl] building session factory
15:50:44,520 INFO [JndiMultiplexingCacheInstanceManager] Unable to retreive Cache from JNDI [java:CacheManager]
javax.naming.NameNotFoundException: CacheManager not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.hibernate.cache.jbc2.builder.JndiMultiplexingCacheInstanceManager.locateCacheFactory(JndiMultiplexingCacheInstanceManager.java:83)
at org.hibernate.cache.jbc2.builder.JndiMultiplexingCacheInstanceManager.start(JndiMultiplexingCacheInstanceManager.java:72)
at org.hibernate.cache.jbc2.JBossCacheRegionFactory.start(JBossCacheRegionFactory.java:106)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/634406#634406]
Start a new discussion in JBoss Cache at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111101/9f9c4d29/attachment-0001.html
More information about the jboss-user
mailing list