Hi Tanvi,
Yes, I've found a solution to my problem, but it was a long time ago and I'm
not on this project anymore, so I'm trying to remember the solution.
I hope this is the way to solve your problem : I had to upgrade Spring to
version 3.14, and Hibernate to version 4.10 and modify the configuration of my
bundle.
You have to uninstall version 3.07 of Spring before installing version 3.14.
Be careful, it's not easy and some bundles are system bundle.
After that and before installing the persistence bundle, you have to install
these features :
<!-- Librairies -->
<feature name="image-libs-hibernate" version="4.1.0">
<bundle
start-level='80'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_5</bundle>
<bundle
start-level='80'>mvn:org.jboss.javassist/com.springsource.javassist/3.15.0.GA</bundle>
<bundle
start-level='80'>mvn:org.antlr/com.springsource.antlr/2.7.7</bundle>
<bundle
start-level='80'>mvn:com.fasterxml/com.springsource.com.fasterxml.classmate/0.5.4</bundle>
<bundle
start-level='80'>mvn:javax.validation/com.springsource.javax.validation/1.0.0.GA</bundle>
<bundle
start-level='80'>mvn:org.jboss/com.springsource.org.jboss.jandex/1.0.3.Final</bundle>
<bundle
start-level='80'>mvn:org.apache.ant/com.springsource.org.apache.tools.ant/1.8.1</bundle>
<bundle
start-level='80'>mvn:org.apache.commons/com.springsource.org.apache.commons.collections/3.2.1</bundle>
<bundle
start-level='80'>mvn:org.hibernate/com.springsource.org.hibernate.core/4.1.0.Final</bundle>
<bundle
start-level='80'>mvn:org.hibernate/com.springsource.org.hibernate.ejb/4.1.0.Final</bundle>
<bundle
start-level='80'>mvn:javax.persistence/com.springsource.javax.persistence/2.0.0</bundle>
<bundle
start-level='80'>mvn:org.hibernate.common/com.springsource.org.hibernate.annotations.common/4.1.0.Final</bundle>
<bundle
start-level='80'>mvn:org.jboss.logging/jboss-logging/3.1.0.GA</bundle>
<bundle
start-level='80'>mvn:com.mchange.c3p0/com.springsource.com.mchange.v2.c3p0/0.9.1.2</bundle>
<bundle
start-level='80'>mvn:org.aspectj/com.springsource.org.aspectj.weaver/1.6.8.RELEASE</bundle>
</feature>
<feature>
<feature version="3.1.4.RELEASE">spring</feature>
<feature
version="3.1.4.RELEASE">spring-jms</feature>
<feature
version="3.1.4.RELEASE">spring-web</feature>
<feature
version="3.1.4.RELEASE">spring-tx</feature>
<feature
version="3.1.4.RELEASE">spring-orm</feature>
</feature>
My configuration on the persistence bundle was :
On pom.xml, the bundle imports these packages :
- org.hibernate.proxy,
- org.postgresql.*,
- org.springframework.orm.hibernate4,
- com.mchange.v2.c3p0,
And dependencies are :
<!-- Postgres Database driver -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.4-702.jdbc4</version>
</dependency>
<!-- Hibernate Annotations for mapping -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<!-- C3P0 pour le pool de connexion vers la BDD
-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
</dependencies>
And these beans are defined on bundle-context.xml :
<!-Datasource -->
<bean id="c3p0dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass"
value="org.postgresql.Driver" />
<property name="jdbcUrl"
value="${hibernate.connection.url}" />
<property name="user"
value="${hibernate.connection.username}" />
<property name="password"
value="${hibernate.connection.password}" />
<property name="acquireIncrement"
value="1"></property>
<property name="minPoolSize"
value="15"></property>
<property name="maxPoolSize"
value="50"></property>
<property name="acquireRetryAttempts"
value="10"></property>
<property name="preferredTestQuery"
value="SELECT 1"></property>
<property name="testConnectionOnCheckin"
value="true"></property>
<property name="testConnectionOnCheckout"
value="false"></property>
<property name="maxIdleTime"
value="50"></property>
<property name="idleConnectionTestPeriod"
value="30"></property>
</bean>
<bean id="sessionFactoryBean"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="c3p0dataSource"
/>
<property name="packagesToScan">
<list>
<value>fr.
image.commons </value>
<value>fr.image.
om</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop
key="hibernate.hbm2ddl.auto">update</prop>
<prop
key="hibernate.connection.release_mode">on_close</prop>
<prop
key="hibernate.default_schema">public</prop>
<prop
key="hibernate.current_session_context_class">org.hibernate.context.internal.ThreadLocalSessionContext</prop>
<prop
key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
<prop
key="javax.persistence.validation.mode">none</prop>
<prop
key="show_sql">false</prop>
</props>
</property>
</bean>
I hope it will help you,
Vincent Zwingmann
Technical Architect
[email protected]<mailto:[email protected]>
www.steria.fr<http://www.steria.fr/>
De : [email protected] [via Karaf]
[mailto:[email protected]]
Envoyé : lundi 7 octobre 2013 21:27
À : Vincent ZWINGMANN
Objet : Re: Karaf - Hibernate/c3p0 Issue - ClassLoadingException
Hi,
Were you able to figure out the solution?
I am facing similar issue of c3p0 connection creation in Karaf. Its giving me
error like
Exception in thread
"com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1"
java.lang.NoClassDefFoundError: org/ietf/jgss/GSSCredential
Please let me know if you could find the solution for the problem.
Thanks,
Tanvi
________________________________
If you reply to this email, your message will be added to the discussion below:
http://karaf.922171.n3.nabble.com/Karaf-Hibernate-c3p0-Issue-ClassLoadingException-tp4027985p4029866.html
To unsubscribe from Karaf - Hibernate/c3p0 Issue - ClassLoadingException, click
here<http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4027985&code=dmluY2VudC56d2luZ21hbm5Ac3RlcmlhLmNvbXw0MDI3OTg1fDMwODQ1OTc5Mw==>.
NAML<http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
This email and any attachments may contain confidential information and
intellectual property (including copyright material). It is only for the use of
the addressee(s) in accordance with any instructions contained within it. If
you are not the addressee, you are prohibited from copying, forwarding,
disclosing, saving or otherwise using it in any way. If you receive this email
in error, please immediately advise the sender and delete it. Steria may
monitor the content of emails within its network to ensure compliance with its
policies and procedures. Emails are susceptible to alteration and their
integrity (including origin) cannot be assured. Steria shall not be liable for
any modification to a message, or for messages falsely sent.
--
View this message in context:
http://karaf.922171.n3.nabble.com/Karaf-Hibernate-c3p0-Issue-ClassLoadingException-tp4027985p4029867.html
Sent from the Karaf - User mailing list archive at Nabble.com.