RestEasy Deployment problem
maxsap Oct 30, 2011 2:06 PMHello all, I dont really know if this is the correct plase to post this, but since I was not allowed to post to the RestEasy forum this is the closest I could.
I am new to REstEasy and I much confused about the configurations needed and how to get started.
I have a Jersey project that I would like to port to RestEasy, after some reading I managed to create the web.xml and get some results (Using AS7 in localhost).
When I tried to deploy the example in a remote server (used the eclipse and when that faild simply copied the .war file to the server) I was got this:
15:15:40,761 INFO [org.jboss.weld] (MSC service thread 1-2) Starting weld service 15:15:40,908 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/feelzer] startup failed due to previous errors: java.lang.IllegalArgumentException: Duplicate context initialization parameter resteasy.injector.factory at org.apache.catalina.core.StandardContext.addParameter(StandardContext.java:2162) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.jboss.as.web.deployment.JBossContextConfig.processWebMetaData(JBossContextConfig.java:294) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.jboss.as.web.deployment.JBossContextConfig.applicationWebConfig(JBossContextConfig.java:167) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:417) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:182) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.jboss.as.web.deployment.JBossContextConfig.lifecycleEvent(JBossContextConfig.java:160) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3766) [jbossweb-7.0.1.Final.jar:7.0.2.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0_01] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0_01] at java.lang.Thread.run(Thread.java:722) [:1.7.0_01] 15:15:40,910 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/feelzer] startup failed due to previous errors
Since then I searched the web in order to find more info and found this: http://www.mastertheboss.com/web-interfaces/273-resteasy-tutorial-.html
If I understand correctly RestEasy comes bundled with AS, with that in mind, to create a new rest application we only need to add
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> </web-app>
in our Web.xml file and the rest are handled by the AS it self, no need to specify the ResteasyBootstrap listener and the HttpServletDispatcher servlet and only need the POJO with the correct annotations that will be peekedup bu the server correct?
When I tried that I keeped getting 404 errors.
Also please note that even thought I have changed the Web.xml and placed the above mentioned in the xml file, the 404 continued.
My POJO is named HelloWorld and the project is named RestEasy (Taken from the link provided above in order to use the correct path).
Also I have tried to remove the jar files from the projects lib folder because I have read that the server already bundles them and thought that this could be the root of the problem.
So I have three questions:
- Why I can deploy the example locally and get it to work and when I try to deploy on a remote server with the same configurations I am getting that error?
- What are the needed configurations to get the RestEasy on a project, (do I need the servlet mapping, Do I have to add the external jars or those comes bundled e.t.c.)
- And finnaly why even though I managed to deploy the example from that site I kept on getting 404 errors?
Thanks in advanced and sorry for the length of my question but I think those questions will help a lot newcomers as my self, best regards maxsap.