karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas_cage <conai...@gmail.com>
Subject Unable to create EntityManagerFactory
Date Sun, 28 May 2017 08:29:00 GMT
friends I'm new to Karaf, I'm trying to create entity manager factory using 
the below code but unable to create it

Code:
 new HibernateOgmPersistence().createEntityManagerFactory("MY_PU", props);

persistence.xml:

	<persistence-unit name="MY_PU" transaction-type="RESOURCE_LOCAL">
		
		<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider> 
		<class>internal_class</class>
		<properties>
			<property name="hibernate.ogm.datastore.provider"
			
value="org.hibernate.ogm.datastore.cassandra.impl.CassandraDatastoreProvider"
/>
			<property name="hibernate.ogm.datastore.host" value="localhost" />
			<property name="hibernate.ogm.datastore.port" value="9142" />
			<property name="hibernate.ogm.datastore.database" value="ALPHA" />
			<property name="hibernate.ogm.datastore.grid_dialect"
				value="org.hibernate.ogm.datastore.cassandra.CassandraDialect" />
		</properties>
	</persistence-unit>

My persistence.xml file location is in
src/main/resources/META-INF/persistence.xml, However if I try using
Persistence.createEntityManagerFactory, I get 

Exception in thread "main" javax.persistence.PersistenceException: No
Persistence provider for EntityManager named MY_PU. Please help how I can
overcome this issue

I tried below options:

1. Placed  META-INF/persistence.xml under src/main/java.
2. Made configuration changes in eclipse to remove the resource folder's
excluded list from *.* to None.
3. Tried creating entity manager using new
PersistenceProvider().createEntityManagerFactory("MY_PU")
4. Tried with Eclipselink

But none of the above steps solved my issue. How can I make Karaf identify
the persistence.xml file location and make it read the persistence units. I
saw some post on making ConfigAdmin service configuration, can someone
thrown some light on ConfigAdmin service with sample code.

Thanks





--
View this message in context: http://karaf.922171.n3.nabble.com/Unable-to-create-EntityManagerFactory-tp4050478.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Mime
View raw message