This is a bare- bones Jboss tutorial

What will you need ?

jboss (obviously duh !!!) You can download from here (I used Jboss 4.0.5 GA )

And ANT to compile,build  and deploy

And 20 minutes of your time

What will we achieve ?

A quick on its feet Jboss tutorial which uses a stateless session bean to say hello to you


You are running your JBoss server on the default port number 1099.

This example was tested on windows XP platform- but should really work elsewhere as well.

Getting Started

Step 1: Download from here.

Step 2: Unzip the file to your file system. Lets say C:\JBossOne

Step 3: Start your JBoss server

Step 4: Open a  command prompt and then Go to the folder C:\JBossOne

Step 5: Edit and change the jboss.home to confirm to your deployment.

Step 6: Compile, Build the application- by giving the command ant package-ejb

Step 7: Deploy the application by giving the command ant deploy

Step 8: Confirm that the bean has been deployed correctly. It should give something like this on the jboss prompt

18:29:20,359 INFO  [EjbModule] Deploying HelloWorldBean
18:29:20,437 INFO  [ProxyFactory] Bound EJB Home ‘HelloWorldBean’ to jndi ‘Hello
18:29:20,437 INFO  [EJBDeployer] Deployed: file:/C:/jboss_4_0_5/server/default/t
18:29:20,484 INFO  [EARDeployer] Started J2EE application: file:/C:/jboss_4_0_5/

Step 9:Open a new command prompt and then Go to the folder C:\JBossOne

Step 10: Test your application by giving the command ant tests. You should see something like this

C:\Work\MyLabs\JBossOne>ant tests
Buildfile: build.xml

[junit] Running com.rajivnarula.tutorial.jboss.test.HelloWorldTests
[junit] Testsuite: com.rajivnarula.tutorial.jboss.test.HelloWorldTests
[junit] hey
[junit] log4j:WARN No appenders could be found for logger (org.jboss.securit
[junit] log4j:WARN Please initialize the log4j system properly.
[junit] Hello Boss
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 2.235 sec
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 2.235 sec
[junit] ————- Standard Output —————
[junit] hey
[junit] Hello Boss
[junit] ————- —————- —————
[junit] ————- Standard Error —————–
[junit] log4j:WARN No appenders could be found for logger (org.jboss.securit
[junit] log4j:WARN Please initialize the log4j system properly.
[junit] ————- —————- —————


Voila !!!. That’s it

If you have trouble downlaoding or get error on running it- please leave a note here and I shall try to help you resolve it.


About the author

I came across this book by Mark Richards- Java Transaction Design Strategies. For those who are not from Boston area- mark is a much familiar face in the NEJUG meetings- ever second Thursday. He served as the President for quite some time.

The book:

The book is about Transactions- in java applications- using EJB or Spring

Mark has done a good job of drawing a distinction between Transaction Models vs Transaction Strategies. Transaction Model is how you declare your transactions. Transaction strategy on the other hand is putting together a strategy on where to put transactions and who is responsible for what.

Throughout the book- he draw examples and contrasts Spring and EJB.

Code examples are minimal- its more of easy to read and grasp language. I personally do not like books with lots of code- so this went well with me. This book has been deliberately written in a concise manner – which it makes it easy to read and finish

The book is divided in two parts. The first part introduces the three Transaction Models- Local Transaction Model, Programmatic Model, Declarative Model. It also provides a recap of common transaction related terms- JTA ,JTS, ACID, Isolation levels,XA transactions, Two phase commit,Heuristic Transactions, LPS

Second Part discusses three design patterns- Client Owner Transaction Design pattern, Domain Service Owner Transaction Design Pattern,Server Delegate Owner Transaction Design Pattern.

Best Practices suggested in this book:

In declarative transactions: Make the class level transaction- most restrictive , and then fine tune for individual methods as needed

The method that starts the transaction- should be the one to commit or rollback

If a method requires a transaction context – but is not responsible for  marking it as rollback- then it should have an attribute of  Mandatory

Use XA only of you have multiple resources participating – in tech same transaction context

I enjoyed reading the book and would recommend to anyone- seeking a quick and clean introduction to Transactions with a touch of Java and Spring

You can get the book from here


The J in Java is James- James Gosling…

I stumbled across a presentation by James Gosling on Java spec.

And of course I had to hear it. This is the first time I have heard him speak. He talked a bit about himself- his experiences before he started on Java and how the design of Java was constrained.

One thing that struck me the most was – he had both his feet firmly on the ground.

JAVA  is one of the most amazing things to have happened to Software and Internet. It came in when MicroSoft had a neck-breaking grip hold on the Software industry. It has had one of the most successfull acceptance rate among all langauges . And it has stood the most vital test- test of time.  13 years and still going strong.

Though I haven’t worked on the newer technologies- RoR ,Grails and so on- but I doubt if any of these will get the same acceptance rate as Java did.

However, I do feel bad that Sun – even though having made such a successful product is facing hard times. But then to make a wonderful product is  very different thing from being able to form the perfect marketing strategy around it. An example of that is of course Google !!!

© 2011 Technology Cafe Suffusion theme by Sayontan Sinha