facebook

[Closed] Hibernate failing with commons-logging error

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #241224 Reply

    Hi All,

    Went back to square one and tried to get the basic Hibernate demo working as per the instructions in the MyEclipse help.
    I am using MSSQL rather than MySQL as I need to get that to work. Anyway, at about 11:30 last night it seemed to be working. Writing stuff to my tables tc and all OK. Closed everything and tried it again today and it is all screwed. 😡

    I am very suspicious about the .myhibernatedata properties as these keep reverting to blank settings.
    I’ve tried to set them manually to: –

    
    configFile=/HibernateDemo/src/hibernate.cfg.xml
    libInstallFolder=/lib
    addLibs2Classpath=true
    addLibs2Project=true
    createConfigFile=true
    keyGenerator=
    version=3.0
    basePersistenceClass=
    useJavaTypes=false
    

    My error log reports: –

    
    !SESSION 2005-11-10 12:11:23.575 -----------------------------------------------
    eclipse.buildId=M20050929-0840
    java.version=1.5.0_04
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
    Command-line arguments:  -os win32 -ws win32 -arch x86
    
    !ENTRY com.genuitec.eclipse.hibernate 4 4 2005-11-10 12:11:27.829
    !MESSAGE Error - unable to loadhibernate project metadatanull
    !STACK 0
    java.lang.ExceptionInInitializerError
        at com.genuitec.eclipse.hibernate.core.HibernateProject.basicLoadProperties(HibernateProject.java:366)
        at com.genuitec.eclipse.hibernate.core.HibernateProject.loadPropertiesIfNeeded(HibernateProject.java:350)
        at com.genuitec.eclipse.hibernate.core.HibernateProject.getVersion(HibernateProject.java:158)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigProvider.<init>(HibernateConfigProvider.java:117)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigFormPage.createPartControl(HibernateConfigFormPage.java:188)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor.createConfigurationFormPage(HibernateConfigXMLEditor.java:62)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor.createPages(HibernateConfigXMLEditor.java:35)
        at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:241)
        at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:609)
        at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:384)
        at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
        at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java:258)
        at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java:1221)
        at org.eclipse.ui.internal.EditorManager$5.run(EditorManager.java:949)
        at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
        at org.eclipse.core.runtime.Platform.run(Platform.java:783)
        at org.eclipse.ui.internal.EditorManager.restoreState(EditorManager.java:944)
        at org.eclipse.ui.internal.WorkbenchPage.restoreState(WorkbenchPage.java:2576)
        at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1819)
        at org.eclipse.ui.internal.Workbench.doRestoreState(Workbench.java:2566)
        at org.eclipse.ui.internal.Workbench.access$14(Workbench.java:2515)
        at org.eclipse.ui.internal.Workbench$19.run(Workbench.java:1514)
        at org.eclipse.ui.internal.Workbench$16.run(Workbench.java:1263)
        at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:346)
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:291)
        at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:447)
        at org.eclipse.ui.internal.Workbench.runStartupWithProgress(Workbench.java:1258)
        at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1512)
        at org.eclipse.ui.internal.Workbench.access$12(Workbench.java:1491)
        at org.eclipse.ui.internal.Workbench$17.run(Workbench.java:1374)
        at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
        at org.eclipse.core.runtime.Platform.run(Platform.java:783)
        at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1318)
        at org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:183)
        at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:700)
        at org.eclipse.ui.internal.Workbench.init(Workbench.java:1034)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1636)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
        at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
        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.core.launcher.Main.invokeFramework(Main.java:334)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
        at org.eclipse.core.launcher.Main.run(Main.java:973)
        at org.eclipse.core.launcher.Main.main(Main.java:948)
    
    

    Someone else seems to have reported a similar problem but no reply as far as I can find.

    Can someone please help as I’m getting soooooo frustrated.

    My config is: –

    
    *** Date: Thu Nov 10 12:25:23 CET 2005
    
    *** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.5.0_04
    
    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    
    Version: 4.0.3 GA
    Build id: 20051025-4.0.3-GA
    
    *** Eclipse details:
    Eclipse SDK
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Platform
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse RCP
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Java Development Tools
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Plug-in Development Environment
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Project SDK
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\Program Files\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    1864_68
    -vm
    C:\Program Files\Java\jre1.5.0_04\bin\javaw.exe
    

    Cheers and TIA

    Richard

    #241234 Reply

    Riyad Kalla
    Member

    Something is definately ammiss here if the settings are blanking out… is your workspace on a network drive or anything fancy like that? You running any realtime protection of sorts, like Anti Virus, Spyware, etc?

    #241243 Reply

    Hi rkalla. Well, I’ve fixed some of the problems. I had to manually change the DTD definition to be version 3 instead of 2 which stopped the programs failing. It all comes back to the same issue ith the .myhibernate file I suspect.
    Do you have any examples that work with MSSQL that I can have a look at?

    In answer to your question I am running anti virus, anti spywaye and also Zonealarm. Should I switch any / all of them off. BTW – eveything else seems to be OK, just the hibernate files?!?

    #241244 Reply

    I’ve tried switching everything off and it still fails.

    I get the following log message

    
    !SESSION 2005-11-10 16:02:39.496 -----------------------------------------------
    eclipse.buildId=M20050929-0840
    java.version=1.5.0_04
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
    Command-line arguments:  -os win32 -ws win32 -arch x86
    
    !ENTRY com.genuitec.eclipse.hibernate 4 4 2005-11-10 16:02:43.622
    !MESSAGE Error - unable to loadhibernate project metadatanull
    !STACK 0
    java.lang.ExceptionInInitializerError
        at com.genuitec.eclipse.hibernate.core.HibernateProject.basicLoadProperties(HibernateProject.java:366)
        at com.genuitec.eclipse.hibernate.core.HibernateProject.loadPropertiesIfNeeded(HibernateProject.java:350)
        at com.genuitec.eclipse.hibernate.core.HibernateProject.getVersion(HibernateProject.java:158)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigProvider.<init>(HibernateConfigProvider.java:117)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigFormPage.createPartControl(HibernateConfigFormPage.java:188)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor.createConfigurationFormPage(HibernateConfigXMLEditor.java:62)
        at com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor.createPages(HibernateConfigXMLEditor.java:35)
        at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:241)
        at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:609)
        at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:384)
        at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
        at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java:258)
        at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java:1221)
        at org.eclipse.ui.internal.EditorManager$5.run(EditorManager.java:949)
        at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
        at org.eclipse.core.runtime.Platform.run(Platform.java:783)
        at org.eclipse.ui.internal.EditorManager.restoreState(EditorManager.java:944)
        at org.eclipse.ui.internal.WorkbenchPage.restoreState(WorkbenchPage.java:2576)
        at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1819)
        at org.eclipse.ui.internal.Workbench.doRestoreState(Workbench.java:2566)
        at org.eclipse.ui.internal.Workbench.access$14(Workbench.java:2515)
        at org.eclipse.ui.internal.Workbench$19.run(Workbench.java:1514)
        at org.eclipse.ui.internal.Workbench$16.run(Workbench.java:1263)
        at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:346)
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:291)
        at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:447)
        at org.eclipse.ui.internal.Workbench.runStartupWithProgress(Workbench.java:1258)
        at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1512)
        at org.eclipse.ui.internal.Workbench.access$12(Workbench.java:1491)
        at org.eclipse.ui.internal.Workbench$17.run(Workbench.java:1374)
        at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
        at org.eclipse.core.runtime.Platform.run(Platform.java:783)
        at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1318)
        at org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:183)
        at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:700)
        at org.eclipse.ui.internal.Workbench.init(Workbench.java:1034)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1636)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
        at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
        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.core.launcher.Main.invokeFramework(Main.java:334)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
        at org.eclipse.core.launcher.Main.run(Main.java:973)
        at org.eclipse.core.launcher.Main.main(Main.java:948)
    Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1cefde4 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1cefde4 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
        at org.apache.commons.beanutils.BeanUtils.<clinit>(BeanUtils.java:111)
        ... 51 more
    Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1cefde4 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        ... 55 more
    Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getConstructor0(Unknown Source)
        at java.lang.Class.getConstructor(Unknown Source)
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
        ... 56 more
    

    Just to confirm – .myhibernate settings are

    
    configFile=/HibernateDemo/src/hibernate.cfg.xml
    libInstallFolder=/lib
    addLibs2Classpath=true
    addLibs2Project=true
    createConfigFile=true
    keyGenerator=identity
    version=3.0
    basePersistenceClass=
    useJavaTypes=false
    

    I’ve tried several times to load from scratch.Also started project anew. Uninstalled and re-installed myeclipse workbench.

    If I can get a version of .myhibernate that works and the system recognises then all wil, I’m sure, be fine. Very strange and frustrating.

    I think I’ll have a go with a MySQL version to see what happens.

    #241252 Reply

    Riyad Kalla
    Member

    Wait that exception is comapling about something else here, the plugin is not able to initialize it’s logger. Do you have any custom logging files in your JDK’s ext or JRE’s /ext directory? From the exception it looks like saying Hibernate i sbroken and trying to create new projects is just a red herring, let’s figure out why you are getting exceptions from the commons-logging constructor first.

    #241285 Reply

    😳

    Dear rkalla, thank you so much. I’d put a log4j into the /ext while doing some struts testing and Tomcat stuff.
    With regard to the log4j stuff is there a ‘correct’ way to incorporate it into a project, as the option to change debug / warn / error flags is very nice and can be very useful?

    With regard to the original problem I can’t believe I’ve wasted so many hours chasing a ghost. Thanks very much for your pointers though. Couldn’t see the wood for the trees myself.

    Anyway, all that not withstanding, am very pleased with the support and the product so far and will, I’m sure, get better and more used to all this stuff.

    Thanks again.

    #241303 Reply

    Riyad Kalla
    Member

    With regard to the log4j stuff is there a ‘correct’ way to incorporate it into a project, as the option to change debug / warn / error flags is very nice and can be very useful?

    This is a good question, what I try and do is keep any libraries (logging, drivers, etc.) in the smallest visible context possible that I need them. So for example, if your webapp needs Log4J, I would include it in your WEB-INF/lib dir, that way when tomcat loads your project, the version of Log4j you are using for your project is protected from the version that say Tomcat might be using because it would be contained within the scope of a specific ClassLoader just for your webapp.

    Whenever you install something system wide (in the /ext dir) you alsmost always run into problems down the road. The only times I’ve seen it necessary is when you need a DLL available to your Java environment or something like that.

    Anyway, all that not withstanding, am very pleased with the support and the product so far and will, I’m sure, get better and more used to all this stuff.

    Thank you very much, I’m glad we got this figured out for you.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: [Closed] Hibernate failing with commons-logging error

You must be logged in to post in the forum log in