Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Seedless
Post subject: [Closed] Hibernate Reverse Engineering problem, MySQL  PostPosted: Feb 02, 2006 - 03:52 PM
Registered Member
Registered Member


Joined: Feb 01, 2006
Posts: 10

HI folks,

I'm facing that error using an MySQL Database on WinXP for testing purposes. My Errorlog looks as follows:

!ENTRY org.eclipse.core.runtime 4 2 2006-02-01 19:11:32.65
!MESSAGE An internal error occurred during: "Generating Artifacts".
!STACK 0
java.lang.NoClassDefFoundError: com/mysql/jdbc/NonRegisteringDriver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(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 java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:101)
at org.hibernate.console.ConsoleConfiguration.registerFakeDriver(ConsoleConfiguration.java:226)
at org.hibernate.console.ConsoleConfiguration$1.execute(ConsoleConfiguration.java:135)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:112)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:374)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:255)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:67)

Config:

*** Date: Thu Feb 02 15:58:57 CET 2006

*** System properties:
OS=WindowsXP
OS version=5.1
Java version=1.5.0_06

*** MyEclipse details:
MyEclipse Enterprise Workbench

Version: 4.1.0 GA
Build id: 20060122-4.1-GA

*** Eclipse details:
Eclipse Platform

Version: 3.1.0
Build id: I20050513-1415

Eclipse Platform

Version: 3.1.0
Build id: I20050513-1415

Eclipse Java Development Tools

Version: 3.1.0
Build id: I20050513-1415

Eclipse Project SDK

Version: 3.1.0
Build id: I20050513-1415

Eclipse Plug-in Development Environment

Version: 3.1.0
Build id: I20050513-1415

Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-launcher
I:\eclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
b44_4c
-vm
C:\WINDOWS\system32\javaw.exe

Seems theres something wrong with the MySQL database driver. I've just downloaded it from the MySQL website.
 
 View user's profile Send private message  
Reply with quote Back to top
Support-Brian
Post subject:   PostPosted: Feb 02, 2006 - 04:25 PM
Moderator
Moderator


Joined: Aug 21, 2004
Posts: 2339

Seedless,

What version of the MySQL driver are you using -are you able to browse the tables in the DB Browser view?
Is the driver on a local file system?

Do you have a hibernate only project or is this a hibernate + spring project?
In your hibernate configuration file, have you setup the correct driver class, also, is there another version of the MySQL driver JAR in the class path of your project?

In your Database driver setup, and in your hibernate configuration file what is the FQN of the driver class you are using? If not already, can you change it to com.mysql.jdbc.Driver
and see if that works for you?

Best,
Brian.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Seedless
Post subject:   PostPosted: Feb 02, 2006 - 04:58 PM
Registered Member
Registered Member


Joined: Feb 01, 2006
Posts: 10

Such a lot of hints in one post ;) i'll check that as soon as possible.

Regards

Ollie
 
 View user's profile Send private message  
Reply with quote Back to top
Seedless
Post subject:   PostPosted: Feb 03, 2006 - 07:17 PM
Registered Member
Registered Member


Joined: Feb 01, 2006
Posts: 10

I'm using mysql-connector-java-3.1.12-bin.jar its located on a external harddisk, that is connected to the PC ;) I am able to browse the database in the database view. I've tried to create the HIbernat mappings via a right click on the Tables an choosing "create hibernate mappings" or similar.

I've created a new web project right now (+Spring & Hibernate capabilities) and my Hibernate Mapping looks as follows:
Code:
<?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">

<!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration>

    <session-factory>
        <property name="connection.username">root</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/updateserver</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="myeclipse.connection.profile">MySQL</property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
   
    </session-factory>

</hibernate-configuration>


Still receive the following error:

!ENTRY org.eclipse.core.runtime 4 2 2006-02-03 20:15:04.669
!MESSAGE An internal error occurred during: "Generating Artifacts".
!STACK 0
java.lang.NoClassDefFoundError: com/mysql/jdbc/NonRegisteringDriver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(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 java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:101)
at org.hibernate.console.ConsoleConfiguration.registerFakeDriver(ConsoleConfiguration.java:226)
at org.hibernate.console.ConsoleConfiguration$1.execute(ConsoleConfiguration.java:135)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:112)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:374)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:255)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:67)

No further driver classes in the classpath

