[jBPM] - timer job issues when disposing session in embedded j2ee process
by umberto maguolo
umberto maguolo [https://community.jboss.org/people/umb71] created the discussion
"timer job issues when disposing session in embedded j2ee process"
To view the discussion, visit: https://community.jboss.org/message/824721#824721
--------------------------------------------------------------
Hi all,
i'm using jBPM 5.4, I have a knowledge session with a process instance in it, embebbed in an ejb with container managed transaction, the process definition has a timer intermediate event in it:
i'm using jpa persistence but the problem arises also with in memory session without persistence. I've utilized the CMTDisposeCommand class to register the synchronization with the transaction manager and implemented the afterCompletion method to be notified when the container finishes it's work committing the transaction; in the afterCompletion method i've utilized the DefaultProcessEventListener and implemented the afterProcessCompleted method so i can (at least i thought it was so) dispose my knowledge session at the end of all the process elaboration.
The problem is that the process is regularly terminated but it seams that the timer service sheduler is not aware of that fact neither that the session is disposed and it continuosly try to signal the timer event on the session. When i call the ksession.dispose, in the afterProcessCompleted method, i get the exception in the server console:
SEVERE: Error when executing timer job
java.lang.IllegalStateException: Illegal method call. This session was previously disposed.
at org.drools.reteoo.DisposedReteooWorkingMemory.getLastIdleTimestamp(DisposedReteooWorkingMemory.java:562)
at org.drools.impl.StatefulKnowledgeSessionImpl.getLastIdleTimestamp(StatefulKnowledgeSessionImpl.java:890)
at org.drools.persistence.SingleSessionCommandService$EndOperationListenerImpl.endOperation(SingleSessionCommandService.java:334)
at org.drools.common.AbstractWorkingMemory.endOperation(AbstractWorkingMemory.java:1365)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1006)
at org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:866)
at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:90)
at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:323)
at org.drools.time.SelfRemovalJob.execute(SelfRemovalJob.java:15)
at org.drools.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:51)
at org.drools.persistence.jpa.JpaTimerJobInstance.internalCall(JpaTimerJobInstance.java:43)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:20)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:6)
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:34)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:14)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
giu 25, 2013 11:46:41 AM org.drools.time.impl.DefaultTimerJobInstance call
WARNING: Unable to execute timer job!
java.lang.IllegalStateException: Illegal method call. This session was previously disposed.
at org.drools.reteoo.DisposedReteooWorkingMemory.getProcessInstance(DisposedReteooWorkingMemory.java:382)
at org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:297)
at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:335)
at org.drools.time.SelfRemovalJob.execute(SelfRemovalJob.java:15)
at org.drools.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:51)
at org.drools.persistence.jpa.JpaTimerJobInstance.internalCall(JpaTimerJobInstance.java:43)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:20)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:6)
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:34)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:14)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
I've also tried to cancel any TimerJobInstance in the TimerService prior to dispose the session but the problem is still present. Am i doing something wrong? Missing something? What is the correct way of disposing session with (terminated) timer events in it?
Thanks.
Umberto
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/824721#824721]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 9 months
[Beginner's Corner] - Including external/third-party JARs in app on JBoss 7.1.1
by mbpolan
mbpolan [https://community.jboss.org/people/mbpolan] created the discussion
"Including external/third-party JARs in app on JBoss 7.1.1"
To view the discussion, visit: https://community.jboss.org/message/824196#824196
--------------------------------------------------------------
Hi everyone,
I'm a bit of a newbie when it comes to JBoss, so please correct me if I misunderstood something.
Anyway, I'm attempting to port an existing webapp from Tomcat 7 to a new JBoss 7.1.1 instance, and I'm a bit confused about getting all of my JAR dependencies resolved. There exists a collection of JAR files that are externally supplied by a third-party, and let's say they are located under $JAVA_HOME/lib/other on the end-user's machine. My webapp needs these JARs to be available, and so far, it seems that making a module for them is the way to go. However, I don't want to copy these JAR files to the module directory, because depending on what version of the JARs the user has (and their Java version), there could be differences in the code contained in those files. In Tomcat, I would just make sure that the aforementioned path was added to the classpath before my webapp was deployed, and everything would be loaded correctly. Is this kind of approach possible to do in JBoss?
Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/824196#824196]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 9 months
[JBoss Tools] - Touble using the Hibernate Tools in Eclipse
by Ankit Pawar
Ankit Pawar [https://community.jboss.org/people/ankit.pawar] created the discussion
"Touble using the Hibernate Tools in Eclipse"
To view the discussion, visit: https://community.jboss.org/message/824924#824924
--------------------------------------------------------------
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.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/824924#824924]
Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 9 months