[jBPM] - How to recognize when async-node is finished?
by Johannes Krämer
Johannes Krämer [http://community.jboss.org/people/johannesk] created the discussion
"How to recognize when async-node is finished?"
To view the discussion, visit: http://community.jboss.org/message/548072#548072
--------------------------------------------------------------
Hi,
I'm trying to run a test with a simple process definition that contains the start state, an async node, a wait state and the end state. An example is attached.
I create a process instance, remember the ID, obtain the root token and send a signal. The token then moves to the first node, which has set async to true. Then I save the processInstance and close the JbpmContext so the job message is sent to the job executor. The async node simply waits some time before it calls ExecutionContext.leaveNode() to send the token into a wait state.
What I want to do now is: retrieve the process instance by the previously saved ID (with a newly created JbpmContext), get the root token and send a signal to make it take the transition to the end state.
My problem is: How long do I have to wait after the token was sent to the async node if I want to be sure that the token has entered the next wait state and is no longer locked by the job? Is there any possibility to be notified?
I tried to use a simple monitor where the main thread calls wait() after sending the first signal and the node implementation calls notifyAll() after leaveNode(), but the token is still locked by "Job(1)" when I send the second signal. It works if I wait some extra time (e. g. 250 ms) in the main thread before sending the second signal, but that is obviously not a good solution.
Kind regards
Johannes Krämer
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/548072#548072]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 10 months
[Datasource Configuration] - JBoss 5.0 and 5.1 MySql-Hibernate Dialect Class Cast error--works in JBoss 4.2.3
by Chris Stepnitz
Chris Stepnitz [http://community.jboss.org/people/cstepnitz] created the discussion
"JBoss 5.0 and 5.1 MySql-Hibernate Dialect Class Cast error--works in JBoss 4.2.3"
To view the discussion, visit: http://community.jboss.org/message/548056#548056
--------------------------------------------------------------
Hi,
I'm trying to migrate my application to JBoss 5.1 or JBoss 5.0.1 from JBoss 4.2.3, and I'm having some issues with the hibernate-to-mysql database connection. Both new versions of JBoss give me the same error, while the same configuration works in JBoss 4.2.3.
In short, I've successfully set up a data source connection and jndi name for my war to a local mysql database. My app itself uses hibernate to 'talk' to the database, and on deployment I get a ClassCast exception stating that the default MySql dialect doesn't extend the right class (but it does!). "Caused by: java.lang.ClassCastException: org.hibernate.dialect.MySQLDialect cannot be cast to org.hibernate.dialect.Dialect"
I'm mystified. Any guesses? Details below.
*Stack Trace:*
08:32:31,453 INFO [Version] Hibernate Commons Annotations 3.1.0.GA
08:32:31,453 INFO [Version] Hibernate EntityManager 3.4.0.GA
08:32:31,500 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
name: MyPersistence
...]
08:32:31,546 WARN [Ejb3Configuration] Persistence provider caller does not impl
ement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
08:32:31,625 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
08:32:31,640 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
08:32:32,093 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#MyPersistence state=Create
javax.persistence.PersistenceException: [PersistenceUnit: MyPersistence] 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(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
[CUT HERE FOR LENGTH]
Caused by: org.hibernate.HibernateException: Could not instantiate dialect class
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:84)
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:66)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 61 more
Caused by: java.lang.ClassCastException: org.hibernate.dialect.MySQLDialect cannot be cast to org.hibernate.dialect.Dialect
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
... 69 more
08:32:34,234 INFO [TomcatDeployment] deploy, ctxPath=/myCtx
08:33:03,250 INFO [[/myCtx]] Initializing log4j from [classpath:log4j.xml]
08:33:03,281 INFO [[/myCtx]] Initializing Spring root WebApplicationContext
*My Data Source:*
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>MyPersistence</jndi-name>
<jta-data-source>MyPersistence</jta-data-source>
<connection-url>jdbc:mysql://localhost:3306/myApp</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>FAKEUSER</user-name>
<password>FAKEPASSWORD</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>0</idle-timeout-minutes>
<track-statements/>
<application-managed-security/>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
</local-tx-datasource>
</datasources>
*My Persistence.xml in my.war*
<persistence xmlns=" /java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit transaction-type="JTA">
<jta-data-source>java:/MyPersistence</jta-data-source>
</persistence-unit>
</persistence>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/548056#548056]
Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 10 months
Re: [jboss-user] [JNDI and Naming] - $Proxy60 - returned by JBOSS JNDI Context
by Anand Krishnan
Anand Krishnan [http://community.jboss.org/people/anandhakrishnank] replied to the discussion
"$Proxy60 - returned by JBOSS JNDI Context"
To view the discussion, visit: http://community.jboss.org/message/548004#548004
--------------------------------------------------------------
I had attached the sample application, and had commented on JNDITest Servlet source code. Please check and revert.
Output Screen:
~~~~~~~~~~~~~~~~~~~~~~~~///////////////~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~///////////////~~~~~~~~~~~~~~~~~~~~~~~
org.jnp.interfaces.NamingContext
org.jnp.interfaces.NamingContext@11c5342
{jnp.parsedName=, java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces}javax.naming.InitialContext@131a24c
$Proxy71
{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces}
Typecasting
javax.naming.InitialContext@9e3fc2
{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces}
~~~~~~~~~~~~~~~~~~~~~~~~///////////////~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~///////////////~~~~~~~~~~~~~~~~~~~~~~~
Hope, Someone there to help me...
Thanks,
Anandhakrishnan
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/548004#548004]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 10 months