4 Replies Latest reply on Feb 21, 2006 8:02 AM by lcoetzee

    Session is closed problem

    lcoetzee

      Hi,

      I have been trying to use the jbosside nightlies (without much success). I am currently building the nightlies myself (using the releng process as described in
      http://docs.jboss.com/jbosside/releng/user/build/en/html_single/).

      I am able to create the hibernate.cfg.xml but am unable to run HQL queries or see any query results.

      I get an error message of org.hibernate.SessionException: Session is closed! I have tried various things mentioned in the forum (of copying other jars into the build, but unfortunately that has not made any real difference.)

      I am running on Linux, with eclipse 3.1.1 and the jbosside built from CVS.

      Any suggestions would be greatly appreciated.

      Thanks

      Louis

        • 1. Re: Session is closed problem
          maxandersen

          caused by new behavior in hibernate core about auto closing sessions when running with the DriverManager connection provider by default.

          closing the property sheet should make it go away, otherwise play around with the auto close property in hibernate.cfg.xml.

          i'll work on having a more userfriendly "fix" for this in the next release.

          • 2. Re: Session is closed problem
            lcoetzee

            Hi max,

            thanks for the info... not having much luck in closing the property sheet. Have not come across a auto close property in the hibernate.cfg.xml (google not telling me much at this point... but I will search a bit more)

            I get the following exception from the nighly I built last night:

            ava.lang.NoSuchFieldError: extendsQueue
             at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:143)
             at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:276)
             at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:213)
             at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1168)
             at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:265)
             at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
             at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
             at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:260)
             at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:38)
             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:1021)
             at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2867)
             at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2572)
             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)
            



            Thanks
            L


            • 3. Re: Session is closed problem
              maxandersen

              hmm...that extendsQueue is because of an outofdate hibernate annotations.jar...should not occur! fix by updating the annotations jar.

              the autoclose option is found in the manual

              • 4. Re: Session is closed problem
                lcoetzee

                Set the following:

                 <property name="hibernate.transaction.auto_close_session">false</property>
                
                in my hibernate.cfg.xml (is this the right property ?)


                I have copied hibernate-tools.jar as found in
                /HibernateExt/tools/target/hibernate-tools

                and hibernate-annotations.jar as found in HibernateExt/metadata/target/hibernate-annotations


                into the eclipse/plugins/org.hibernate.eclipse_3.1.0.200602201923-nightly/lib

                (the above as checked out from CVS and built using the HibernateExt module name)

                With all of that I am able to create a session factory in my hibernate console. I can then open a HQL console and enter a query, execute it, but not see any result, getting the Session is closed exception when I try to view the Query result. I am also unable to see any entity diagrams etc.

                I am a bit confused as to which versions of the jars I actually should copy into the nightly to make it work.



                org.hibernate.SessionException: Session is closed!
                 at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:50)
                 at org.hibernate.impl.SessionImpl.contains(SessionImpl.java:1575)
                 at org.hibernate.eclipse.console.views.properties.HibernatePropertySourceProvider.getPropertySource(HibernatePropertySourceProvider.java:35)
                 at org.eclipse.ui.views.properties.PropertySheetEntry.getPropertySource(PropertySheetEntry.java:456)
                 at org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:728)
                 at org.eclipse.ui.views.properties.PropertySheetEntry.refreshValues(PropertySheetEntry.java:597)
                 at org.eclipse.ui.views.properties.PropertySheetEntry.refreshChildEntries(PropertySheetEntry.java:551)
                 at org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:735)
                 at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:875)
                 at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:392)
                 at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:212)
                 at org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156)
                 at org.eclipse.ui.internal.AbstractSelectionService.setActivePart(AbstractSelectionService.java:278)
                 at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:59)
                 at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:117)
                 at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2910)
                 at org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:2512)
                 at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:249)
                 at org.eclipse.ui.internal.PartPane.setFocus(PartPane.java:295)
                 at org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:788)
                 at org.eclipse.ui.internal.PartStack.access$0(PartStack.java:771)
                 at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:119)
                 at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:126)
                 at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267)
                 at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:276)
                 at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
                 at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$2.handleEvent(DefaultTabFolder.java:84)
                 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
                 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021)
                 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1045)
                 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1030)
                 at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:900)
                 at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3138)
                 at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1922)
                 at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
                 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
                 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021)
                 at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2867)
                 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2572)
                 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)
                


                L