Rifidi edge Server 2.0 and JPA / Hibernate

Questions about developing the edge server core as well as applications

Moderators: Matt, kyle

Post Reply
roberto
Posts: 8
Joined: Tue Apr 09, 2013 5:36 am

Rifidi edge Server 2.0 and JPA / Hibernate

Post by roberto » Tue Apr 16, 2013 11:09 am

Hi,
I would like to know how to use hibermate 4 or JPA 2 in Rifidi 2.0.

Here the details of the environmental:
1. Your OS : Windows 8 64bit
2. Your eclipse version: Juno Sr2 Win32
3. Your Java version: jdk7 32 bit
4. Whether you have set the Target platform: yes
5. The result of Run Configuration > "validate bundles": everything ok

I'm trying to use it but spring cannot resolve some hibernate core classes.

Here the persistence.xml imported from the spring.xml with

Code: Select all

<import resource="persistence.xml" />
Here the persistence.xml

Code: Select all

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
	xmlns:amq="http://activemq.apache.org/schema/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/osgi 
    http://www.springframework.org/schema/osgi/spring-osgi.xsd">

	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
		<property name="url" value="jdbc:mysql://localhost:3306/eagle-20" />
		<property name="username" value="root" />
		<property name="password" value="" />
	</bean>

	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="packagesToScan" value="it.eximia.eagle.entity.base" />
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
				<prop key="hibernate.hbm2ddl.auto">create-drop</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>

	<bean id="transactionManager"
		class="org.springframework.orm.hibernate4.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
</beans>
here the manifest of my application:

Code: Select all

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PrinterManager
Bundle-SymbolicName: it.eximia.eagle.core
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.espertech.esper.client,
 com.mysql.jdbc;version="5.1.10",
 javax.persistence;version="1.0.0",
 org.apache.commons.dbcp;version="1.2.2.osgi",
 org.apache.commons.logging;version="1.1.1",
 org.eclipse.osgi.framework.console;version="1.0.0",
 org.osgi.framework;version="1.5.0",
 org.springframework.jdbc.datasource;version="3.1.2.RELEASE",
 org.springframework.orm;version="3.1.2.RELEASE",
 org.springframework.orm.hibernate4;version="3.1.2.RELEASE",
 org.springframework.orm.hibernate4.support;version="3.1.2.RELEASE",
 org.springframework.orm.jpa;version="3.1.2.RELEASE",
 org.springframework.orm.jpa.aspectj;version="3.1.2.RELEASE",
 org.springframework.orm.jpa.persistenceunit;version="3.1.2.RELEASE",
 org.springframework.orm.jpa.support;version="3.1.2.RELEASE",
 org.springframework.orm.jpa.vendor;version="3.1.2.RELEASE"
Require-Bundle: org.fosstrak.tdt.tdt;bundle-version="0.9.0",
 org.rifidi.edge;bundle-version="5.4.0"
Bundle-Vendor: Eximia srl
and the errore that I have:

Code: Select all

Exception in thread "SpringOsgiExtenderThread-13" 17:02:26,228 ERROR org.springframework.osgi.extender.internal.activator.ContextLoaderListener:50 - Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=it.eximia.eagle.core, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [bundleentry://101.fwk30350615/META-INF/spring/persistence.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
I tried to dejar the org.springframework.orm.jar plugin and that Configuration Class does not exist.

So can you help me with Hibernate in Rifidi 2.0?

Thanks,
Roberto

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests