title: JBoss WebServices and EJB
body: <p>My application should show a list of stuff over RESTful WebServices.</p>
  
  <p>This list of stuff is generated via an EJB which is deployed in JBoss AS 6 in a .jar.</p>
  
  <p>My question is, how do I get this list of stuff in order to show it via Web Services?
  If I try to inject @EJB  in the stateless bean annotated with @WebService, and try to invoke the method that generates the list, <strike>I get an error saying that @EJB cannot be resolved (or imported).</strike> (fixed it, needed to modify maven dependencies). 
  Now I get a <code>NullPointerException</code> when I call the supposedly injected EJB... </p>
  
  <p>I am using the webapp archetype from Maven, which contains an EAR, a JAR and a WAR.</p>
  
  <p>I am at a total loss here, been trying to figure this for almost a week.</p>
  
  <p>Thanks in advance!</p>
  
  <p>--EDIT-- code and typo fixed</p>
  
  <p>This is my stateless bean which SHOULD be exposed as a WebService (according to:
  <a href="http://www.adam-bien.com/roller/abien/entry/restful_calculator_with_javascript_and" rel="nofollow">http://www.adam-bien.com/roller/abien/entry/restful_calculator_with_javascript_and</a> )</p>
  
  <pre><code>@Stateless
  @Path("/MyRESTApplication")
  public class HelloWorldResource {
      @EJB
      private TestBean testBean;
  
      @GET()
      @Produces("text/plain")
      public String sayHello(String name) {
          return testBean.doMoreStuff();
      }
  }
  </code></pre>
  
  <p>the <code>doMoreStuff()</code> function simply returns "HELLO!".</p>