This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 194198 - NoClassDefFoundError: com/mchange/v2/c3p0/DataSources
Summary: NoClassDefFoundError: com/mchange/v2/c3p0/DataSources
Status: RESOLVED WORKSFORME
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
: 194647 201897 215551 226423 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-10 22:10 UTC by jungmat
Modified: 2013-07-08 13:03 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 167694


Attachments
stacktrace (1.33 KB, text/plain)
2011-01-10 22:10 UTC, jungmat
Details
stacktrace (1.33 KB, text/plain)
2011-03-13 23:12 UTC, jungmat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jungmat 2011-01-10 22:10:17 UTC
Build: NetBeans IDE 6.9.1 (Build 201007282301)
VM: Java HotSpot(TM) Client VM, 19.0-b09, Java(TM) SE Runtime Environment, 1.6.0_23-b05
OS: Linux

User Comments:
jungmat: only crashed when C3P0 connection provider is activated thru hibernate.cfg.xml

<property name="hibernate.connection.provider_class">
        org.hibernate.connection.C3P0ConnectionProvider
</property>

magoarcano: I was trying to start writing the first lines in HQL editor with  .cfg.xml file

jungmat: when i'am trying to execute an HQL query in HQL  Query netbeans interface




Stacktrace: 
java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/DataSources
   at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:154)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
   at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
Comment 1 jungmat 2011-01-10 22:10:20 UTC
Created attachment 104859 [details]
stacktrace
Comment 2 jungmat 2011-03-13 23:12:59 UTC
Created attachment 106960 [details]
stacktrace

I am trying to execute an hql query in HQL query editor ; C3P0 library is there

when I am remove 

<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

in hibernate.cfg.xml file the query is running fine

Application is working fine even with or without the above config line 

maybe it's a bug in HQL Netbeans Editor ?

Best Regards 
Matthieu
Comment 3 Jaroslav Tulach 2011-04-13 16:08:09 UTC
Unless I am mistaken D-Light is using HSQL, so Maria, please deal with evaluation of the issue.
Comment 4 Maria Tishkova 2011-04-14 10:25:10 UTC
Jarda,

 What we have in D-Light is H2 Java embedded database which uses SQL. Nothing to do with HQL...

So I cannot evaluate and move back to platform

==Maria
Comment 5 Jaroslav Tulach 2011-04-15 06:44:02 UTC
Opps, sorry. I mistaken H2 SQL with HQL. Moving to hibernate.
Comment 6 Sergey Petrov 2011-04-15 08:18:28 UTC
Can someone provide sample project?
What does it mean "C3P0 library is there"? Is "com/mchange/v2/c3p0/DataSources" in this library?
Comment 7 jungmat 2011-04-16 11:02:41 UTC
(In reply to comment #6)
> Can someone provide sample project?
> What does it mean "C3P0 library is there"? Is "com/mchange/v2/c3p0/DataSources"
> in this library?

Hello Sergey,
Here below an hibernate.cfg.xml sample ; you can modify it so that it point to one of your own tables ; if you try to execute a simple HQL query, in my case <from Cities> in the netbeans HQL editor unless connection C3P0 provider (line commented) the query is working fine ; if you uncomment the C3P0 connection provider line you will receive the stacktrace ; if you run the "full" application (and consequently the queries) with the NetBeans <run> command (with connection provider C3P0) the application is also working fine.
To give an answer to your other question about the library : "com/mchange/v2/c3p0/DataSources" is in this library. 
In view of the exchanges between the different NetBeans support teams, allow me to announce my intuition about this bug: given that the stacktrace arrives in one of first stages of execution, probably during the translation of HQL in SQL, I evaluate that it is the component HQL Editor which is not (or not yet) compatible with C3P0, as though the translator did not know what to make of the " connection provider "... Can you verify this supposition ?

Thanks in advance
Matthieu

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
	<session-factory>
		<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
		<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
		<property name="hibernate.connection.url">jdbc:mysql://fedora.linux.pc:3306/TripAssist</property>
		<property name="hibernate.connection.username">jungmat</property>
		<property name="hibernate.connection.password">******</property>
		<property name="hibernate.connection.autocommit">true</property>
		<property name="hibernate.show_sql">false</property>
		<!-- Caution : the next line does not work in HQL Query Console -->
		<!--    <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>-->
		<mapping resource="tripassist/entity/Cities.hbm.xml"/>
	</session-factory>
</hibernate-configuration>
Comment 8 jungmat 2011-04-16 11:05:18 UTC
(In reply to comment #6)
> Can someone provide sample project?
> What does it mean "C3P0 library is there"? Is "com/mchange/v2/c3p0/DataSources"
> in this library?

Hello Sergey,
Here below an hibernate.cfg.xml sample ; you can modify it so that it point to one of your own tables ; if you try to execute a simple HQL query, in my case <from Cities> in the netbeans HQL editor unless connection C3P0 provider (line commented) the query is working fine ; if you uncomment the C3P0 connection provider line you will receive the stacktrace ; if you run the "full" application (and consequently the queries) with the NetBeans <run> command (with connection provider C3P0) the application is also working fine.
To give an answer to your other question about the library : "com/mchange/v2/c3p0/DataSources" is in this library. 
In view of the exchanges between the different NetBeans support teams, allow me to announce my intuition about this bug: given that the stacktrace arrives in one of first stages of execution, probably during the translation of HQL in SQL, I evaluate that it is the component HQL Editor which is not (or not yet) compatible with C3P0, as though the translator did not know what to make of the " connection provider "... Can you verify this supposition ?

Thanks in advance
Matthieu

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
	<session-factory>
		<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
		<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
		<property name="hibernate.connection.url">jdbc:mysql://fedora.linux.pc:3306/TripAssist</property>
		<property name="hibernate.connection.username">jungmat</property>
		<property name="hibernate.connection.password">******</property>
		<property name="hibernate.connection.autocommit">true</property>
		<property name="hibernate.show_sql">false</property>
		<!-- Caution : the next line does not work in HQL Query Console -->
		<!--    <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>-->
		<mapping resource="tripassist/entity/Cities.hbm.xml"/>
	</session-factory>
</hibernate-configuration>
Comment 9 Sergey Petrov 2011-04-25 12:38:42 UTC
*** Bug 194647 has been marked as a duplicate of this bug. ***
Comment 10 Sergey Petrov 2011-11-01 15:38:48 UTC
The issue is reproducible during POJo generation also, and can't be resolved with addition of c3p0-0.9.1.jar. I'm not sure what provider is used by default but classloader used inside of hibernate code (and likely assigned by nb) can't access this class, hope it may be fixed but need more investigation.
Comment 11 Sergey Petrov 2011-11-05 08:39:44 UTC
*** Bug 201897 has been marked as a duplicate of this bug. ***
Comment 12 Sergey Petrov 2012-08-07 14:32:38 UTC
*** Bug 215551 has been marked as a duplicate of this bug. ***
Comment 13 Sergey Petrov 2013-02-26 10:10:17 UTC
*** Bug 226423 has been marked as a duplicate of this bug. ***
Comment 14 gxzero 2013-07-07 23:09:54 UTC
I came across this problem and posted it as a question in stackoverflow. Later then, I managed to solve the problem. It's not a bug, we just missed to add the "mchange-commons*.jar" from the c3p0 lib distribution.


http://stackoverflow.com/questions/17508679/setting-up-hibernatec3p0-in-spring/17517276