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.
Hello Using Hibernate Support plugin (token from plugin center), when importing some tables I get this: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.JDBCMetaDataConfiguration at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.generateClasses(HibernateRevengWizard.java:315) at org.netbeans.modules.hibernate.wizards.HibernateRevengWizard.instantiate(HibernateRevengWizard.java:459) at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1016) at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:588) at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:409) at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:253) at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:165) at org.openide.WizardDescriptor.callInstantiateOpen(Unknown Source) at org.openide.WizardDescriptor.callInstantiate(Unknown Source) at org.openide.WizardDescriptor.access$1700(Unknown Source) at org.openide.WizardDescriptor$Listener$2$1.run(Unknown Source) at org.openide.util.RequestProcessor$Task.run(Unknown Source) [catch] at org.openide.util.RequestProcessor$Processor.run(Unknown Source) It seem to be that the hibernate-tools.jar don't contain the class org.hibernate.cfg.JDBCMetaDataConfiguration (and it is so). I think the hibernate-tools.jar but be downgraded to a previous version that has this class. Best regards Michele Renda
I can add that this problem seem to happen when using a firebird database, with jaybird 2.1.6
*** Issue 168147 has been marked as a duplicate of this issue. ***
as I got it it's comparability with new hibernate jars issue. we really need to update our module to support newer one at some point, but unfortunately not this time.
Thank you :)
After digging into the code of Netbeans and adding extra logging to Jaybird, I found that the problem is that Netbeans loads the driver with a custom classloader that doesn't return resources in /META-INF/services. Jaybird (the Firebird JDBC driver) uses plugins for its protocol implementation (eg the Type 4 implementation, Type 2 native, Type 2 embedded). These are listed in a file in /META-INF/services/ (specifically /META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin), and are loaded with a mechanism similar to java.util.ServiceLoader. This also allows third-parties to add protocol implementations. For example as a workaround, or for special needs; I know a company used this mechanism to provide a driver that could translate Oracle syntax to Firebird. The change were a Netbeans classloader ignores the existence of all files in /META-INF/services was added in: http://hg.netbeans.org/main-silver?cmd=changeset;node=c8413dd446c2 in response to bug: https://netbeans.org/bugzilla/show_bug.cgi?id=194915 I have added a workaround in Jaybird, but I think it is a bug in Netbeans that it purposefully refuses to load files that may be required by a Java library. See also: http://tracker.firebirdsql.org/browse/JDBC-325 http://stackoverflow.com/a/18920383/466862 http://stackoverflow.com/questions/18921352/using-meta-inf-services-for-internal-plumbing-of-driver
When investigating this, I noticed that when going through the wizard, *two* database connections are made: one by org.netbeans.modules.hibernate.util.HibernateUtil that succeeds but isn't used, and another by org.netbeans.modules.hibernate.util.CustomJDBCConnectionProvider which fails because of the classloading issue described in my previous comment.
I see initial report is from 2009, whn mentioned fix was pushed in 2011, and latest comments may be completly new also, why it's added to this issue? regarding 2011 fix, may be I need just to catch cnf in case of "services" folder instead of return null without "try"
Sergey, you are right. I had misread this issue. I will create a new issue.
I created issue: https://netbeans.org/bugzilla/show_bug.cgi?id=237922
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss