-
1. Re: JAX-RS Sub-resource Locator Issue from AS7 to Wildfly 8.1
jaikiran Jul 25, 2014 10:30 AM (in response to scrublet)That's a wrong use of *stateless* EJBs. You can't expect the state to be maintained in a stateless bean between business method invocations.
To fix this, what you need to do is:
1) Mark your initialize() method in the @Stateless bean with a @PostConstruct so that the EJB container will call it whenever a new instance of the bean is created:
@Stateless public class ThirdLayerResource { private SomeObject someObject; @PostConstruct public void initialize() { ... }
2) Do *not* explicitly call the initialize method. So remove the call to that method from your SecondLayerResource.getThirdLayer() method
-
2. Re: JAX-RS Sub-resource Locator Issue from AS7 to Wildfly 8.1
scrublet Aug 12, 2014 12:39 PM (in response to jaikiran)That was a stupid mistake on my part. The root of this mistake, and the reason I'm even using the EJBs to begin with, is an issue I'm having with trying to use ResourceContext.initResource in the subresource locator and THAT not working properly. But I'm redoing some architecture with the resources now anyways, and if that problem persists when I'm done I'll create a separate post specifically for ResourceContext rather than keep this post going.
Thanks!