Archive for category Uncategorized

Future of this blog post

To be continued ….

No Comments

WS-Security with GlassFish ESB

When selling GlassFish ESB to partners, we (Sun) have to provide our partners with all the material allowing them a quick ramp-up on our technology.  That’s the main reason why my group (Sales Engineers, Northern Europe) created a 3 days GlassFish ESB technical workshop.

My contribution to this workshop is a one hour module about WS-Security and GlassFish ESB (and OpenESB).  The idea is to demonstrate how easy it is to setup a WS-Security enabled channel between a web service provider and a web service client.

Specifically, the screencast tutorial shows how to establish mutual certificate authentication between an EJB based web service and a JBI service assembly, acting as web service client, in this case, a BPEL module.

The module is now released online, booth as PDF slides and as a screencast tutorial.

To learn more about WS-Security, I recommend this reading.

Enjoy ! 

, , ,

No Comments

Using HermesJMS to browse GlassFissh’s JMS queues

GlassFish includes Sun’s implementation of JMS , known as OpenMQ . When developing SOA applications with Java CAPS or OpenESB , you will most probably end up using JMS queues and topics as loosely coupled communication mechanism between components of your application.

However, as great are GlassFish and OpenMQ, they lack a graphical tool allowing to browse queues and topic. Developing JMS applications without such a tool is a frustrating task, to say the least.

Here comes HermesJMS. Quoted from their web site :

HermesJMS is an extensible console that helps you interact with JMS providers making it easy to browse or search queues and topics, copy messages around and delete them. It fully integrates with JNDI letting you discover administered objects stored, create JMS sessions from the connection factories and use any destinations found”

Configuring HermesJMS to connect to OpenMQ is not intuitive at all and I found very few resources on the web explaining how to do it.

At this stage, I would like to thank Michael Czapski and Thomas Barrett for having showed me the steps required to configure HermesJMS and for all the work they did to prepare a great CEC 2008.

Step 1 : Start Hermes JMS

The easiest way to start Hermes JMS is using Java Web Start. You can do that from their web site or using the icon below (requires Java SE 6+, if you have older versions of Java, other links are provided on Hermes JMS’ web site)

Note that it will only work if your Java MQ is installed to use default port 7676.

Step 2 : Create a JavaMQ session

Replace <new> with JavaMQ and click the Apply button.

Step 3 : Add Java MQ JARs files to the classpath

Click on the Providers Tab on the bottom of the screen, right click anywhere inside the Classpath Groups pane and choose Add Group.

Name the group JavaMQCLasspahGroup (or whatever meaningful name you want). Right-click on the long button called Library and choose Add JAR(s).

Navigate to your GlassFish application server’s imq/lib directory. For OpenESB installed to OPENESB_HOME it will be something like : $OPENESB_HOME\glassfish-v2-ur2-b04-patch-20080929\imq\lib

This should work whether the imq/lib comes from Java MQ 4.1, OpenESB installation, GlassFishESB installation or Java CAPS 6 installation.

Choose the 10 following JARs. Not all may be required by we did not spend the time figuring out the minimum necessary set.

  • fscontext.jar

  • imq.jar

  • imqadmin.jar

  • imqbroker.jar

  • imqjmx.jar

  • imqutil.jar

  • imqxm.jar

  • jaxm-api.jar

  • jhall.jar

  • jms.jar

Allow Hermes to scan the JARs.

Once the JARs are scanned the Library will list all the JARs. Click the Apply button. Your screen should now look like this :

Click on Apply, then OK

Right-click the JavaMQ session and choose Edit to open configuration dialogue again.

Pull down the Loader menu and choose the JavaMQClasspathGroup. Pull down the Class menu and choose the com.sun.messaging.QueueConnectonFactory class. Click OK

Step 4 : Add an existing JMS queue / topic to your session

The last step is to actually add the queues and topics you want to monitor

Right-click JavaMQ session and choose New->Add queue …

and be sure to choose the name of an existing queue or topic.

Step 5 : Enjoy browsing your queues and topics

Once the Java MQ session is configured and queues of interest are configured we can interact with the Java MQ broker, view messages in destinations, truncate destinations (delete all messages) and so on. The functionality of Hermes JSM can be used as required.

UPDATE : OpenMQ FAQ now has a topic on HermesJMS Integration.  It also describes how to connect to a remote broker, not running on the localhost.



Open Source Distribution and Support – the best of both worlds

Many customers are asking for the latest and greatest features from our development trees, while asking at the same time for the security of a support contract.

Developers wants to work with the latest stable builds, Managers wants the security of 24/7 support and legal indemnifications.

Until today, customers had either to download the latest stable build from our open source and community web sites (such as OpenSSO, OpenESB), either to subscribe to the commercial equivalent of these tools (Access Manager, Java CAPS) .

Once again, Sun is changing the rules.

GlassFishESB will be the officially supported version of the community open source project OpenESB, with stable releases on a more frequent basis than the commercial equivalent Java CAPS, also based on OpenESB.

GlassFishESB is the fourth release vehicle for Java CAPS, the others being ESB Suite, MDM Suite and, the full Java CAPS. Confused ?  Check this table to compare our four offerings.

But we don’t want to leave our Java CAPS customers behind, therefore the components that are being released with GlassFish ESB are targeted for use by Java CAPS customers as well. The objective being that Java CAPS or ESB Suite customers can use all of the capabilities released with GlassFish ESB at the time they are available.

Further, going forward, customers who buy the higher levels Suites should not be "disadvantaged" in terms of either not having access to new components and also having access to them at the same time.  In other words, we want customers of the "suites" to have the benefits and flexibility of the community approach as well

Similarly, OpenSSO Express is the supported version of OpenSSO, available to Access Manager customers. Access Manager releases are published every 12-15 months, while OpenSSO Express releases are planed every 3 months.

Can we get the best of both worlds ?  You bet !

No Comments

Java CAPS Developer Conference 2008

The Java CAPS Developer Conference is comming back to Europe. Join us in Munchen, Germany, Oct 13-15.

This is the unique occasion

  • to learn about the many new features of Java CAPS 6
  • to network with developers and users from different industries and geographies
  • to directly meet and talk to the Sun Engineering team.

Registration is now open.

No Comments

Thinking about refactoring ….

Do not implement too many operations in a single BPEL, you will end up with something like this.

Thinking about refactoring ?  This is were NetBeans BPEL refactoring features are handy (Thanks Jason for the link).

No Comments

GlassFish Log and Regular Expressions

I was tired to filter out many information not directly useful to my debugging process while reading a GlassFish log file.

A log entry  like this one

thread-pool-1; w: 7;|BATCH-MSG-M0992: Another Work item already
checking for files... |#]

contains many useful information, like the timestamp, the message severity level, the component that issued the message, the thread name and pool etc … But when I do look at a GlassFish log file, nine times out of ten, I do not need all these extra information, I just need the last message. 

Visually filtering out this is boring, error prone and, in general, slow down your analysis process.

When looking at the server log file from NetBeans, it does filter out all that information to propose you only the "relevant" part.  But, when working from command line, switching to NetBeans "just" to read your uncluttered log file is tedious as well.

I decided to implement from the command line, the same filtering as the one proposed by NetBeans, using sed and regular expressions. The first expression I crafted is


It matches any line starting (^) with a bracket and containing anything (.*) until it matches the sequence ;|.  ([ and | must be escaped because they have special meanings in regular expression language).

Combining this with sed‘s substitute function (s/…/…), allows me to eliminate the first part of each line in the log entry.  Applying this to the previous log line gives :

tail server.log  | sed -e 's/^\[.*;\|//'
BATCH-MSG-M0992: Another Work item already checking for files... |#]

This is already more readable.  Then, just for the fun of it, we can get rid of the last three characters as well, by applying a second sed command :

sed -e 's/\|#\]$//'

where the regular expression \|#\]$ means "any line ending with ($) the charaters |#]" (once again, | and ] are escaped with a \).

To summarize, the complete tail command looks like this

tail server.log  | sed -e 's/^\[.*;\|//' | sed -e 's/\|#\]$//'

Of course, I scripted all this to avoid entering this each time I am looking at a GlassFish log file :-).  I let you create your own script as a follow-up exercise.

If you happen to know how to improve this by using only one sed command, I will welcome your input !

Enjoy !


More OpenOffice API Fun : Remove the first row in a Spreadsheet

As a follow up to my previous entry about converting Excel spreadsheet into CSV files using OpenOffice API, here is a small improvement.

The files we do receive have a first row containing the title of the columns, not any actual business data.  My intent was to skip this line while encoding the CSV file into XML, using some feature of the Open ESB Custom Encoders module.  Apparently, the Custom Encoder can not be configured in such a way, i.e. there is no possible configuration telling the Custom Encoder to skip the first line of a file.

So, I returned to the OpenOffice API and decided to remove the first row in the spreadsheet itself, before converting it to CSV.

Here is the code :

     private void removeFirstRow(XComponent xDoc) throws Exception {

         //get the speadsheet object
         XSpreadsheetDocument sDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xDoc);
         Object o = sDoc.getSheets().getByName("Sheet1");
         XSpreadsheet xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, o);

         //get the rows
         XColumnRowRange xRange = (XColumnRowRange) UnoRuntime.queryInterface(XColumnRowRange.class, xSheet);
         XTableRows rows = xRange.getRows();

         //delete the first row
         rows.removeByIndex(0, 1);


As usual, I welcome your comments and feedbacks.

Enjoy !

No Comments

Using OpenOffice API to generate PDF documents

Based on my previous blog entry, I applied the same technique to programmatically generate PDF documents.

The sample NetBeans project is available for you to download.

This sample does the following :

  • It creates an empty text document (using OO’s writer application)
  • It inserts the content of a template (another document containing text, images, etc …)
  • It searches and replaces occurences of tags (like @name@) with actual data
  • It saves the resuting document as PDF

Using this technique, you can generate professional looking PDF documents from your Java application using only free and open-source softwares.

This was tested on Mac OS X, with Apple’s Java 6 and StarOffice 9 Beta. Enjoy !

As usual, I welcome your comments and feedbacks.


Using OpenOffice API to convert Excel files

I am currently working on a Proof Of Concept around Java CAPS and its capacity to handle, parse and transform Swift messages.

Customer do receive fund subscription orders from their partners and customers in many different formats : XML, CSV and … Excel files.

Excel files are always a bit tricky to handle when you’re not developping nor deploying on Windows servers (if you are using Windows, then check out our DCOM Binding Components as it might be an elegant way to handle DCOM compliant objects from OpenESB – or – our DCOM OTD for the folks using Java CAPS repository-based projects)

The solution I choose to handle these files is quite simple : I am using the OpenOffice API to programmatically open the XLS file with OO and save it as a CSV text file … just like you would do it by hand, using the OO GUI.

I attached a code sample to demonstrate this.  This is a complete NetBeans project.

For this sample to compile and execute, you will need a couple of OO jar files in your classpath (see the code sample for the exact list of required jars, they are all shipping with OpenOffice) and you will need to start OpenOffice in background mode, listening to network invocations from your client program (the exact command is given in the code sample).

This was tested on Mac OS X, with Apple’s Java 6 and StarOffice 9 Beta. Enjoy !

The same technique can be applied to programmatically generates PDF files, without buying the expensive Distiller.  This will be the subject of my next blog entry.

As usual, your comments and feebacks are welcome.

1 Comment