5 Replies Latest reply on Mar 31, 2011 11:39 AM by Nick Scavelli

    Deployment of GateIn REST services

    Jacek Bukowski Newbie


      I searched throught the forum, but everywhere there is a recommendation to deploy the REST services as jar file and put it somwhere to be available on classpath. I would prefer to have my REST services deployed in the ear, together with other my application stuff. Is it possible?

      I have added following jar:











      to my EAR, and then added entry in application.xml:








      But the REST service is not available. What am I doing wrong? Or maybe it is not possible to deploy REST service this way?

        • 1. Deployment of GateIn REST services
          Giovanni Marigi Newbie

          I tried to deploy a rest service either in a .war archive or in .ear archive. It deploys but the rest service is not registered. The only chance to get it working is to create a .jar archive as you did; I put it in gatein.ear/lib.


          Someone did it in a war archive?




          • 2. Deployment of GateIn REST services
            Minh Hoang TO Novice

            Could you post the configuration and code (annotation part) of your REST service?

            • 3. Deployment of GateIn REST services
              Trong Tran Master

              You could try by configure your war/ear as a portal extension, this only ensures that configuration in your war/ear will be read by Portal Container. BUT i'm not sure if it work totally, i didn't try it though :-)

              • 4. Re: Deployment of GateIn REST services
                Jacek Bukowski Newbie

                Thank you all for the replies.


                @Giovanni, I do also have a feeling that it only works as jar file deployed either to lib directory of the serwer or gatein.ear/lib.


                My configuration.xml in jar with REST service is very simple:





                   xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"










                The REST service is also a sample one:



                @Path( "HelloWorldRest" )

                public class HelloWorldRest implements ResourceContainer {



                    @Path( "/ejbtest" )

                    public Response ejbTest( @Context SecurityContext sc ) {

                        String test = "ERROR";


                            javax.naming.Context context = new InitialContext();

                            TestServiceRemote testService = (TestServiceRemote)context.lookup( "app/TestServiceBean/remote" );

                            test = testService.getTest();

                        }catch( NamingException e ){



                        return Response


                                "Got from test service: " + test + "<br/>"

                                    + "This method is permitted for all authenticated users, caller principal "

                                    + sc.getUserPrincipal() ).header( HttpHeaders.CACHE_CONTROL, CC ).build();





                I tried to deploy it in EAR with my application, as well as in another EAR, where I have only portal (new portal, pages, users, etc.) configuration (I mean it works as portal extension). The deployment succedded, all other stuff worked but REST service was not accessible.

                • 5. Re: Deployment of GateIn REST services
                  Nick Scavelli Novice

                  You can definitely deploy your rest service in an ear file, however pretty sure it needs to be part of an extension like Trong mentioned. 


                  One thing I would do is put a System.out.println in a default constructor of your HelloWorldRest class to see if the container is picking up your class.  If not then there's a classpath issue and the container is not seeing it.  If it is then there's an issue with your rest service or the path you are trying to access it.


                  Try something even simpler:



                  @Path( "HelloWorldRest" )
                  public class HelloWorldRest implements ResourceContainer {
                     public String helloWorld()
                        return "Hello World !";


                  and see what you get by going to http://localhost:8080/rest/HelloWorldRest