]
jaikiran pai commented on JBAS-7980:
------------------------------------
This looks similar to an issue we discussed with a user on #jboss IRC recently. Here's
what he found out
Dependency Injection inconsistent with EJB3.1/JAX-RS
----------------------------------------------------
Key: JBAS-7980
URL:
https://jira.jboss.org/browse/JBAS-7980
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EJB3
Affects Versions: 6.0.0.M2, 6.0.0.M3
Environment: Redhat Linux 4.1.2-41
Reporter: Jon Kennedy
Assignee: Carlo de Wolf
I'm making use of the recent EJB3.1 support in JBoss6M2 to deploy a stateless session
bean within a war. This bean also implements a JAX-RS annotated interface and is called as
a web service.
The session bean uses dependency injection to get a JPA EntityManager and the EJB
SessionContext:
@Resource
private SessionContext context;
@PersistenceContext(unitName="drs2_services")
private EntityManager em;
The problem is that calling my service sometimes fails with a NullPointerException where
I make use of the EntityManager or the SessionContext. This behavior is inconsistent and
sometimes works.
To add more detail:
If I call the service and I get a NullPointerException on the EntityManager, I can work
around the issue by restarting the service until the call succeeds. After it succeeds
once, I won't see the NullPointerException again (until, perhaps, I restart the JBoss
again).
The SessionContext issue is a little trickier. I am able to call my webservice from the
browser successfully, but when using Java's HttpUrlConnection class, I consistently
get a NullPointerException on the SessionContext.
I followed the RestEasy 1.2 guide for configuring and annotating my project, specifically
chapter 38 "EJB Integration." I didn't bundle the ReastEasy jars in my war
since they are bundled with JBoss 6.
Any help is appreciated, I'm happy to provide more details/code if desired.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: