questions - Question:How to deploy EJB 3.1 session bean in a war on Websphere 8.5

I also want the restful web service has the EJB 3.1's capacity.
My restful web service code as follow:

public class TagServiceRS implements Serializable{
    private static final long serialVersionUID = 5L;
    private static final Logger log = LoggerFactory.getLogger(TagServiceRS.class);

    private TagTestService tagTestService;

    @PersistenceContext(unitName = "tag-ejb")
    private EntityManager entityManager;

    public String findTagById(@PathParam("tagid") String tagid) {
       return "TAG";

     * @return the tagTestService
    public TagTestService getTagTestService() {
        return tagTestService;

     * @param tagTestService the tagTestService to set
    public void setTagTestService(TagTestService tagTestService) {
        this.tagTestService = tagTestService;

When I deploy the war on the Websphere 8.5. The TagServiceRS was successful deployed as a restful web service.And I test it. It's OK.
But the TagServiceRS was failed deploy as a EJB session bean.
The TagServiceRS's entityManager and tagTestService fields are all null.
I see the log, there is no error or warning log.
Below is my TagTestServiceBean code.

public class TagTestServiceBean implements TagTestService, Serializable {

    private static final long serialVersionUID = 5L;
    private static final Logger log = LoggerFactory.getLogger(TagTestServiceBean.class);

    public Tag testFindTagById(Long id) {"testFindTagById ++++++++++++++++++++++++++++++++++++++++ invoked for id: {}", id);
        return new Tag();


public interface TagTestService extends Serializable {

     * @param id
     *            the ID from database
     * @return a tag, may null
    Tag testFindTagById(Long id);


asked Sep 13, 2013 in Java Interview Questions by anonymous
edited Sep 12, 2013
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.