aspose file tools*
The moose likes Web Services and the fly likes Using @EJB with JBoss RESTEasy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Using @EJB with JBoss RESTEasy" Watch "Using @EJB with JBoss RESTEasy" New topic
Author

Using @EJB with JBoss RESTEasy

Ad Tan
Greenhorn

Joined: Oct 30, 2009
Posts: 22
Hi folks,

I was trying out JBoss RESTEasy on JBoss AS 6 (final), and surprisingly, it is easy to get my first RESTful web service up and running...

Basically with zero configuration (no web.xml), and a simple hello class, I could get it running:

Next, I attempt to inject an EJB by using the @EJB annotation. However, I receive a RuntimeException: javax.naming.NameNotFoundException : local not bound.

Using the usual lookup method got it working though.

I tested the same EJB with a servlet in the same web app, and it worked without a prob.

Anyone knows why it couldn't work with the @EJB annotation?

Thanks in advance.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Looks like a deployment ordering issue. Check this http://community.jboss.org/thread/160710

[My Blog] [JavaRanch Journal]
Ad Tan
Greenhorn

Joined: Oct 30, 2009
Posts: 22
According to the documentation, for JBoss 6 m4 and above (i'm using final). There should be no need for any configuration (ie. web.xml) for EJB and CDI to work. So why should this fail?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Ad Tan wrote:According to the documentation, for JBoss 6 m4 and above (i'm using final). There should be no need for any configuration (ie. web.xml) for EJB and CDI to work. So why should this fail?


Because it's a bug in the implementation and adding the "depends" is a workaround.
Ad Tan
Greenhorn

Joined: Oct 30, 2009
Posts: 22
Hmm... after reading up on CDI... I added beans.xml to my WAR file, and everything works, even without the "Depends" workaround.

I guess we're learning a little every day!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using @EJB with JBoss RESTEasy