Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Custom Reverse Engineering Strategy - ClassNotFoundException
PostPosted: Wed Sep 10, 2008 6:21 pm 
Newbie

Joined: Thu Aug 21, 2008 7:54 pm
Posts: 12
Hibernate version:
Hibernate Tools 3.2.2 Nightly from 9/10/2008
Eclipse Ganymede

Mapping documents:
reveng.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
   <type-mapping>
      <sql-type jdbc-type="TINYINT" hibernate-type="yes_no">
      </sql-type>
   </type-mapping>
   <table-filter match-name=".*"></table-filter>
</hibernate-reverse-engineering>


Full stack trace of any exception that occurs:
Code:
org.hibernate.console.HibernateConsoleRuntimeException: Could not create or find com.mycompany.hibernate.SimpleCustomReverseEngineeringStrategy with one argument delegate constructor
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.loadreverseEngineeringStrategy(CodeGenerationLaunchDelegate.java:358)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.access$0(CodeGenerationLaunchDelegate.java:339)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$2.execute(CodeGenerationLaunchDelegate.java:303)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:93)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.buildConfiguration(CodeGenerationLaunchDelegate.java:283)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:216)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:136)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:764)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:614)
   at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:880)
   at org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.java:966)
   at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.ClassNotFoundException: com.mycompany.hibernate.SimpleCustomReverseEngineeringStrategy
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:481)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:164)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.loadreverseEngineeringStrategy(CodeGenerationLaunchDelegate.java:341)
   ... 12 more
!SUBENTRY 1 org.hibernate.eclipse.console 4 666 2008-09-10 15:02:02.570
!MESSAGE java.lang.ClassNotFoundException: com.mycompany.hibernate.SimpleCustomReverseEngineeringStrategy
!STACK 0
java.lang.ClassNotFoundException: com.mycompany.hibernate.SimpleCustomReverseEngineeringStrategy
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:481)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:164)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.loadreverseEngineeringStrategy(CodeGenerationLaunchDelegate.java:341)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.access$0(CodeGenerationLaunchDelegate.java:339)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$2.execute(CodeGenerationLaunchDelegate.java:303)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:93)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.buildConfiguration(CodeGenerationLaunchDelegate.java:283)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:216)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:136)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:764)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:614)
   at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:880)
   at org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.java:966)
   at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)


Name and version of the database you are using:
MySQl 5.1.26


Custom Class
package com.mycompany.hibernate;

import org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.TableIdentifier;

public class SimpleCustomReverseEngineeringStrategy extends
DelegatingReverseEngineeringStrategy {

public SimpleCustomReverseEngineeringStrategy() {
super(null);
}

public SimpleCustomReverseEngineeringStrategy(ReverseEngineeringStrategy delegate) {
super(delegate);
}

public String columnToPropertyName(TableIdentifier table, String column) {
return super.columnToPropertyName(table, column);
}
}


I'm using the nightly build of Hibernate Tools in Ganymede and can't get it to find my custom reverse engineering class. I have one eclipse project that contains my custom reverse engineering class, the hibernate console configuration, any my other hibernate configuration files (minimal).

I keep getting a dialog with "Could not create or find com.mycompany.hibernate.SimpleCustomReverseEngineeringStrategy with one argument delegate constructor"

Things I've tried
- I've confirmed that the console configuration classpath contains the same classpath as the containing eclipse project. This build/classes/ dir does contain my custom .class file.
- Upgraded to the latest nightly build of Hibernate Tools (was using nightly from 8/22). Started Eclipse with a -clean
- Many other things ;)

Has anyone had any luck getting a Custom Reverse Engineering class to run in Hibernate Tools in Eclipse Ganymede? I'm stumped. Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2008 12:41 pm 
Newbie

Joined: Thu Aug 21, 2008 7:54 pm
Posts: 12
Got it working

I installed a clean copy of Eclipse Ganymede JEE with only the latest nightly build of Hibernate tools from http://download.jboss.org/jbosside/buil ... index.html, and created a fresh workspace / project.

It was apparently something out of wack in my environment.

My environment for anyone else having the same issue:
Again, the following environment IS working for using a custom Reverse Engineering Strategy to generate hbm and JPA Entity Classes
Eclipse Ganymede Version: 3.4.0 Build id: I20080617-2000
Mac OSX - 10.5.4
JDK 1.6.0_05 (also tried 1.5)
HibernateTools-3.2.4.200809110807 (Nightly)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2008 8:11 pm 
Newbie

Joined: Thu Aug 21, 2008 7:54 pm
Posts: 12
The problem appears to be that the Eclipse project doing generation must be set to use JDK 5, not JDK 6. Changing my eclipse project to use jdk 6 reproduces the same problem for me.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 12, 2008 4:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
please report this in jira with steps on how to reproduce (if you could attach a minimal eclipse project that would be good)project

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 19, 2008 12:59 pm 
Newbie

Joined: Thu Aug 21, 2008 7:54 pm
Posts: 12
Done, see http://opensource.atlassian.com/project ... e/HBX-1088

Max, thanks for the responses on all of my postings


Top
 Profile  
 
 Post subject: Re: Custom Reverse Engineering Strategy - ClassNotFoundException
PostPosted: Tue Apr 24, 2012 10:48 am 
Beginner
Beginner

Joined: Thu Jun 30, 2005 4:20 am
Posts: 40
Location: Vienna
In my case, the reason for this error was that the launch configuration for the Hibernate Console Configuration (!not the launch configuration for the Reverse engineering) contained one wrong line. This happened when trying to adjust the classpath.

The wrong line was:
Code:
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;RSSSecurity_IMPL&quot; type=&quot;1&quot;/&gt;&#13;&#10;"/>

which decodes as:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><runtimeClasspathEntry path="3" projectName="RSSSecurity_IMPL" type="1"/>


The corrected line is:
Code:
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;RSSSecurity_IMPL&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>

which decodes as:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"><memento exportedEntriesOnly="false" project="RSSSecurity_IMPL"/></runtimeClasspathEntry>

When you experience this error, I recommend deleting the Hibernate Console Configuration and creating a new one.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 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.