facebook

HQL editor error

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

    If I try to open a HQL editor with MyEclipse5.01 I get an exception:
    java.lang.NullPointerException
    at org.eclipse.core.runtime.Path.<init>(Path.java:152)
    at com.genuitec.eclipse.hibernate.util.HibernateUtils.getConfigFile(HibernateUtils.java:321)
    at com.genuitec.eclipse.hibernate.util.HTUtils.getConsoleConfigurationPreferences(HTUtils.java:173)
    at com.genuitec.eclipse.hibernate.util.HTUtils.getConsoleConfigurationPreferences(HTUtils.java:136)
    at com.genuitec.eclipse.hibernate.util.HTUtils.getConsoleConfiguration(HTUtils.java:128)
    at com.genuitec.eclipse.hibernate.util.HTUtils.getConsoleConfiguration(HTUtils.java:109)
    at com.genuitec.eclipse.hibernate.util.ConsoleConfigurationRepository.createFromHibernateProject(ConsoleConfigurationRepository.java:52)
    at com.genuitec.eclipse.hibernate.util.ConsoleConfigurationRepository.find(ConsoleConfigurationRepository.java:39)
    at com.genuitec.eclipse.hibernate.util.ConsoleConfigurationRepository.getHibernateConfigsFromWorkspace(ConsoleConfigurationRepository.java:81)
    at com.genuitec.eclipse.hibernate.util.ConsoleConfigurationRepository.getConfigurations(ConsoleConfigurationRepository.java:59)
    at org.hibernate.console.KnownConfigurations.getConfigurations(KnownConfigurations.java:178)
    at com.genuitec.eclipse.hibernate.editors.MEHQLEditor.createSourceViewer(MEHQLEditor.java:76)
    at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:2549)
    at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:53)
    at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:367)
    at org.hibernate.eclipse.hqleditor.HQLEditor.createPartControl(HQLEditor.java:113)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:372)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
    at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:290)
    ….

    Here is my .myhibernatedata for that project:
    #
    #Tue Aug 15 15:09:52 CEST 2006
    genBasicCompId=false
    sessionFactoryName=
    profile=
    daoSFId=
    version=3.0
    jndiPath=
    springDaoFile=
    useJavaTypes=true
    keyGenerator=
    libInstallFolder=
    addLibs2Project=false
    genVersionTag=false
    sessionFactoryId=
    basePersistenceClass=
    reSettingsFile=
    configFile=/ISP-TEST/test/hibernate-test.cfg.xml
    createConfigFile=false
    addLibs2Classpath=false
    baseDaoClass=

    Thanks in advance.

    #256805 Reply

    Haris Peco
    Member

    Rodge,

    Have you other hibernate projects in workspace.MyEclipse load all hibernate project description in hql combo and
    if you have other invalid project it can be problem.
    Please, can you close other projects (if you have some one) and try again

    Thanks
    Peco

    #256806 Reply

    I have plenty of other hibernate projects, each having several hibernate.cfg.xml files for different configurations. The one, which I tried to open a HQL editor for, depends on the other projects, so they cannot be closed.

    More, most of the mapped classes are located in these other projects.

    What exactly does MyEclipse IDE when opening a HQL editor? I thought throu specifying the hibernate.cfg.xml it would use that one…

    #256807 Reply

    Haris Peco
    Member

    Rodge,

    You have combo with project name and you choose project configuration for hql – all hibernate projects are in this combo and MyEclipse check all your project for showing in this combo
    I suppose that one your project have invalid setting, but I can’t reproduce your case – try check if some your hibernate project have invalid data in .myhibernatedata – you can check this with right click on project and call MyEclipse-Hibernate preferences

    Best
    Peco

    #256810 Reply

    Brian Fernandes
    Moderator

    Rodge,

    How are you opening the HQL file – do you open an existing .hql file or do you use the MyEclipse > Open HQL Editor context menu option (available on the context menu of a Hibernate project).
    Since you mentioned multiple projects, do you have your hibernate configuration files distributed among several projects or does one project contain all the hibernate files (CFG, HBM, POJOs) – is are they all in the ISP-TEST project?

    Does the file /ISP-TEST/test/hibernate-test.cfg.xml exist? If you’re double clicking a .hql file (to open the HQL editor), is this file in the ISP-TEST project?

    Can you try the HQL editor with a dummy project and see if it works for you? Just create a new hibernate project, map a table or two and see if the HQL editor works.

    We can’t reproduce this locally, so would appreciate your assitance in tracking this down.
    Best,
    Brian.

    #256811 Reply

    Peco,

    sorry, but neither can I see that combo box, nor any MyEclipse-specific project list.
    Inside the project properties dialog, there is a section MyEclipse->Hibernate, where I can choose the Active Configuration File, but no other projects. Do you mean the section Project References inside the Project Properties?

    #256813 Reply

    Brian Fernandes
    Moderator

    Rodge,

    Sending you an additional note in case you missed the notification for my questions / suggestions above. You will not see the combo unless the HQL editor opens – I’m not sure if it opens after you see the exception above, so we’ve got to get that working first.
    We are talking about MyEclipse -> Hibernate where you can choose the active configuration file – not the project references page. More questions in my previous post.

    Best,
    Brian.

    #256814 Reply

    Haris Peco
    Member

    Rodge,

    Sorry, for unclear message – combo is in hql editor (no in properties).You check properties for invalid project MyEclipse will tell you if project is invalid.Problem is probably in other project.I am not sure, because I can’t reproduce

    .. and, if you can, try open some hql in simple indepedent hibernate project

    Thanks
    Peco

    #256820 Reply

    Peco,

    thanks for the additional note. Yes, indeed, the HQL Editor didnt show up after the exception…

    I closed all projects and then opened one by one, trying to open the HQL editor for each individually. Most of them worked as expected. One of them is referencing a hibernate-mapping file from one of its dependend projects which results in “Error creating configuration (Resource: xxx.hbm.xml not found). It looks like the classpath of dependend projects is not evaluated at all…

    In fact, the one project, I wish to use the HQL editor for, is a special project with the sole purpose to merge all the others classpath in order to run unit tests. It does not define any additional mapped classes. Any ideas that could help?

    Another problem: One of the small projects gave an error “Could not create session factory” but without any reason. Is there a logfile or any other way to find out why this happens?

    Thank you
    Rodge

    #256829 Reply

    Brian Fernandes
    Moderator

    Rodge,

    Unfortunately at this time, the HQL editor will not work across projects. All classes and files required for Hibernate must reside in a single project. If your project’s “Active Hibernate file” refers to a file in another project, this might cause the NPE you’ve been seeing.
    This has been the first case in which a user has required multi-project support, I’ll take it up with the Hibernate team.

    As regards the “Could not create session factory” message, there usually is a note displayed along with the message – failing that you should see the exception logged in the Error Log view with a more detailed stack trace. Make sure you hit the “refresh” button in the HQL editor if you make any changes to related files, that causes the project’s Hibernate context to be re-read (and the exception to be re-logged if there is an error).

    Best,
    Brian.

    #256880 Reply

    Thanks for the info.

    Another question is: Where does MyEclipse store the list of projects with hibernate support? In fact, before I opened the last big project, the other ones worked. But after closing that project, I still get the exception.

    #256885 Reply

    Brian Fernandes
    Moderator

    Rodge,

    There is no physical “list”, but basically all projects which have the Hibernate nature added to them are Hibernate capable. A simple check would be to see which projects have a .myhibernatedata file in the project root.

    What error are you talking about now – the “Session factory could not be created” or the NPE? I reiterate that if you’re opening a HQL file in a project which specifies a hibernate config file which is in another project, it won’t work right now.

    Best,
    Brian.

    #257514 Reply

    kgwhitaker
    Member

    I am having a similar problem. Exact same stack trace. This is when I am attempting to open up the HQL editor via the project context menu.

    When going in to the project properties, I am getting the following eclipse error:

    “Problems occurred when invoking code from plug0in “org.eclipse.jface”

    Looking at the eclipse error log, here’s the stack trace:

    java.lang.IllegalArgumentException: Argument cannot be null
    at org.eclipse.swt.SWT.error(SWT.java:3358)
    at org.eclipse.swt.SWT.error(SWT.java:3297)
    at org.eclipse.swt.SWT.error(SWT.java:3268)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:435)
    at org.eclipse.swt.widgets.Label.setText(Label.java:366)
    at com.genuitec.eclipse.hibernate.core.HibernateProjectPropertiesPage.createContents(HibernateProjectPropertiesPage.java:86)
    at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233)
    at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1403)
    at org.eclipse.jface.preference.PreferenceDialog$12.run(PreferenceDialog.java:1162)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
    at org.eclipse.core.runtime.Platform.run(Platform.java:843)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
    at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1156)
    at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showPage(FilteredPreferenceDialog.java:439)
    at org.eclipse.jface.preference.PreferenceDialog$8.selectionChanged(PreferenceDialog.java:661)
    at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:839)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
    at org.eclipse.core.runtime.Platform.run(Platform.java:843)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
    at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:837)
    at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1143)
    at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1163)
    at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:236)
    at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:230)
    at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:404)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
    at org.eclipse.jface.window.Window.open(Window.java:796)
    at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:156)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    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:336)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    at org.eclipse.core.launcher.Main.run(Main.java:977)
    at org.eclipse.core.launcher.Main.main(Main.java:952)

    I do not have a .myhibernatedata in the project folder. I tried manually creating one with no change.

    I have a test project that I am able to open up the HQL editor and the MyEclipse/Hibernate properties page ok.

    All required classes can be found in the current project in either the source tree or in a jar file.

    Any assistance is appreciated.

    #257515 Reply

    Brian Fernandes
    Moderator

    kgwhitaker,

    You cannot add the .myhibernatedata file by hand – this is what will cause the problem you mentioned.

    You need to add Hibernate capabilities to your project before any of the Hibernate features will work. Detailed instructions are inlucded in the Hibernate Quickstart bundled with MyEclipse.

    Let us know if you require further assistance,
    Best,
    Brian.

    #257550 Reply

    kgwhitaker
    Member

    The MyEclipse/Add Hibernate Capabilities menu is greyed for my project. I believe it was probably added in a previous version of MyEclipse. Further suggestions?

    Thanks,

    Ken

Viewing 15 posts - 1 through 15 (of 16 total)
Reply To: HQL editor error

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