Monday, October 24, 2011

Avoiding “Could not enlist in transaction” Errors in JBoss

Problem
Process stalls and throws the following error (LiveCycle hosted on JBoss):
Explanation
Within the same process, 2 calls were being made to different non-XA data sources. This is not supported by default on JBoss. Hence the error is thrown.

Solution
To enable calling more than 1 non-XA data source within the same transaction (process), additional configuration is required
  1. Locate the jbossjta-properties.xml file in the [appserver root]/server/all/conf/ directory and open the file in an editor.
  2. Locate and modify the ‘properties’ element as follows. Add the property (shown in bold) if it doesn’t already exist in the jbossjta-properties.xml file.
  3. Save and close the file.

Wednesday, October 19, 2011

Tracking URLs: DHL, USPS, FEDEX and UPS

These are the URL's for direct shipment tracking:

DHL
http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB={tracking_number}


Fedex
http://www.fedex.com/Tracking?action=track&tracknumbers={tracking_number}


UPS
http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums={tracking_number}

If any value is provided for the “track” parameter then the confirmation page is skipped and the user goes directly to the tracking page. If you’d rather send the user to the confirmation page then just omit that parameter.


USPS
http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum={tracking_number}

Saturday, October 15, 2011

My first encounter with jBPM


Long story, short story. When I was working in one of my projects in Mexico, somebody mentioned something about BPM or BPEL and how practical de idea/concept was, because now we can mix the knowledge of the Business People with the Developers, by using some kind of cool diagrams to do Process Modeling.

And now I had to create a project which essentially it's a WorkFlow but we need some features like keeping the state of each execution (so we can trace it easily and resume the process if by any chance is stopped) "et all" and then, when I saw that One of the requirements was to integrate this miniworkflow with an existing App deployed on jBoss 4 with Seam 2.1 (I'd talk later about this framework, for all those like me who love Spring Framework), then I have to use jBPM 3 instead of 4 or 5 OUCH :'(
"But then, I realize that JBPM4 can work flawlessly on JBoss 4"
What do we need???
No much, Eclipse Helios (3.6)
Install these features:

  • JBoss Tools - http://download.jboss.org/jbosstools/updates/development/helios (don't forget to install jBPM support!)
  • Graphiti - http://download.eclipse.org/graphiti/updates/0.7.1
  • BPMN2 - http://codehoop.com/bpmn2


The concept is really simple, we just need to model the flow (I'll use the Designer to do this)


But it needs some logic inside its guts, so I'll add something called Handlers and some personalized tags (which is a really cool feture)
This is our model translated into XML
On my implementation, the process will run by itself, it's going to be a "FIRE AND FORGET";

On my case the process will wait for a certain amount of time and the it will start, it'll make one decision and it will execute something and then the End :)

The logic will be implemented by Implementing some Interfaces:



And Voila!!!

Soon I'll talk a little bit about jBoss SEAM! (How I implemented a REST Service FACILITO!)

Thursday, October 6, 2011

Debugging App Server Remotely

When I was working with an external/existing jBoss App Server Instance, I had an issue and I needed to debug something, so I had 2 options in my head:

  1. Create an internal instance (managed by my IDE: Eclipse) and do all the work there, for example like in Spring Source Tool Suite aka STS (which has its own App Server Integrated) or IBM RAD (which has its own version embedded of WebSphere)
  2. Put a bunch of DEBUG's on my Log4'j config and trace them through my Console

And then playing around with my IDE, I found something really cool on the Debugging perspective of my Eclipse:

Click on Debug Configurations and you'll see a window like this one (Bind this configuration to your project)




Then, go to Remote Java Application, create a new Configuration
On the Connect tab, give a name select the Standard Connction type and in the Connection Properties give the location of your server and the "debugging" port (on my case is 5005)

Why port 5005? Well, on my jBoss setup I found this option on its configuration:
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
By doing this, you'll enable debugging port on your JVM :D (Cool isn't it?)


On "source tab", select Add your project (the one which is running on your App Server)
And in "common tab" check the Debug option, finally, Apply and you're ready to rock!


Now, after you'd started your App Server you can debug your current (running) App in your Eclipse by clicking on Debug Icon and selecting the configuration we just created!

Good luck and have fun!