- This topic has 3 replies, 2 voices, and was last updated 18 years, 10 months ago by Peter Darton.
-
AuthorPosts
-
Peter DartonMemberSummary: Problem loading hibernate.cfg.xml file that wasn’t created using MyEclipse
Details:
Prior to obtaining MyEclipse, I’ve been using Hibernate 3.1 and Hibernate tools 3.1.0beta4 to reverse-engineer POJOs etc for my database.
I’m aware that MyEclipse & Hibernate tools don’t get on (“DLL-hell” issues – see http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-11030.html), so I installed a clean Eclipse 3.1.1 and then MyEclipse 4.1.0 GA.
I then attempted to open my file activityDb_hibernate.cfg.xml, and got the error:Unable to create this part due to an internal error. Reason for the failure: An unexpected exception was thrown.
This was shown in the area I’d expect to see the XML file contents. Pressing “details” showed the same exception as shown in the error log, quoted below.
Whilst I can understand MyEclipse might not be able use a fancy wizard/GUI/whatever on files it doesn’t understand, I think that preventing the user from editing (even viewing!) those files using the standard editor is a pretty poor show.
The file I attempted to open (by double-clicking on it from the Java perspective) contains the following:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <!-- $RCSfile: activityDb_hibernate.cfg.xml,v $ $Author: peterd $ $Date: 2006/01/24 12:31:16 $ $Revision: 1.1 $ Copyright (C) Intrinsica Networks Limited 2006 --> <hibernate-configuration> <session-factory> <property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <property name="hibernate.cglib.use_reflection_optimizer">true</property> <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property> <property name="hibernate.connection.password">noThisIsntTheRealPassword</property> <property name="hibernate.connection.pool_size">1</property> <property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost/actservSQL</property> <property name="hibernate.connection.username">ThisIsntTheRealUsernameEither</property> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.default_catalog">actservSQL</property> <property name="hibernate.default_schema">dbo</property> <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property> <property name="hibernate.show_sql">true</property> </session-factory> </hibernate-configuration>
Configuration summary is:
*** Date: Wed Feb 15 11:14:42 GMT 2006
*** System properties:
OS=WindowsXP
OS version=5.1
Java version=1.5.0_04*** MyEclipse details:
MyEclipse Enterprise WorkbenchVersion: 4.1.0 GA
Build id: 20060122-4.1-GA*** Eclipse details:
Eclipse SDKVersion: 3.1.1
Build id: M20050929-0840Eclipse Platform
Version: 3.1.1
Build id: M20050929-0840Eclipse RCP
Version: 3.1.1
Build id: M20050929-0840Eclipse Java Development Tools
Version: 3.1.1
Build id: M20050929-0840Eclipse Plug-in Development Environment
Version: 3.1.1
Build id: M20050929-0840Eclipse Project SDK
Version: 3.1.1
Build id: M20050929-0840Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-launcher
D:\Apps\Eclipse-3.1.1_withMyEclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
42c_2c
-vm
C:\Program Files\Java\jdk1.5.0_04\bin\javaw.exeThe error log shows the following:
!SESSION 2006-02-15 11:17:33.196 ———————————————–
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 org.eclipse.ui 4 0 2006-02-15 11:17:49.338
!MESSAGE Unable to create editor ID com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor: An unexpected exception was thrown.
!STACK 0
java.lang.NullPointerException
at com.genuitec.eclipse.hibernate.util.HibernateUtils.isHibernate3Project(HibernateUtils.java:316)
at com.genuitec.eclipse.hibernate.util.HibernateUtils.isHibernate3Project(HibernateUtils.java:312)
at com.genuitec.eclipse.hibernate.ui.DriverDetailsPage.createDialectEntry(DriverDetailsPage.java:241)
at com.genuitec.eclipse.hibernate.ui.DriverDetailsPage.createContents(DriverDetailsPage.java:99)
at com.genuitec.eclipse.hibernate.ui.HibernateDetailsPart$1.run(HibernateDetailsPart.java:271)at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at com.genuitec.eclipse.hibernate.ui.HibernateDetailsPart.showPage(HibernateDetailsPart.java:267)
at com.genuitec.eclipse.hibernate.ui.HibernateDetailsPart.update(HibernateDetailsPart.java:240)
at com.genuitec.eclipse.hibernate.ui.HibernateDetailsPart.selectionChanged(HibernateDetailsPart.java:225)
at org.eclipse.ui.forms.ManagedForm.fireSelectionChanged(ManagedForm.java:127)
at com.genuitec.eclipse.hibernate.ui.ConnectionDetailsPart.changeDetailsPage(ConnectionDetailsPart.java:183)
at com.genuitec.eclipse.hibernate.ui.ConnectionDetailsPart.toggleConnectionDetails(ConnectionDetailsPart.java:177)
at com.genuitec.eclipse.hibernate.ui.ConnectionDetailsPart.update(ConnectionDetailsPart.java:169)
at com.genuitec.eclipse.hibernate.ui.HibernateSectionPart.setFormInput(HibernateSectionPart.java:54)
at org.eclipse.ui.forms.ManagedForm.setInput(ManagedForm.java:214)
at com.genuitec.eclipse.hibernate.editors.HibernateConfigFormPage.inputChanged(HibernateConfigFormPage.java:367)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:248)
at com.genuitec.eclipse.hibernate.editors.HibernateConfigFormPage.setModel(HibernateConfigFormPage.java:295)
at com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor.connectDesignPage(HibernateConfigXMLEditor.java:85)
at com.ibm.xmleditor.internal.XMLMultiPageEditorPart.createPages(XMLMultiPageEditorPart.java:219)
at com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor.createPages(HibernateConfigXMLEditor.java:44)
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.PartPane.setVisible(PartPane.java:283)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:126)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:391)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1102)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1051)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:442)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:109)
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:60)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:212)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:202)
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:758)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:665)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:628)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2360)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2295)
at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:2287)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2273)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2268)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2249)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:371)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:334)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:251)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:131)
at org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(OpenActionUtil.java:49)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:169)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:153)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:222)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:198)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:296)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:869)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:741)
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.JFaceUtil$1.run(JFaceUtil.java:44)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:148)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:739)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:968)
at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1067)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:243)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:238)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:277)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
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(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
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)(Message edited about 30mins after initial posting to cross-link to another post that details the “DLL hell” issues)
Riyad KallaMemberWe had someone (maybe it was you?) email the exact same error to our support@ address, I tried their example file and was never able to reproduce the problem. I now just tried your example file as well and am still unable to reproduce the problem.
Can you do me a favor and do the following:
1) Create a new project (Java or Web)
2) Add hibernate capabilities to it
3) Go open the hibernate.cfg.xml file that was created and copy-paste the contents you gave above into the file and save it, close it and reopen it?If that doesn’t work, please do this first: File > Switch Workspace > C:\tempworkspace > Hit “OK”, now try the steps above again. Did that work?
Riyad KallaMemberAhhh, the reason for this is even simpler. You are trying to open the hibernate.cfg.xml file *using* the “MyEclipse Hibernate Configuration Editor” in a non-Hibernate project. If you want to continue doing this, right click on the file go to Open With, then select MyEclipse XML Editor, otherwise add Hibernate Capabilities to your project.
Peter DartonMemberAppologies for not getting back to you earlier on this. No, it wasn’t me emailing support@ (must have been someone else), I only posted here (unless MyEclipse has some automated bug reporting facility I’m unaware of).
I’ve upgraded to MyEclipse 4.1.1 GA and the bug has been fixed.As for “trying to open the hibernate.cfg.xml file *using* the MyEclipse editor”, whilst I can understand that such an action was doomed to failure, I can assure you that it was through no deliberate decision of my own – I just double-clicked on the file, just as I’d done previously (before installing MyEclipse) without problems.
The problem was that MyEclipse installed itself as a handler for ALL files ending .cfg.xml but then failed to handle ALL of them.
But the new MyEclipse doesn’t suffer from this problem (it just moans that it can’t understand the file before letting you edit it anyway – which is good enough for me)Oh, and this was all without “adding hibernate capabilities” – we’re not using MyEclipse’s hibernate functionality on this project (hence the presence of a hibernate.cfg.xml that wasn’t one that MyEclipse wrote). This might explain why you had difficulty reproducing the issue, given your suggested step (2) in your initial response.
-
AuthorPosts