Monday, February 2, 2009

Seam From a Command Line

I recently wanted to access some seam derived functionality from a command line java program (something that I could run via cron). I ran into a few minor problems and thought I'd share their solutions.

The first problem was that seam annotations like @Logger won't work. I guess it isn’t that surprising, but the jboss seam annotations are unavailable to a command line program (at least not easily) since the portions of the framework that enables these annotations are designed to operate within a server.

This was disappointing. The @Logger annotation is really useful, but I couldn't come up with a way to get it going.

This pushed me into wanting to use web services as much as possible to take advantage of other annotations that I had built into my system, e.g., the ability to automatically stamp an object with time modified and time created to support temporal data operations.

I did not find the seam documentation about accessing seam web services particularly clear (especially when using netbeans) so I turned to the netbeans tutorial and was quickly up and running with the seambay example.

Note:
    The WSDL for the seambay example is found at (assuming your server is local and you have deployed the seambay example) http://localhost:8080/jboss-seam-bay-jboss-seam-bay/AuctionService?wsdl

    An overview of all services at the host (again, assuming your server is local) appears at
    http://localhost:8080/jbossws/services.

No comments: