java.lang.NullPointerException

Hibernate JIRA | Mike haller | 10 years ago
  1. Speed up your debug routine!

    Automated exception search integrated into your IDE

  2. 0

    I'm getting a null pointer exception from the Hibernate Config view, when I select the 'create session factory' popup menu item. here's the stack trace: java.lang.NullPointerException at org.hibernate.eclipse.console.utils.ClassLoaderHelper.getRawLocationFile(ClassLoaderHelper.java:91) at org.hibernate.eclipse.console.utils.ClassLoaderHelper.getRawLocationURL(ClassLoaderHelper.java:83) at org.hibernate.eclipse.console.utils.ClassLoaderHelper.getRawLocationsURLForResources(ClassLoaderHelper.java:117) at org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences.getCustomClassPathURLS(EclipseConsoleConfigurationPreferences.java:81) at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:109) at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:98) at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:37) at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:46) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538) 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:1380) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1404) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1389) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1237) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3060) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2712) 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:324) 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) Here's how to reproduce it: create a project and select "use project folder as root for source and class files" in the java project creation wizard. create some java files, mapping files, etc. in the hibernate config, add the project root to the classpath (which makes sense here, and is the crucial point for reproducing the bug; strictly speaking the previous two steps aren't probably not essential). save the config, and try to create a session factory from it. I've looked at this in the debugger, and here's what's going on: the NPE arises on this line of code: file = ResourcesPlugin.getWorkspace().getRoot().findMember(simplePath).getRawLocation().toFile(); specifically, the call to Project.getRawLocation returns null. I don't know why that is.

    Hibernate JIRA | 1 decade ago | Loren Rosen
    java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences.getCustomClassPathURLS()
    2. org.hibernate.eclipse
      EclipseConsoleConfigurationPreferences.getCustomClassPathURLS
      1. org.hibernate.eclipse.console.EclipseConsoleConfigurationPreferences.getCustomClassPathURLS(EclipseConsoleConfigurationPreferences.java:107)
      1 frame
    3. org.hibernate.console
      ConsoleConfiguration.build
      1. org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:155)
      2. org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:110)
      2 frames
    4. org.hibernate.eclipse
      BasicWorkbenchAdapter.fetchDeferredChildren
      1. org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
      2. org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:88)
      3. org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
      3 frames
    5. Workbench
      DeferredTreeContentManager$1.run
      1. org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
      1 frame
    6. Eclipse Jobs
      Worker.run
      1. org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
      1 frame