[jBPM] - Persistence config for task and session fails
by Gary Struthers
Gary Struthers [http://community.jboss.org/people/GaryS] created the discussion
"Persistence config for task and session fails"
To view the discussion, visit: http://community.jboss.org/message/620733#620733
--------------------------------------------------------------
I have session persistence working but when I add task persistence I get errors
1 11/08 18:00:51,012[main] ERROR hibernate.impl.SessionFactoryImpl.<init> - Error in named query: ProcessInstancesWaitingForEvent
org.hibernate.hql.ast.QuerySyntaxException: ProcessInstanceInfo is not mapped [select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo where :type in elements(processInstanceInfo.eventTypes)]
...
javax.persistence.PersistenceException: [PersistenceUnit: org.drools.task] Unable to build EntityManagerFactory
...
Caused by: org.hibernate.HibernateException: Errors in named queries: ProcessInstancesWaitingForEvent
I map to different orm.xml files
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/testDS</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
...
<persistence-unit name="org.drools.task">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/ormtask.xml</mapping-file>
In my main method
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
//Creates the Environment and sets its attributes
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,
entityManagerFactory);
In my TaskServerDaemon
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("org.drools.task");
TaskService taskService = new TaskService(entityManagerFactory, SystemEventListenerFactory.getSystemEventListener());
Why doesn't this work?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620733#620733]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[JNDI and Naming] - Re: Using JNDI to connect to Websphere MQ, without hardcoded info
by Stuart Clayton
Stuart Clayton [http://community.jboss.org/people/stuartclayton22] created the discussion
"Re: Using JNDI to connect to Websphere MQ, without hardcoded info"
To view the discussion, visit: http://community.jboss.org/message/620823#620823
--------------------------------------------------------------
I just had exactly the same problem with incoming MDBs (receiving messages from MQ), with the same versions of JBoss and MQ. I solved it after literally days of investigation, by following the http://community.jboss.org/docs/DOC-12944 http://community.jboss.org/wiki/HowToConfigureEJB3MDBsForIBMWebsphereMQ hint for creating an "aop domain", with an important correction.
This "domain" contains all the context (host, port etc) that we currently have either in the annotations, the ejb-jar.xml or the jboss.xml (there seems to be no difference between the last two files, as far as where the activationSpecs are for queue MDBs). This "domain" arranges for yet another ( ! ) set of "activationSpec annotations" to be injected into the MDB class code, but indirectly instead of having to put annotations explicity in the class source.
Here is what the additional code in the JBoss deploy/ejb3-interceptors-aop.xml file looks like (note that the @org.jboss.ejb3.annotation.DefaultActivationSpecs ({ ... stuff has to be on one line, without CRLFs ):
<domain name="IBMMQ Message Driven Bean" extends="Intercepted Bean" inheritBindings="true"> <bind pointcut="execution(public * *->*(..))> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <!-- TODO: Authorization? --> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ --> <stack-ref name="EJBInterceptors"/> </bind> <annotation expr="class(*) AND !class((a)org.jboss.ejb3.annotation.Pool)"> @org.jboss.ejb3.annotation.Pool (value=StrictMaxPool, maxSize=15, timeout=10000) </annotation> <annotation expr="!class((a)org.jboss.ejb3.annotation.DefaultActivationSpecs)"> @org.jboss.ejb3.annotation.DefaultActivationSpecs ({(a)javax.ejb.ActivationConfigProperty(propertyName = channel, propertyValue = SYSTEM.DEF.SVRCONN), @javax.ejb.ActivationConfigProperty(propertyName = hostName, propertyValue = 127.0.0.1), @javax.ejb.ActivationConfigProperty(propertyName = queueManager, propertyValue = QM_APPLE), @javax.ejb.ActivationConfigProperty(propertyName = port, propertyValue = 1415), @javax.ejb.ActivationConfigProperty(propertyName = transportType, propertyValue = CLIENT")}) </annotation>
The MDB declaration now looks like this:
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }) @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) @ResourceAdapter(value = "wmq.jmsra.rar") @AspectDomain("IBMMQ Message Driven Bean") *public* *class* ReadMQAgent *implements* MessageListener {
The ejb-jar.xml now looks like this:
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0"> <enterprise-beans> <message-driven> <ejb-name>ReadMQAgent</ejb-name> <ejb-class>com.fleetboard.agw.calculator.msgproc.impl.ReadMQAgent</ejb-class> <activation-config> <activation-config-property> <activation-config-property-name>useJNDI</activation-config-property-name> <activation-config-property-value>false</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>destination</activation-config-property-name> <activation-config-property-value>Q1</activation-config-property-value> </activation-config-property> </activation-config> </message-driven> </enterprise-beans> </ejb-jar>
In the AOP "domain" declaration from the link given above, the annotation class was specified as @org.jboss.annotation.ejb.DefaultActivationSpecs. Somewhere (can't find it now) there was a user comment on this example, pointing out that the class should be @org.jboss.ejb3.annotation.DefaultActivationSpecs. After I changed this accordingly, the whole business finally worked as expected. Before this last change, I was getting an MQ error about "Q1" not being defined.
Of course there is never an upside without a downside. Now the eclipse console favors me with a extra splodge of JBoss startup warnings that don't amount to a hill of beans, apparently, because everything works fine: 165 consecutive repetitions of the line
09:25:49,006 WARN [AnnotationCreator] No ClassLoader provided, using TC
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620823#620823]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[JNDI and Naming] - Re: Using JNDI to connect to Websphere MQ, without hardcoded info
by Stuart Clayton
Stuart Clayton [http://community.jboss.org/people/stuartclayton22] created the discussion
"Re: Using JNDI to connect to Websphere MQ, without hardcoded info"
To view the discussion, visit: http://community.jboss.org/message/620792#620792
--------------------------------------------------------------
I just had exactly the same problem with incoming MDBs (receiving messages from MQ), with the same versions of JBoss and MQ. I solved it after literally days of investigation, by following the http://community.jboss.org/docs/DOC-12944 http://community.jboss.org/wiki/HowToConfigureEJB3MDBsForIBMWebsphereMQ hint for creating an "aop domain", with an important correction.
This "domain" contains all the context (host, port etc) that we currently have either in the annotations, the ejb-jar.xml or the jboss.xml (there seems to be no difference between the last two files, as far as where the activationSpecs are for queue MDBs). This "domain" arranges for yet another ( ! ) set of "activationSpec annotations" to be injected into the MDB class code, but indirectly instead of having to put annotations explicity in the class source.
Here is what the additional code in the JBoss deploy/ejb3-interceptors-aop.xml file looks like (note that the @org.jboss.annotation.ejb.DefaultActivationSpecs ({ ... stuff has to be on one line, without CRLFs ):
{code:xml}<domain name="IBMMQ Message Driven Bean" extends="Intercepted Bean" inheritBindings="true">
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
</bind>
<!-- TODO: Authorization? -->
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
<!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
<stack-ref name="EJBInterceptors"/>
</bind>
<annotation expr="class(*) AND !class((a)org.jboss.ejb3.annotation.Pool)">
@org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
</annotation>
<annotation expr="!class((a)org.jboss.ejb3.annotation.DefaultActivationSpecs)">
@org.jboss.ejb3.annotation.DefaultActivationSpecs ({(a)javax.ejb.ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"), @javax.ejb.ActivationConfigProperty(propertyName = "hostName", propertyValue = "127.0.0.1"), @javax.ejb.ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QM_APPLE"), @javax.ejb.ActivationConfigProperty(propertyName = "port", propertyValue = "1415"), @javax.ejb.ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")})
</annotation>
{code}
The MDB declaration now looks like this:
{code:java}@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter(value = "wmq.jmsra.rar")
@AspectDomain("IBMMQ Message Driven Bean")
public class ReadMQAgent implements MessageListener {
{code}
The ejb-jar.xml now looks like this:
{code:xml}<ejb-jar xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance" xmlns=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee" xmlns:ejb=" http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>ReadMQAgent</ejb-name>
<ejb-class>com.fleetboard.agw.calculator.msgproc.impl.ReadMQAgent</ejb-class>
<activation-config>
<activation-config-property>
<activation-config-property-name>useJNDI</activation-config-property-name>
<activation-config-property-value>false</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>Q1</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
{code}
In the AOP "domain" declaration from the link given above, the annotation class was specified as @org.jboss.annotation.ejb.DefaultActivationSpecs. Somewhere (can't find it now) there was a user comment on this example, pointing out that the class should be @org.jboss.ejb3.annotation.DefaultActivationSpecs. After I changed this accordingly, the whole business finally worked. Before this last change, I was getting an MQ error about "Q1" not being defined.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620792#620792]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[JNDI and Naming] - Re: Using JNDI to connect to Websphere MQ, without hardcoded info
by Stuart Clayton
Stuart Clayton [http://community.jboss.org/people/stuartclayton22] created the discussion
"Re: Using JNDI to connect to Websphere MQ, without hardcoded info"
To view the discussion, visit: http://community.jboss.org/message/620791#620791
--------------------------------------------------------------
I just had exactly the same problem with incoming MDBs (receive messages from MQ), with the same versions of JBoss and MQ. I solved it by following the http://community.jboss.org/docs/DOC-12944 http://community.jboss.org/wiki/HowToConfigureEJB3MDBsForIBMWebsphereMQ hint for creating an "aop domain", with an important correction.
This "domain" contains all the context (host, port etc) that we currently have either in the annotations, the ejb-jar.xml or the jboss.xml (there seems to be no difference between the last two files, as far as where the activationSpecs are for queue MDBs). This "domain" arranges for yet another ( ! ) set of "activationSpec annotations" to be injected into the MDB class code, but indirectly instead of having to put annotations explicity in the class source.
Here is what the additional code in the JBoss deploy/ejb3-interceptors-aop.xml file looks like (note that the @org.jboss.annotation.ejb.DefaultActivationSpecs ({ ... stuff has to be on one line, without CRLFs ):
{code:xml}<domain name="IBMMQ Message Driven Bean" extends="Intercepted Bean" inheritBindings="true">
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
</bind>
<!-- TODO: Authorization? -->
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/>
<interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
<interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
<!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->
<stack-ref name="EJBInterceptors"/>
</bind>
<annotation expr="class(*) AND !class((a)org.jboss.ejb3.annotation.Pool)">
@org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000)
</annotation>
<annotation expr="!class((a)org.jboss.ejb3.annotation.DefaultActivationSpecs)">
@org.jboss.ejb3.annotation.DefaultActivationSpecs ({(a)javax.ejb.ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"), @javax.ejb.ActivationConfigProperty(propertyName = "hostName", propertyValue = "127.0.0.1"), @javax.ejb.ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QM_APPLE"), @javax.ejb.ActivationConfigProperty(propertyName = "port", propertyValue = "1415"), @javax.ejb.ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")})
</annotation>
{code}
The MDB declaration now looks like this:
{code:java}@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@ResourceAdapter(value = "wmq.jmsra.rar")
@AspectDomain("IBMMQ Message Driven Bean")
public class ReadMQAgent implements MessageListener {
{code}
The ejb-jar.xml now looks like this:
{code:xml}<ejb-jar xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance" xmlns=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee" xmlns:ejb=" http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>ReadMQAgent</ejb-name>
<ejb-class>com.fleetboard.agw.calculator.msgproc.impl.ReadMQAgent</ejb-class>
<activation-config>
<activation-config-property>
<activation-config-property-name>useJNDI</activation-config-property-name>
<activation-config-property-value>false</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>Q1</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
{code}
In the AOP "domain" declaration from the link given above, the annotation class was specified as @org.jboss.annotation.ejb.DefaultActivationSpecs. Somewhere (can't find it now) there was a user comment on this example, pointing out that the class should be @org.jboss.ejb3.annotation.DefaultActivationSpecs. After I changed this accordingly, the whole business finally worked. Before this last change, I was getting an MQ error about "Q1" not being defined.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620791#620791]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months