Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: hibernate 3.6 and eclipse support isues
PostPosted: Fri May 18, 2012 5:58 pm 
Newbie

Joined: Fri May 18, 2012 5:04 pm
Posts: 4
I have been working on a project to add support for jasypt types on hibernate tools.

The idea was to define a parametrized type in a mapping file and use the name to override the type used for certain columns in the reverse engeniering definition xml
and from there generate hbm, and java classes

However the current version of the tools project is using hibernate 3.5 and it takes literally the type name in the reverse enginierring file and use it as the type in java classes

I want hibernate tools to read my typedef and the parameters from a mapping file specified in a cfg.xml, use the reverse engeniering xml to override the type for a certain column, and use the defined type in the exporters as if it was a native hibernate type.

I know I could generate the file mapping and modify it adding a meta attribute to override the type in the generated java classes.
However my goal is to modify the eclipse plugins to support this feature and do it in the most simple way using a wizard to indicate the parameters for the type defs and the columns to override.

I managed to get a version of the tools working with hibernate 3.6 wich would allow me to use the type registry introduced in that version.
However the biggest problem I have is to make it work with the eclipse plugins, got the trunk and a multiversion2 branch from svn
I changed some files that were using features from 3.5 to use the new registry from 3.6, I also changed the lib project to use version 3.6 and its dependencies

Everything compiles from console and from eclipse but the test for the console configuration fails with a class def not foud exception for the logger library
If I run it on eclipse it launches but as soon as I try to do somenthing involving a hibernate configuration I get the same error as in the test.

This is a fragment of the output from the test?

What am I doing wrong? should I be using other branch?

Code:
Tests run: 44, Failures: 6, Errors: 9, Skipped: 0, Time elapsed: 25.267 sec <<< FAILURE!
testBuildConfiguration(org.hibernate.eclipse.console.test.ConsoleConfigurationTest)  Time elapsed: 0.043 sec  <<< ERROR!
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
   at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:197)
   at org.hibernate.console.ConfigurationFactory.buildConfiguration(ConfigurationFactory.java:183)
   at org.hibernate.console.ConfigurationFactory.createConfiguration(ConfigurationFactory.java:96)
   at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:240)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:237)
   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:188)
   at org.hibernate.eclipse.console.test.ConsoleConfigurationTest.testBuildConfiguration(ConsoleConfigurationTest.java:81)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at junit.framework.TestCase.runTest(TestCase.java:168)
   at junit.framework.TestCase.runBare(TestCase.java:134)
   at junit.framework.TestResult$1.protect(TestResult.java:110)
   at junit.framework.TestResult.runProtected(TestResult.java:128)
   at junit.framework.TestResult.run(TestResult.java:113)
   at junit.framework.TestCase.run(TestCase.java:124)
   at junit.framework.TestSuite.runTest(TestSuite.java:243)
   at junit.framework.TestSuite.run(TestSuite.java:238)
   at junit.framework.TestSuite.runTest(TestSuite.java:243)
   at junit.framework.TestSuite.run(TestSuite.java:238)
   at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
   at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
   at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
   at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
   at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
   at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:72)
   at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
   at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
   at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
   at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
   at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
   at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:31)
   at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:114)
   at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:37)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
   at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 58 more

testHQLComments(org.hibernate.eclipse.console.test.ConsoleConfigurationTest)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.Configuration
   at org.hibernate.console.ConfigurationFactory.buildConfiguration(ConfigurationFactory.java:183)
   at org.hibernate.console.ConfigurationFactory.createConfiguration(ConfigurationFactory.java:96)
   at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:240)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:237)
   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:188)
   at org.hibernate.eclipse.console.test.ConsoleConfigurationTest.testHQLComments(ConsoleConfigurationTest.java:105)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Top
 Profile  
 
 Post subject: Re: hibernate 3.6 and eclipse support isues
PostPosted: Mon May 21, 2012 4:59 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
For some reason, it's not finding class org.slf4j.LoggerFactory.
The usual cause is that the SLF4J libraries are not on the class path.
I guess you're running Hibernate Tools just fine. If that's the case, the libraries are already present somewhere. (I know nothing about plugin development, so I don't know how to verify the class path, or where the plugins install their jars and how to include them in a class path.)


Top
 Profile  
 
 Post subject: Re: hibernate 3.6 and eclipse support isues
PostPosted: Mon May 21, 2012 6:07 am 
Newbie

Joined: Fri May 18, 2012 5:04 pm
Posts: 4
Thanks for the reply!
I found the problem, apparently hibernate tools is using apache commons loggin and the eclipse pluggins were using log4j
there was a problem trying to use slf4j with both, so I removed all the references to commons loggin in tools source and replaced them with slf4j
Now I have Hibernate tools with support for 3.6 and the eclipse plugins both of them playing nice together :D
I have a branch on github where I'm incorporation all this changes https://github.com/fulano2040/hibernate-tools


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.