7 Replies Latest reply on Jul 1, 2013 6:23 AM by ankit.pawar

    Trouble using the Hibernate Tools in Eclipse

    ankit.pawar

      hello,

       

      I am using hibernate tools plugin in Eclipse for generating code for beans and dao classes automatically. I am doing so because there are so many tables in the database so it is better than doing it manually. After giving the hibernate.cfg.xml and the connection properties, and while connecting, it gives exception.

      I was trying to connect to Oracle 10g express edition DB, checked all the parameters and connection properties, all is going right.

      I am not understanding why it is giving the exception.

       

      The whole stackTrace is as below :-

       

       

       

      2013-06-25 16:23:29,816 WARN main org.hibernate.impl.SessionFactoryObjectFactory - Could not unbind factory from JNDI

      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)

                at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

                at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)

                at javax.naming.InitialContext.unbind(InitialContext.java:416)

                at org.hibernate.impl.SessionFactoryObjectFactory.removeInstance(SessionFactoryObjectFactory.java:139)

                at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:981)

                at org.jboss.tools.hibernate3_5.HibernateExtension3_5.closeSessionFactory(HibernateExtension3_5.java:122)

                at org.jboss.tools.hibernate3_5.HibernateExtension3_5.reset(HibernateExtension3_5.java:214)

                at org.hibernate.console.ConsoleConfiguration.reset(ConsoleConfiguration.java:123)

                at org.hibernate.eclipse.console.views.ReloadConfigurationAction.doRun(ReloadConfigurationAction.java:34)

                at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:65)

                at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)

                at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)

                at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)

                at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)

                at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

                at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)

                at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)

                at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)

                at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)

                at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)

                at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)

                at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)

                at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)

                at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

                at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)

                at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)

                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

                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:597)

                at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)

                at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)

                at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

       

       

      2013-06-25 16:23:29,819 WARN main org.hibernate.impl.SessionFactoryObjectFactory - Could not unbind factory from JNDI

      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)

                at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

                at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)

                at javax.naming.InitialContext.unbind(InitialContext.java:416)

                at org.hibernate.impl.SessionFactoryObjectFactory.removeInstance(SessionFactoryObjectFactory.java:139)

                at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:981)

                at org.hibernate.console.ConsoleConfiguration.closeSessionFactory(ConsoleConfiguration.java:417)

                at org.hibernate.console.ConsoleConfiguration.reset(ConsoleConfiguration.java:130)

                at org.hibernate.eclipse.console.views.ReloadConfigurationAction.doRun(ReloadConfigurationAction.java:34)

                at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:65)

                at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)

                at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)

                at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)

                at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)

                at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

                at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)

                at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)

                at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)

                at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)

                at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)

                at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)

                at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)

                at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)

                at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

                at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)

                at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)

                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

                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:597)

                at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)

                at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)

                at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

       

       

       

      Please help me.