Tomcat 8 should support ServletContainerInitializer.  Please read the 
3.5 documentation you linked.  It works with Jetty, so I don't know why 
it wouldn't work with Tomcat.

On 2/1/2014 5:33 AM, Kapil Gambhir wrote:
> I am using Tomcat 8.x which is a servlet 3.1 container, so the
> expectation was that the example application should not require web.xml
> (as per the documentation on
> http://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html_single/#d4e111).
> The document seems to suggest that this is required for pre 3.0 servlet
> containers.
>
> My bigger concern is that the app Path(i.e @ApplicationPath("/services")
> ) annotation in the ShoppingApplication class (which is extending the
> Application class) is ignored. So this path seems to be ignored totally
> and the URL for Customer is (/ex03_1/customers)
> <http://127.0.0.1:8080/ex03_1/customers> there is no "services" in this
> URL. Does that mean that this annotation is not useful.
>
> Kapil.
> <http://127.0.0.1:8080/ex03_1/customers>
>
> ---------- Forwarded message ----------
> From: *Weinan Li* <l.wei...@gmail.com <mailto:l.wei...@gmail.com>>
> Date: Thu, Jan 16, 2014 at 5:31 PM
> Subject: Re: [Resteasy-users] Running JAX-RS 2.0 O'Reilly book samples
> on Tomcat..
> To: Kapil Gambhir <kapil.gamb...@gmail.com <mailto:kapil.gamb...@gmail.com>>
> Cc: resteasy-users@lists.sourceforge.net
> <mailto:resteasy-users@lists.sourceforge.net>
>
>
>
>
> --
> Weinan Li
>
>
> On Thursday, January 16, 2014 at 7:00 PM, Kapil Gambhir wrote:
>
>  > Hi,
>  > thanks for a prompt response, am using the JAX-RS v2, so the
> "oreilly-jaxrs-2.0-workbook/ex03_1”.
>  > I am able to run the example with the web.xml (http://web.xml)
> changes suggested by you, it made sense also but am wondering how the
> default example (shipped as a zip) worked on jetty (which is also a
> servlet container only, pretty much like Tomcat). The examples download
> has the Maven scripts which execute the test client using the Jetty and
> that works fine without the web.xml (http://web.xml) changes. Any idea
> on this one?
>  > my objective is to use a lightweight container to keep things simple
> and fast.
>
>
> I haven’t looked into details of Jetty, but the reason could only be
> that Jetty supports JAX-RS2.0 spec out of box.
>  >
>  >
>  > On Thu, Jan 16, 2014 at 11:20 AM, Weinan Li <l.wei...@gmail.com
> <mailto:l.wei...@gmail.com> (mailto:l.wei...@gmail.com
> <mailto:l.wei...@gmail.com>)> wrote:
>  > > Hi Kapil,
>  > >
>  > > Are you using "oreilly-jaxrs-2.0-workbook/ex03_1” or
> "oreilly-workbook/ex03_1”? The former one can only be deployed in a
> JavaEE application server that supports JAX-RS 2.0 spec like WildFly,
> because it doesn’t have standalone settings in web.xml (http://web.xml).
> Please add following settings you web.xml (http://web.xml) if you want
> to deploy it in tomcat:
>  > >
>  > > <servlet>
>  > > <servlet-name>Resteasy</servlet-name>
>  > > <servlet-class>
>  > > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
>  > > </servlet-class>
>  > > <init-param>
>  > > <param-name>javax.ws.rs.Application</param-name>
>  > > <param-value>
>  > > com.restfully.shop.services.ShoppingApplication
>  > > </param-value>
>  > > </init-param>
>  > > </servlet>
>  > >
>  > > <servlet-mapping>
>  > > <servlet-name>Resteasy</servlet-name>
>  > > <url-pattern>/*</url-pattern>
>  > > </servlet-mapping>
>  > >
>  > >
>  > >
>  > > In addition, if ex03_1.war is deployed into tomcat correctly you
> should see the following log in catalina.out:
>  > >
>  > > resteasy.spi.ResteasyDeployment. Deploying
> javax.ws.rs.core.Application: class
> com.restfully.shop.services.ShoppingApplication
>  > > 16-Jan-2014 13:37:17.219 INFO [localhost-startStop-2]
> org.jboss.resteasy.spi.ResteasyDeployment. Adding singleton resource
> com.restfully.shop.services.CustomerResource from Application class
> com.restfully.shop.services.ShoppingApplication
>  > >
>  > >
>  > > And then you can access it by http://127.0.0.1:8080/ex03_1/customers
>  > >
>  > > --
>  > > Weinan Li
>  > >
>  > >
>  > > On Thursday, January 16, 2014 at 1:16 AM, Kapil Gambhir wrote:
>  > >
>  > > > am trying to run the samples from the O'Reilly book (by Bill
> Burke) on Tomcat. Tried both for Tomcat 7 and 8. The ShoppingApplication
> deploys fine but when i try to POST a customer resource to
> /services/customers it gives me 404.
>  > > > I built the war from the Maven for Chapter 3 example (ex03_1) and
> deployed that war on Tomcat and the deployment (Tomcat startup console)
> shows messages of ShoppingApplication being deployed. What am i missing,
> dont see any error message or any clue around what could be going wrong.
>  > > >
>  > > > Thanks in anticipation,
>  > > > Kapil.
>  > > >
> ------------------------------------------------------------------------------
>  > > > CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>  > > > Learn Why More Businesses Are Choosing CenturyLink Cloud For
>  > > > Critical Workloads, Development Environments & Everything In Between.
>  > > > Get a Quote or Start a Free Trial Today.
>  > > >
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>  > > >
>  > > > _______________________________________________
>  > > > Resteasy-users mailing list
>  > > > Resteasy-users@lists.sourceforge.net
> <mailto:Resteasy-users@lists.sourceforge.net>
> (mailto:Resteasy-users@lists.sourceforge.net
> <mailto:Resteasy-users@lists.sourceforge.net>)
> (mailto:Resteasy-users@lists.sourceforge.net
> <mailto:Resteasy-users@lists.sourceforge.net>)
>  > > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
>  > >
>  >
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to