:(

Ollie
 
 View user's profile Send private message  
Reply with quote Back to top
Support-Brian
Post subject:   PostPosted: Feb 03, 2006 - 07:33 PM
Moderator
Moderator


Joined: Aug 21, 2004
Posts: 2339

Ollie,

Did you change the driver class used by MyEclispe to connect to your datebase? This is external to hibernate and your project, I'm talking about the driver you setup here: Window > Preferences > MyEclipse > Database Explorer > Drivers.
Change your MySQL driver to use com.mysql.jdbc.Driver, I believe it is probably using com.mysql.jdbc.NonRegisteringDriver right now. Reconnect to the database using that driver, does that work for you?

Best,
Brian.

_________________
Brian
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Seedless
Post subject:   PostPosted: Feb 04, 2006 - 11:21 AM
Registered Member
Registered Member


Joined: Feb 01, 2006
Posts: 10

Thanks for your patience.

The database driver setup window loks as follows:

Driver template: Empty (seemingly to load an predefined setup)
Drivername: MySQL Connector/J Driver
Connection URL: jdbc:mysql://<hostname>[<:3306>]/<dbname>
Driver JARs: J:\Development\mysl-connector-java-3.1.12-bin.jar
Java classpath: I:\eclipse\startup.jar
Driver class name: com.mysql.jdbc.Driver

I've tested something, that gives a strange result: I chose "org.gjt.mm.mysql.Driver" as driver class name as somebody suggested here at the forum. When I try to generate the hibernate mappings now the first Line of the Exception stack is:
Code:
java.lang.NoClassDefFoundError: com/mysql/jdbc/Driver

Switching back to the name "com.mysql.jdbc.Driver" leads to
Code:
java.lang.NoClassDefFoundError: com/mysql/jdbc/NonRegisteringDriver

again... really confusing, isn't it?

Regards

Ollie
 
 View user's profile Send private message  
Reply with quote Back to top
Seedless
Post subject:   PostPosted: Feb 04, 2006 - 11:34 AM
Registered Member
Registered Member


Joined: Feb 01, 2006
Posts: 10

Addition:

I've noticed, that when I open the hibernate config file and click the browse button to chose a Driver in the configartion view (tabs below editor), there is no available driver. I have to write com.mysql.jdbc.Driver manually an still it doesnt find any matching entry. Maybe this helps you analyse the problem?

Regards
 
 View user's profile Send private message  
Reply with quote Back to top
support-snpe
Post subject:   PostPosted: Feb 04, 2006 - 02:26 PM
Moderator
Moderator


Joined: Feb 03, 2006
Posts: 1117

Seedless,

you use another driver from anywhere - check driver class and remove any old driver if you have one
I can send you little application for test with simple java project

Peco
 
 View user's profile Send private message  
Reply with quote Back to top
support-snpe
Post subject:   PostPosted: Feb 04, 2006 - 02:49 PM
Moderator
Moderator


Joined: Feb 03, 2006
Posts: 1117

see this thread with little application http://myeclipseide.com/PNphpBB2+file-viewtopic-t-11228.html
 
 View user's profile Send private message  
Reply with quote Back to top
Support-Brian
Post subject:   PostPosted: Feb 04, 2006 - 04:03 PM
Moderator
Moderator


Joined: Aug 21, 2004
Posts: 2339

Ollie,

As snpe points out (details in the thread above), you probably have another driver jar in your classpath that is causing everything to trip.

Another question - was MyEclipse installed in a brand new location or did you install it over an older release (not recommended)? Also are you using a new workspace?
Did you have a MySQL driver already configured in your older workspace?

You do not see any driver with Browse probably becuase you do not have the mysql driver jar files copied to your project. You could remedy this by choosing your connection profile from the drop down and then click "Copy JDBC driver and add to classpath". While this affects your application, it is not necessary for the Reverse engineering to proceed normally.

Best,
Brian.

_________________
Brian
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Seedless
Post subject:   PostPosted: Feb 04, 2006 - 06:05 PM
Registered Member
Registered Member


Joined: Feb 01, 2006
Posts: 10

Hi once more,

I've already tried that sample snippet, brwosing the forum for solutions before. I get an "Connection is fine" :/
When I try to klick that "Copy JDBC Driver and add to classpath" i get a dialogue that there would already be a driver class (which is the one I actually want to copy there) in the classpath an i have to choose wether to keep the existing or overwrite. Both of the options don't change anything according to my problem.

I've installed MyEclipse freshly on my system. No previous version ever.

I've created a new workspace right now, have added an simple Java Project, added Hibernate capabilities, have set up the database driver in Preferences and created a database connection in DBView: once again, I can browse the tables but can not generate Hibernate mappings :( I slowly run out of confidence...

Regards

Ollie
 
 View user's profile Send private message  
Reply with quote Back to top
Support-Brian
Post subject:   PostPosted: Feb 04, 2006 - 06:26 PM
Moderator
Moderator


Joined: Aug 21, 2004
Posts: 2339

Ollie,

I'd just like to verify that your hibernate configuration file isn't causing a mixup with the RE process. Could you try replacing your <hibernate-configuration> element with this?

Code:

<hibernate-configuration>

   <session-factory>
   </session-factory>

</hibernate-configuration>


Save the file and attempt mapping again. Could you also try deleting the mysql driver jars which are in your project? I'm just looking for any JARs which might be on your project's classpath already and are causing a conflict.

Best,
Brian.

_________________
Brian
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Feb 04, 2006 - 07:16 PM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23855

Ollie,
The problem is an installation one, you are not using Eclipse 3.1 final, and at this point we would suggest Eclipse 3.1.2

I would suggest the following:
1) Download Eclipse 3.1.2 SDK from here: http://www.eclipse.org/downloads/ and unzip it to a new location
2) Redownload MyEclipse 4.1 GA and reinstall it against the version of Eclipse you unzipped in #1
3) Create your new Java project and try and walk through your example USING a new workspace.

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-snpe
Post subject:   PostPosted: Feb 04, 2006 - 07:30 PM
Moderator
Moderator


Joined: Feb 03, 2006
Posts: 1117

Quote:
When I try to klick that "Copy JDBC Driver and add to classpath" i get a dialogue that there would already be a driver class (which is the one I actually want to copy there) in the classpath an i have to choose wether to keep the existing or overwrite. Both of the options don't change anything according to my problem.


it is sure that you have wrong driver - try make new myeclipse driver (configure driver and then add data without using template)
 
 View user's profile Send private message  
Reply with quote Back to top
Seedless
Post subject:   PostPosted: Feb 07, 2006 - 07:18 PM
Registered Member
Registered Member


Joined: Feb 01, 2006
Posts: 10

Just got my Notebook back from repairing. Freshly installed - everything is fine now. One more time, thanks a lot for your patience. I'm gonna get the full version as soon as possible.

Regards

Ollie
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits