[IronJacamar] - ActivationSpec.setResourceAdapter called twice on the same ActivationSpec instance
by Stan Brown
Stan Brown [https://community.jboss.org/people/traffic] created the discussion
"ActivationSpec.setResourceAdapter called twice on the same ActivationSpec instance"
To view the discussion, visit: https://community.jboss.org/message/647063#647063
--------------------------------------------------------------
I'm running jboss-as-7.0.2.Final. And I have a situation where setResourceAdapter is being called twice on the same the ActivationSpec instance. I have three MDBs accessing the same resource adapter instance. Here's part of the log:
> 14:13:18,492 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.2.Final "Arc" started in 1512ms - Started 94 of 149 services (55 services are passive or on-demand)
> 14:14:18,599 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "jrac-simple.rar"
> 14:14:18,973 INFO [org.jboss.as.jpa] (MSC service thread 1-2) added javax.persistence.api dependency to jrac-simple.rar
> 14:14:19,099 INFO [stdout] (MSC service thread 1-5) >>>> made setResourceAdapter: activationSpec = com.unisys.coms.connector.COMSActivationSpec@1256a73 - 4bc11a8e:134e894e0c2:07ffd
> 14:14:19,099 INFO [stdout] (MSC service thread 1-5) >>>> made setResourceAdapter: resourceAdapter= com.unisys.coms.connector.COMSResourceAdapter@19c21b
> 14:14:19,141 INFO [org.jboss.as.connector.metadata.deployment.ResourceAdapterDeploymentService$AS7RaDeployer] (MSC service thread 1-5) IJ020002: Deployed: file:/F:/jboss-as-7.0.2.Final/standalone/tmp/vfs/temp5bdb9eed1653ea45/jrac-simple.rar-f74d935d3711582a/contents/
> 14:14:19,217 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "jrac-simple.rar"
> 14:14:34,281 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "jrac-simpleEJB.jar"
> 14:14:34,360 INFO [org.jboss.as.jpa] (MSC service thread 1-5) added javax.persistence.api dependency to jrac-simpleEJB.jar
> 14:14:34,468 INFO [stdout] (MSC service thread 1-2) >>>> made setResourceAdapter: activationSpec = com.unisys.coms.connector.COMSActivationSpec@1c27402 - 4bc11a8e:134e894e0c2:07ff2
> 14:14:34,468 INFO [stdout] (MSC service thread 1-2) >>>> made setResourceAdapter: resourceAdapter= com.unisys.coms.connector.COMSResourceAdapter@19c21b
> 14:14:34,468 INFO [stdout] (MSC service thread 1-3) >>>> made setResourceAdapter: activationSpec = com.unisys.coms.connector.COMSActivationSpec@10651eb - 4bc11a8e:134e894e0c2:07ff0
> 14:14:34,469 INFO [stdout] (MSC service thread 1-3) >>>> made setResourceAdapter: resourceAdapter= com.unisys.coms.connector.COMSResourceAdapter@19c21b
> 14:14:34,470 INFO [stdout] (MSC service thread 1-4) >>>> made setResourceAdapter: activationSpec = com.unisys.coms.connector.COMSActivationSpec@14e5d57 - 4bc11a8e:134e894e0c2:07ff1
> 14:14:34,470 INFO [stdout] (MSC service thread 1-4) >>>> made setResourceAdapter: resourceAdapter= com.unisys.coms.connector.COMSResourceAdapter@19c21b
> 14:14:34,520 INFO [stdout] (MSC service thread 1-2) >>>> made setServiceName: serviceName = RecordService
> 14:14:34,521 INFO [stdout] (MSC service thread 1-4) >>>> made setServiceName: serviceName = TextService
> 14:14:34,521 INFO [stdout] (MSC service thread 1-3) >>>> made setServiceName: serviceName = ByteService
> 14:14:34,523 INFO [stdout] (MSC service thread 1-2) >>>> made setResourceAdapter: activationSpec = com.unisys.coms.connector.COMSActivationSpec@1c27402 - 4bc11a8e:134e894e0c2:07ff2
> 14:14:34,523 INFO [stdout] (MSC service thread 1-3) >>>> made setResourceAdapter: activationSpec = com.unisys.coms.connector.COMSActivationSpec@10651eb - 4bc11a8e:134e894e0c2:07ff0
> 14:14:34,524 INFO [stdout] (MSC service thread 1-4) >>>> made setResourceAdapter: activationSpec = com.unisys.coms.connector.COMSActivationSpec@14e5d57 - 4bc11a8e:134e894e0c2:07ff1
> 14:14:34,537 INFO [stdout] (MSC service thread 1-4) >>>> made setResourceAdapter: resourceAdapter= com.unisys.coms.connector.COMSResourceAdapter@19c21b
> 14:14:34,537 INFO [stdout] (MSC service thread 1-3) >>>> made setResourceAdapter: resourceAdapter= com.unisys.coms.connector.COMSResourceAdapter@19c21b
> 14:14:34,538 INFO [stdout] (MSC service thread 1-2) >>>> made setResourceAdapter: resourceAdapter= com.unisys.coms.connector.COMSResourceAdapter@19c21b
> 14:14:34,538 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."jrac-simpleEJB.jar".component.SimpleRecordBean.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jrac-simpleEJB.jar".component.SimpleRecordBean.CREATE: Failed to start service
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_27]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_27]
> at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
> Caused by: java.lang.RuntimeException: javax.resource.spi.ResourceAdapterInternalException: ResourceAdapter instance already associated - com.unisys.coms.connector.COMSActivationSpec@1c27402 - 4bc11a8e:134e894e0c2:07ff2, error code: ERROR-GEN-006
> at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:85)
> at org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:78)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
> ... 3 more
> Caused by: javax.resource.spi.ResourceAdapterInternalException: ResourceAdapter instance already associated - com.unisys.coms.connector.COMSActivationSpec@1c27402 - 4bc11a8e:134e894e0c2:07ff2, error code: ERROR-GEN-006
> at com.unisys.coms.connector.COMSActivationSpec.setResourceAdapter(COMSActivationSpec.java:512)
> at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:83)
> ... 6 more
>
>
> 14:14:34,538 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."jrac-simpleEJB.jar".component.SimpleByteBean.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jrac-simpleEJB.jar".component.SimpleByteBean.CREATE: Failed to start service
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_27]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_27]
> at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
> Caused by: java.lang.RuntimeException: javax.resource.spi.ResourceAdapterInternalException: ResourceAdapter instance already associated - com.unisys.coms.connector.COMSActivationSpec@10651eb - 4bc11a8e:134e894e0c2:07ff0, error code: ERROR-GEN-006
> at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:85)
> at org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:78)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
> ... 3 more
> Caused by: javax.resource.spi.ResourceAdapterInternalException: ResourceAdapter instance already associated - com.unisys.coms.connector.COMSActivationSpec@10651eb - 4bc11a8e:134e894e0c2:07ff0, error code: ERROR-GEN-006
> at com.unisys.coms.connector.COMSActivationSpec.setResourceAdapter(COMSActivationSpec.java:512)
> at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:83)
> ... 6 more
>
>
> 14:14:34,538 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."jrac-simpleEJB.jar".component.SimpleTextBean.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jrac-simpleEJB.jar".component.SimpleTextBean.CREATE: Failed to start service
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_27]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_27]
> at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
> Caused by: java.lang.RuntimeException: javax.resource.spi.ResourceAdapterInternalException: ResourceAdapter instance already associated - com.unisys.coms.connector.COMSActivationSpec@14e5d57 - 4bc11a8e:134e894e0c2:07ff1, error code: ERROR-GEN-006
> at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:85)
> at org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:78)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
> ... 3 more
> Caused by: javax.resource.spi.ResourceAdapterInternalException: ResourceAdapter instance already associated - com.unisys.coms.connector.COMSActivationSpec@14e5d57 - 4bc11a8e:134e894e0c2:07ff1, error code: ERROR-GEN-006
> at com.unisys.coms.connector.COMSActivationSpec.setResourceAdapter(COMSActivationSpec.java:512)
> at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:83)
> ... 6 more
>
>
> 14:14:34,812 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 1) Deployment of "jrac-simpleEJB.jar" was rolled back with failure message {"Failed services" => {"jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleTextBean.CREATE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleTextBean.CREATE: Failed to start service","jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleRecordBean.CREATE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleRecordBean.CREATE: Failed to start service","jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleByteBean.CREATE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleByteBean.CREATE: Failed to start service"}}
> 14:14:34,846 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) Stopped deployment jrac-simpleEJB.jar in 35ms
> 14:14:34,847 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 2) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleTextBean.CREATE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleTextBean.CREATE: Failed to start service","jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleRecordBean.CREATE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleRecordBean.CREATE: Failed to start service","jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleByteBean.CREATE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jrac-simpleEJB.jar\".component.SimpleByteBean.CREATE: Failed to start service"}}}}
>
>From the log, it looks like the ActivationSpecs are being called twice, for example COMSActivationSpec(a)1c27402. We throw an exception under these circumstances since the Connector Architecture spec states that setResourceAdapter should only be called once. Is there some configuration to get around this issue?
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/647063#647063]
Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
14 years, 2 months
[jBPM] - Drools / jBPM with EJB3 persistence and transactions
by M Arnold
M Arnold [https://community.jboss.org/people/marnold] created the discussion
"Drools / jBPM with EJB3 persistence and transactions"
To view the discussion, visit: https://community.jboss.org/message/647812#647812
--------------------------------------------------------------
Hi,
I'm trying to use Drools and jBPM using EJB 3.0 and container managed transactions on JBoss AS 5.1. My goal is to ensure that all jBPM work is performed in the container managed transaction.
I've read the applicable documentation http://docs.jboss.org/jbpm/v5.2/userguide/ch07.html here, but I'm still unsure about how to achieve this.
In my SLSB I have:
@PersistenceUnit(unitName = "org.jbpm.persistence.jpa")
protected EntityManagerFactory emf;
@PersistenceContext
protected EntityManager em;
@Resource(mappedName = "java:/TransactionManager")
protected TransactionManager tm;
Then in a @PostConstruct I have:
env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, em);
env.set(EnvironmentName.TRANSACTION_MANAGER, tm);
But when I try:
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(getKnowledgeBase(), null, env);
I get the exception:
Caused by: java.lang.ClassCastException: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate cannot be cast to org.drools.persistence.TransactionManager
at org.drools.persistence.SingleSessionCommandService.initTransactionManager(SingleSessionCommandService.java:265)
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:115)
... 54 more
I checked the code, and I have to say I agree. ;-) I don't get it. I am expected to create my own class which wraps a real javax.transaction.TransactionManager and implements org.drools.persistence.TransactionManager? What is the correct way to do this?
Thanks in advance for any help, and my apologies if I missed something obvious...
in a stateless session bena
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/647812#647812]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
14 years, 2 months
[jBPM] - Persist Entity from within ScriptTask - best practice?
by William Timpany
William Timpany [https://community.jboss.org/people/wtimpany] created the discussion
"Persist Entity from within ScriptTask - best practice?"
To view the discussion, visit: https://community.jboss.org/message/647820#647820
--------------------------------------------------------------
My question: Is what I am doing sensible/recommended, as I have just started using JBPM.
I have a few Entities stored in my Oracle Database that I want to insert/update/delete as part of my workflow processing. All the changes need to be processed in the same transaction as the rest of the workflow persistance to ensure the integrity of the flow/data. I want to keep it all the code as simple as possible.
I am able to do this by using Java within the standard ScriptTask, using the EntityManager extracted from within the kcontext.
The Enities to be updated have been added to the "org.jbpm.persistence.jpa" persistance unit.
Here is the code from within the ScriptTask. This all works and a new "ScriptActionTriggerBean" is created and persisted to the Oracle DB every time the ScriptTask is called.
-- WorkFlow Code Snipit --
<extensionElements>
<tns:import name="com.db.gto.tms.agr.bean.model.workflow.ScriptActionTriggerBean" />
<tns:import name="javax.persistence.EntityManager" />
<tns:import name="org.drools.runtime.Environment" />
<tns:import name="org.drools.runtime.EnvironmentName" />
</extensionElements>
<scriptTask id="_6" name="PreProcess" scriptFormat="http://www.java.com/java" >
<script>
ScriptActionTriggerBean satb = new ScriptActionTriggerBean();
satb.setComments("Starting: Script Pre-Processing");
Environment env = kcontext.getKnowledgeRuntime().getEnvironment();
EntityManager em = (EntityManager) env.get(EnvironmentName.CMD_SCOPED_ENTITY_MANAGER);
em.persist(satb);
</script>
</scriptTask>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/647820#647820]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
14 years, 2 months