-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JAX-RS integration with EJB Technology doesn't work #377
Comments
Now we have some additional information: The annotation javax.ejb.Singleton also does not work: EJB injections not work and the singleton works not as a singleton. With every request an existing @PostConstruct method is called When using CDI annotation javax.inject.Singleton instead, everything works fine. In case of error the server.log file contains a SEVERE log entry: javax.naming.NamingException: Lookup failed for 'java:app/jaxrs-ejb-1.0-SNAPSHOT/PersonResource!com.tests.jaxrs.rest.PersonResource' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: No object bound to name java:app/jaxrs-ejb-1.0-SNAPSHOT/PersonResource!com.tests.jaxrs.rest.PersonResource] |
I have the same exception like your case 3. But my webservice is in a war thats inside a ear: One other webservice with a other structure is working: |
Only on the web resources. This works on WildFly, Glassfish and WebSphere. It does not fix payara/Payara#377 or payara/Payara#394 but it is a valid workaround. @stateless web resources do not work WildFly and per https://issues.jboss.org/browse/WFLY-5072 it is not in the standard.
I've raised this with Jersey https://java.net/jira/browse/JERSEY-2938 |
Jersey pull request has been merged and is targeted for Jersey 2.22 which we will pull into Payara once released. |
Jersey 2.22 is now released. Needs pulling into master and retesting. |
PAYARA-393 upgrade Jersey to 2.22 fixes #377
Add payara-artifacts repo (Payara 4)
The Java EE 7 Tutorial describes the integration of JAX-RS with EJB Technology http://docs.oracle.com/javaee/7/tutorial/jaxrs-advanced004.htm#GKNCY
I try to use a stateless session bean as a JAX-RS root resource class:
@stateless
@path("/person")
public class PersonResource {
@ejb
private PersonServiceLocal personServiceLocal;
@path("/{id}")
@get
@produces({ APPLICATION_JSON })
public Person read(@PathParam("id") long id) {
return personServiceLocal.read(id);
}
...
}
But the injected EJB is always null.
I have tried this in 3 different environments:
works on: glassfish-3.1.2.2-b5
doesn't work on: glassfish-4.1, payara-4.1.152
We use a multi-module maven project for reproducing with:
Sources for reproducing are available under https://github.com/tweier/jaxrs-payara-failure
Steps to reproduce:
The error on glassfish-4.1 and payara-4.1.152 occures only with the ear. If I use only the war project - containing all classes - the EJB injection works on all tested application servers.
The text was updated successfully, but these errors were encountered: