I'm with this test project named CLAWS-Dicionario, and I'm trying to run it on Glassfish server (which is working flawlessly). All I have is that class:
package com.k19.restful.resources; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @Path("/helloworld") public class HelloWorldResource { @GET @Produces("text/plain") public String showHelloWorld() { return "Olá mundo!"; } } And this add at web.xml in order to incorporate Jersey to it
<servlet> <servlet-name>Jersey REST Service</servlet-name> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.k19.restful.resources</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Jersey REST Service</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> I've also added the following jersey libraries to my build-path:
asm-debug-all-5.0.3.jar javax.ws.rs-api-2.0.1.jar jersey-server.jar org.osgi.core-4.2.0 So I run the project, and everything feels fine. But when I try to access this URL:
http://localhost:8080/CLAWS-Dicionario/helloworld It returns a 404 error. I'm sure the host is congured at 8080 port (the URL localhost:8080 works just fine). So what is the problem?
EDIT: The server began to present another problems, which took me to that line of the domain.xml file:
<application context-root="/CLAWS_-_Dicionário" object-type="user" name="CLAWS-Dicionario" directory-deployed="true" location="${com.sun.aas.instanceRootURI}/eclipseApps/CLAWS-Dicionario/"> Repare the CLAWS_-_Dicionário part. Would this be the real name of my project? I had to remove the accent in order the server to work, and I'm finding no more console response when running the project...and even if I try the URL http://localhost:8080/CLAWS_-_Dicionario/helloworld, the error is still there,so...just found it something important to point.