1 Reply Latest reply on Jun 19, 2008 5:10 PM by Jay Balunas

    Hot Deployment, EntityManager and RESTeasy problem

    David Knaus Newbie

      Hello,


      I'm trying to get RESTeasy to work with Seam, but I'm a bit lost...


      My project is using seam components, no EJBs. So all my action classes go to WEB-INF/dev and therefore are not visible for classes deployed outside, because of the custom seam class loader, right?


      So when I want to use a Seam and JAX-RS annotated action class (@NAME, @PATH at Class, and @GET at method) with RESTeasy, it fails to find it, because it scans in WEB-INF/classes by default. Even when I configure RESTeasy with context param resteasy.resources including the fully qualified class name, I get a ClassNotFoundException.


      Ok, then I tried to put the action class in model directory, changed package name and corresponding resteasy.resources param. Now RESTeasy finds the class and tries to process the @GET marked action method, but it fails with an NPE when using the injected EntityManager. I guess there is no DI happening? But I want to load the RESTeasy/JAXB annotated entity...


      So, the questions are:


      Is there a way for RESTeasy to load seam components in WEB-INF/dev?


      If not, can I use the @In Annotation for the EntityManager to get access to seam managed persistence context in RESTeasy?


      All the examples I found are using EJB/Seam components, not regular seam beans. Anyone got this to work? Thanks for any pointers...


        • 1. Re: Hot Deployment, EntityManager and RESTeasy problem
          Jay Balunas Novice

          To answer you questions:



          Is there a way for RESTeasy to load seam components in WEB-INF/dev?


          • Not sure about resteasy settings, but you can make Seam not deploy to the WEB-INF/dev directory and instead use /classes.




          If not, can I use the @In Annotation for the EntityManager to get access to seam managed persistence context in RESTeasy?


          • If it is a seam component then yes - you should be able to inject it, but as Bill Burke said you should be able to do it just using EJB annotations if you don't need it to be a seam component.




          All the examples I found are using EJB/Seam components, not regular seam beans.


          • Do you mean seam examples? - if so the JPA example does not use EJB's, and neither does a seam-gen WAR project.