I just read the Jax-rs spec  version 1.1and was reading Section 6.2 where it 
talked about additional support to be provided by the EE container.   This 
prompted me to try to turn one of our Stateless sessionbeans into a resource 
code, to see that works.

Using resteasy 1.1.GA, with JBoss 4.2.3.GA

I have an ejb that starts like this;

public class PposTerminalServiceBean extends AbstractService implements 
PposTerminalService, PposTerminalServiceLocal {
        public PposTerminalBean findByPrimaryKey(@PathParam("id") long id) 
throws FinderException
                return (PposTerminalBean) 
super.findByPrimaryKey(PposTerminalBean.class, new Long(id));


This bean extends from AbstractService, which contains a resource injection for 
one of its fields:

@Resource  protected SessionContext context;

The problem is that I am getting a NullPointerException  because the 
SessionContext field is not getting set when I submit a rest request to the 
corresponding  path for this EJB.  I have debugged thru our code and we handle 
the restful part and I can use the ejb to read the class, but when we attempt 
to close our session (which uses Hibernate 3), we get the null pointer because 
we are referencing the SessionContext object and it is null -  because it was 
not injected.

Should this work?   Am I doing something wrong?

Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
Resteasy-users mailing list

Reply via email to