Take the 2-minute tour ×

I may be being naive here, but my assumption was that with EJB 3, just marking a class as @Stateful is now all that is required to make it a stateful session bean.

My question: can I deploy it as is, and if so how? Or do I still need to package it up in an EAR. I would like to think that the annotation is sufficient, but I may be being over-optimistic.

Thanks in advance for any help.

share|improve this question
It does not need be an EAR. It can be a JAR too. –  Bhesh Gurung Jun 10 '12 at 14:49
add comment

2 Answers

annotation is as good as detailing out the beans in the XML file. It should still be packed in a jar file which would go in a EAR. Annotation is just a substitution of the XML configuration files.

share|improve this answer
add comment

Well to create a EJB 3 you need two things:

1- Create an interface where you declare methods 2- Create a class that implements that interface

If you want to use annotation you have to annotate the interface using @Remote or @Local and the class has to be annotated using @Stateful.

You can deploy your EJBs as EAR or simply as JAR it depends on if you have a web component part then you might consider to use an EAR if you have simply EJBs you can simply use a JAR.

I guess you already considered the fact that Stateful Session Bean are less scalable compared to SLSB. So they have to be used carefully.

Hope this help you

share|improve this answer
add comment

Your Answer


