-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate 4.3.5 org/hibernate/service/jndi/JndiException
PostPosted: Wed May 21, 2014 4:52 pm 
Newbie

Joined: Wed May 21, 2014 3:42 pm
Posts: 3
I wanted to add second level caching to my app so I add the following to my hiberate.cfg.xml file:
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>

Now when my application trys to create a sessionfactory I get this error:
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/service/jndi/JndiException
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.jboss.logging.Logger$1.run(Logger.java:2252)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.jboss.logging.Logger.getMessageLogger(Logger.java:2227)
   at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
   at org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory.<clinit>(AbstractEhcacheRegionFactory.java:75)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:240)
   at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:125)
   at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:87)
   at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:46)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:295)
   at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2442)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2438)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1855)
   at com.wtdconsulting.prism.hibernate.HibernateUtil.createSessionFactory(HibernateUtil.java:69)
   at com.wtdconsulting.prism.server.PrysmDataServerEngine.<init>(PrysmDataServerEngine.java:95)
   at com.wtdconsulting.prism.server.PrysmDataServerEngine.main(PrysmDataServerEngine.java:358)
Caused by: java.lang.ClassNotFoundException: org.hibernate.service.jndi.JndiException
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 24 more

I am using the following jar files:
hibernate-c3p0-4.3.5.Final.jar
hibernate-commons-annotations-4.0.4.Final.jar
hibernate-core-4.3.5.Final.jar
hibernate-ehcache-4.0.0.CR6.jar
hibernate-entitymanager-4.3.5.Final.jar
hibernate-jpa-2.1-api-1.0.0.Final.jar

The code to create the sessionfactory is:
Code:
       Configuration configuration = new Configuration();
       configuration.configure();
       serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
       sessionFactory = configuration.buildSessionFactory(serviceRegistry);


If I remove the hibernate.cache.region.factory_class from my config I don't get the error. I have two questions:

1. Where is the class org.hibernate.service.jndi.JndiException found? I looked at all the above jar files and its not in any of them?
2. Why am I getting a JndiException?

Thanks,
Jim


Top
 Profile  
 
 Post subject: Re: Hibernate 4.3.5 org/hibernate/service/jndi/JndiException
PostPosted: Thu May 22, 2014 8:55 am 
Newbie

Joined: Wed May 21, 2014 3:42 pm
Posts: 3
UPDATE: I forgot to add that my hibernate.cfg.xml has a cache in it. If I remove the cache my app runs fine.
Code:
    <class-cache class="com.mycompany.hibernate.Users" usage="read-write"/>


Top
 Profile  
 
 Post subject: Re: Hibernate 4.3.5 org/hibernate/service/jndi/JndiException
PostPosted: Wed May 28, 2014 10:34 am 
Newbie

Joined: Wed May 21, 2014 3:42 pm
Posts: 3
Anybody know how to get this stuff to work?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.