[jBPM Users] - Re: Problem moving from 4.1 to 4.2 using Spring configuratio
by suganda
Hi all,
Just want to share the solution
After searching and testing , i think i have found the root cause of that weird exception. its because i let hibernate manage my transaction instead of spring. so its better to have spring manage transaction.
The concept of current="true" in spring transaction interceptor also correct. I already enable current="true" and it works perfectly with current="true" in hibernate session if we let spring manage transaction because if we initialize spring context with required transaction at first time, we always have transaction. So by right mandatory attributes is better then required attributes. So we will make sure every thread has active transaction otherwise it will throw exception.
Note that if we set current="false" in hibernate session configuration, we still can run it. However if you rollback using spring transaction, it will not rollback. I have tested it by putting exception after deploy process to JBPM. and its not rollback at all.
I will try whether this behavior same if we use data source (JNDI), JTA, as well as oracle dialect. Hopefully everything don't have same problem :)
Thanks in advance,
Best Regards,
Suganda
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268946#4268946
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268946
14 years, 7 months
[jBPM Users] - task & timers
by jbosspnet
Hi.
I am using Jbpm 3.2.3 on Jboss 4.2.3.GA.
I have many processes where I have to check a condition in a manually or in a automatic way and the check have to be completed into a time range.
For this target, I use the following task-node:
| <task-node name="check" create-tasks="false" end-tasks="true">
| <event type="node-enter">
| <action class="org.process.StartCheck"></action>
| </event>
| <event type="node-leave">
| <action class="org.process.DefaultEnd"></action>
| </event>
|
| <timer name="check" duedate="2 seconds" repeat="4 seconds">
| <action class="org.process.CheckTimer"></action>
| </timer>
|
| <task name="check-manual">
| <event type="task-start">
| <action class="org.process.DefaultStart"></action>
| </event>
| <event type="task-end">
| <action class="org.process.DefaultEnd"></action>
| </event>
| </task>
|
| <task name="check-automatic">
| <event type="task-start">
| <action class="org.process.DefaultStart"></action>
| </event>
| <event type="task-end">
| <action class="org.process.DefaultEnd"></action>
| </event>
|
| <timer name="check-automatic" duedate="2 seconds" repeat="2 seconds">
| <action class="org.process.AutomaticCheck"></action>
| </timer>
| </task>
|
| <transition to="notify success" name="OK"></transition>
| <transition to="notify failure" name="KO"></transition>
| </task-node>
|
The manual check (first task) uses a form where the user manually clicks on OK/KO buttons.
Automatic check (second task) is performed with a class in the timer action that executes a query on a database and signal to the corret OK/KO transition.
To the events node-leave, node-enter, task-start and task-end are associated classes (DefaultStart and DefaultEnd) to trace the execution.
StartCheck creates the correct task (from a configuration parameter):
| public abstract class StartCheck implements ActionHandler {
| @Override
| public void execute(ExecutionContext executionContext) throws Exception {
| // get check type (manual or automatic)
| // checkType = ...
|
| // get the task-name from the check type (check-manual or check-automatic)
| // taskName = ...
|
| // create task instance
| TaskNode taskNode = (TaskNode) executionContext.getNode();
|
| Task task = taskNode.getTask(taskName);
|
| Token token = executionContext.getToken();
|
| TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
|
| TaskInstance taskInstance = tmi.createTaskInstance(task, token);
|
| taskInstance.start();
| }
| }
|
CheckTimer notifies if the check is over:
| public abstract class CheckTimer implements ActionHandler {
| @Override
| public void execute(ExecutionContext executionContext) throws Exception {
| // get time range (startDate and endDate) from configuration parameters
|
| // checks that new Date() is in the range (startDate, endDate)
|
| // notify user
| }
| }
|
AutomaticCheck executes the automatic check:
| public abstract class AutomaticCheckAction implements ActionHandler {
| @Override
| public void execute(ExecutionContext executionContext) throws Exception {
| // isOK is setted after a query on a database
| boolean isOK = ...
|
| Token token = executionContext.getToken();
| token.signal(isOK ? "OK" : "KO");
| }
| }
|
When the execution enters in this node, the task creation is correct and also the task-node timer is created.
If the check type is manual then the execution stops in the check-manual task and with the form we can select the OK/KO transition.
But if the check type is automatic, the timer associated with the check-automatic task is never created (in the JBPM_JOB table I find only the row that refers to the task-node timer) and the execution stops in this task forever due to the non-execution of the AutomaticCheck action.
Why the "check-automatic" task timer is not created?
Regards.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268939#4268939
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268939
14 years, 7 months
[Installation, Configuration & Deployment] - Error installing to Start: name=persistence.unit:unitName=#
by amira88
Hi,
I am trying to deploy an EJB3 on jBoss 5.0.0.GA and I am receiving this message error:
| 02:59:52,044 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#sample state=Create
| javax.persistence.PersistenceException: [PersistenceUnit: sample] Unable to build EntityManagerFactory
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
| at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
| at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
| at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
| at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
| at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
| at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
| at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
| at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
| at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
| at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
| at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
| at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
| at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
| at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
| at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
| at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
| at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
| at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
| at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
| at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
| at org.jboss.Main.boot(Main.java:209)
| at org.jboss.Main$1.run(Main.java:547)
| at java.lang.Thread.run(Unknown Source)
| Caused by: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
| at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:89)
| at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:98)
| at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:66)
| at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:56)
| at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:126)
| at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1775)
| at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1779)
| at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3012)
| at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:3005)
| at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:712)
| at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:322)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
| at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
| ... 50 more
| 02:59:52,085 WARN [WebServiceDeployerEJB] Ingore ejb deployment with null classname: org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData@8fd19516{HotelTestBean}
| 02:59:52,136 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
|
| DEPLOYMENTS MISSING DEPENDENCIES:
| Deployment "jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3" is missing the following dependencies:
| Dependency "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#sample' **")
|
| DEPLOYMENTS IN ERROR:
| Deployment "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#sample' **
| Deployment "persistence.unit:unitName=#sample" is in error due to the following reason(s): org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
|
| 02:59:52,152 INFO [Http11Protocol] D�marrage de Coyote HTTP/1.1 sur http-127.0.0.1-8080
| 02:59:52,187 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
| 02:59:52,195 INFO [ServerImpl] JBoss (Microcontainer) [5.0.1.GA (build: SVNTag=JBoss_5_0_1_GA date=200902231221)] Started in 46s:970ms
|
and this is the persistence.properties:
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| <persistence-unit name="sample">
| <jta-data-source>java:/DefaultDS</jta-data-source>
| <properties>
|
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
|
|
|
|
I'm using the same persistence.properties in another ejb project and it work correctly!!
I don't know what's the problem with this project.
HELP PLEASE.
I HAVE 4 DAYS RESOLVING THIS PROBLEM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thank u all !!!!!!!!!!!!!!1
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268932#4268932
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268932
14 years, 7 months