[JBoss Web Services] - Transacted webservices
by Simon Del Fabbro
Simon Del Fabbro [https://community.jboss.org/people/simondelfab] created the discussion
"Transacted webservices"
To view the discussion, visit: https://community.jboss.org/message/809500#809500
--------------------------------------------------------------
Hi,
I have a couple questions which crosses over a couple of JBoss groups, but it is mainly related to web services.
I have a web service method which reads off a JMS message off from websphere MQ and the client writes the response to a database. I want the reading of the message from the queue and the writing of the data to database to be performed as a single transaction. So I set about achieving this with WS-Atomic (and I also tried WS-BusinessActivity). I followed the samples [1] and got something working (minus the integration with Websphere) in my dev environment. When I tested in an environment which simulates the live environment, it failed to work because the server on which web service was being invoked couldn't communciate to the JBoss instance ("the client") calling the web service because the client was behind a firewall. On debugging and a bit research, I realise that (obviously) sychronous communication is necessary [2] for participant registration and coordination.
So my first question is, is it possible to enable the communication back to the client to be performed over the connection established by the client to the server i.e. duplex communication like Web sockets? I doubt whether this would be possible given that HttpURLConnection that is probably being used by the client to make the call would not support Web sockets. I have considered creating a SSL tunnel from the "client" machine to the server, but this is not feasible at all deployments.
Another question I wanted to ask is whether the client calling a transacted web service needs to be performed from within JBoss? I assume it has to because of the participant registration and coordination stuff.
As an alternative solution to using WS-*, I implemented 2 web service methods (commit, rollback) which the client calls after writing the response to the database. On the server side, the read message web service method created a (transacted) session, read the message, spawned a thread (which had a reference to the JMS session), created a UUID as a transaction id and returned both the tx id and message back to the client. The spawned thread blocked (with timeout) and on receipt of either the commit and rollback web service methods, the thread was woken up and the JMS session was either committed or rolled back. Not exactly atomic, but it meant messages from the queue weren't lost and the possibility of duplicates was acceptable. I tested this with Hornet as the JMS implementation and it worked fine. But once I tried it with Websphere it didn't work because 1. the connection obtained from the factory was not transacted (despite using QueueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE)) and 2. if I created a LocalTransaction, it is bound to the current thread.
I then looked into a solution where the transactional context is contained in a separate thread and I thought I came across the solution with javax.resource.spi.work.WorkManager, but this not available for general use in JBoss 7.1.1 [3].
I have looked at using an EJB (3.1) asynchronous method [4] in conjunction with the above solution I have outlined, but I don't think that will work either.
The situation I have encountered doesn't sound like a unique problem and I am certain there is solution or a practical work around this problem. I don't particularly want to reinvent something that is most likely solved. I would appreciate some advice/feedback. Thanks.
Regards,
Simon
[1] https://github.com/jboss-jdf/jboss-as-quickstart/tree/jdf-2.0.0.Final/wsa... https://github.com/jboss-jdf/jboss-as-quickstart/tree/jdf-2.0.0.Final/wsa...
[2] http://docs.jboss.org/jbosstm/5.0.0.M1/guides/xts-administration_and_deve... http://docs.jboss.org/jbosstm/5.0.0.M1/guides/xts-administration_and_deve...
[3] https://community.jboss.org/message/798227#798227 https://community.jboss.org/message/798227
[4] http://satishgopal.wordpress.com/2011/04/24/ejb-3-1-asynchronous-methods/ http://satishgopal.wordpress.com/2011/04/24/ejb-3-1-asynchronous-methods/
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/809500#809500]
Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 12 months
[jBPM] - Intermittently pending human task come across a missing jbpm parent process in jBPM 5.2
by Dev S
Dev S [https://community.jboss.org/people/devinderpal] created the discussion
"Intermittently pending human task come across a missing jbpm parent process in jBPM 5.2"
To view the discussion, visit: https://community.jboss.org/message/752342#752342
--------------------------------------------------------------
Env: Jboss 7.1.0, mysql DB, Redhat 5.5, jBPM 5.2
When I thought I'm getting pretty good with jBPM and our application is about to be released, i came across this tough bug during extensive testing.
Intermittently we're facing that pending human task has missing parent process instance and it results in nullpointerexception while completing that human task.
I ran below SQL query to confirm this:
select t.id, t.processInstanceId from Task t where t.processInstanceId not in (select distinct(InstanceId) from ProcessInstanceInfo);
+----+-------------------+
| id | processInstanceId |
+----+-------------------+
| 33 | 20 |
| 43 | 20 |
| 47 | 20 |
| 53 | 20 |
| 57 | 20 |
+----+-------------------+
Same code works fine most of the time. So I think it's not problem with our code but some bug in jBPM. MinaTaskServer is being used for our implementation.
Also we use JTA persistence for jBPM core engine and RESOURCE_LOCAL for human task. We have to use RESOURCE_LOCAL for human task because JTA can't be used due to another jBPM bug.
If I reinitialize the database, then everything works fine for a while but again I run into this problem.
Please let us know how we can fix it, if anyone knows solution. I was about to create a blocker JIRA issue but thought let's first get community opinion on this.
Exception stack trace is attached.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/752342#752342]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 12 months
[jBPM] - IOException while storing process instance?
by Jim B
Jim B [https://community.jboss.org/people/jamesbeam] created the discussion
"IOException while storing process instance?"
To view the discussion, visit: https://community.jboss.org/message/809700#809700
--------------------------------------------------------------
Using jBPM 5.4, Hibernate 4, JPA2 I have a rule in which I want to create an object and then start a process with a facthandle to this object as one of the variables. (FYI, I'm passing the facthandle because I want the process to retract the object I created before it ends.
The issue is that right after my rule fires (right after the output, "started process: 123" - see below) I get the following error:
* java.lang.IllegalArgumentException: IOException while storing process instance 123: org.drools.common.NamedEntryPoint*
* org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:207)*
If I insert null or a string instead of the fact handle, everything works fine.
MY GOAL: I am inserting objects into working memory and based upon the object, if a related process already exists, I will send a signal to it, if a related process does not already exist I want to create/start one. I use a "MarkerBean" to determine whether or not a related process already exists. When a process ends, it needs to remove the related MarkerBean.
The following rule is giving me the exception. Here, an object (MyEventBean) has been inserted and I am looking to see if there is a corresponding MarkerBean. Then, I create the process and new markerbean if necessary:
rule "TestRule4"
no-loop true
dialect "java"
when
$meb: MyEventBean(style matches ".*western.*")
not ($mb : MarkerBean(title matches $meb.getTitle()))
then
// first get the fact handle and pass it to the process
MarkerBean $mb = new MarkerBean();
Object factHandle = kcontext.getKnowledgeRuntime().insert($mb);
System.out.println("got object:"+factHandle.getClass().getName()); <=== prints org.drools.common.DefaultFactHandle
java.util.Map<String,Object> variables = new java.util.HashMap<String,Object>();
variable.put("markerHandle",factHandle)
WorkflowProcessInstance pi = (WorkflowProcessInstance)kcontext.getKnowledgeRuntime().createProcessInstance("test.SimpleProcess", variables);
//store the new processinstance in the new MarkerBean (so I can later signal it)
$mb.setTitle($meb.getTitle());
$mb.setProcessInstanceId(pi.getId());
update($mb)
kcontext.getKnowledgeRuntime().startprocessInstance(pi.getId());
System.out.println("started process "+pi.getId());
end
For grins I added DefaultFactHandle ( to my persistence.xml, didn't help. As I mentioned, if I add a plain string rather than the factHandle, everything works.
Does anyone see anything here that could be causing a problem?
Thanks vm!
-J
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/809700#809700]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 12 months
[JBoss Tools] - Can not debug OSGI Bundles deployed in JBoss EAP 6.1 with JBossTools 4.0.1/ JBoss Developer Studio 6&7
by Thomas Wiesner
Thomas Wiesner [https://community.jboss.org/people/Arakasi69] created the discussion
"Can not debug OSGI Bundles deployed in JBoss EAP 6.1 with JBossTools 4.0.1/ JBoss Developer Studio 6&7"
To view the discussion, visit: https://community.jboss.org/message/809280#809280
--------------------------------------------------------------
Hello All,
while migrating from JBoss 7.1.1 to JBoss EAP 6.1 Alpha1, i've evaluated JBoss Tools 4.0.1, JBoss Developer Studio 6 & 7 Alpha1 with following issue.
Our application consist of some osgi bundles and an osgi WAR which i can successfully publish and start with all named tools above. The only trick is, i've always to clean the data and tmp subdirectory in JBoss before start.
After that i tried to start the JBoss in debug mode with the named tools and deploying/starting the bundles fails with the following exception:
[0m [31m14:33:49,853 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."de.xxx.yyy.data.services.jar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."de.xxx.yyy.data.services.jar".PARSE: JBAS018733: Failed to process phase PARSE of deployment "de.xxx.yyy.data.services.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_05]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_05]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05]
Caused by: java.lang.NullPointerException
at org.jboss.as.osgi.service.FrameworkActivator.activate(FrameworkActivator.java:76)
at org.jboss.as.osgi.deployment.FrameworkActivateProcessor.deploy(FrameworkActivateProcessor.java:72)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
... 5 more
The same exception occurs for the other bundles.
With all tools i've tried the jboss eap runtime 6.1 (tech preview) adapter, and also jboss eap runtime 6.0 adapter with the known work around to symlink the jboss-modules. I've got always the same exception.
Can anybody give me a hint how to debug our application with jboss tools !? Or is it more a jboss eap 6.1 / jboss osgi issue !? But starting the jboss eap with standalone.sh and jboss tools "start" works fine with the deployed bundles.
Please let me know if you need further information.
Kind regards, Thomas
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/809280#809280]
Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 12 months