views:

109

answers:

1

I have been trying to get Resteasy to work (and not it dose). However I now have another headache with accessing the EJB:s. I have tried injecting them, looking them up with jndi and most other solutions but none of them works.

I get massages like: java.lang.RuntimeException: Class is not a root resource.

Or: java.lang.IllegalArgumentException: Wrong target.

Or just: NullPointer

Using JBoss 5.1.0.GA and Resteasy 1.2.1.GA... Can't find any documentation on how this could be done. Do anybody know?

A: 

Have you seen this: EJB Integration?

Resteasy currently only has simple integration with EJBs. To make an EJB a JAX-RS resource, you must annotate an SLSB's @Remote or @Local interface with JAX-RS annotations:

Next, in RESTeasy's web.xml file you must manually register the EJB with RESTeasy using the resteasy.jndi.resources

volothamp
Yes, this much I have understood but it dosen't help me. I do not want to make my EJB:s restful. I would like to access my EJB:s from a restful pojo/servlet. Mixing the ejb-layer with the web-layer (which I would say that rest is) would be bad design.So I refrase my question, is it possible to access the ejb:s from a restful bean in the web-layer?
Peter Eriksson
Anyway it should be possible to get the EJB through JNDI like this: InitialContext ctx = new InitialContext(); ejbLocal = (EJBeanLocal) ctx.lookup("deployed-ear/EJBean/local");However this gives me: java.lang.IllegalArgumentException: Wrong target.
Peter Eriksson