searchforsolutions

Just another WordPress.com site

Hibernate Tools refuses to auto generate code in Eclipse


After debugging the plugin and observing the logs it seems there is some classloader issue for the tools plugin due to which the logger libs are creating an issue with code generation.

You would get the follwoing stacktrace in the eclipse logs

!MESSAGE An internal error occurred during: "Fetching children of Database".
!STACK 0
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)
	at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
	at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:550)
	at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:74)

To workaround this issue there are 2 ways.

For maven based projects comment out the logger libs reference or if its a well organised maven project remove reference to the parent

Trigger the generation it would generate the code.

If its a normal java project remove the references tot the loggers temporarily and triger generation.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: