Hello I am new to Tomcat development and have a question.
When I am trying to develop a REST Servlet it works under development with netbeans and tomcat 8, but when I try to create a .war file and load it to a remote tomcat via webinterface, it doesn't work.
So I just created a new Web Application in Netbeans and changed it a little bit:
@Path("test1")
public class GenericResource {
@Context
private UriInfo context;
public GenericResource() {
}
@GET
@Produces("application/xml")
public String getXml() {
return "<xml rest='cool'></xml>";
}
}
and
package test;
import java.util.Set;
import javax.ws.rs.core.Application;
@javax.ws.rs.ApplicationPath("test")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<>();
addRestResourceClasses(resources);
return resources;
}
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(test.GenericResource.class);
}
}
So when I deploy it in Netbeans it works perfectly to use
http://localhost:8080/ServerTest/test/test1
But when I create a war and develop it to remote tomcat - it only shows error 404 when I use "http://xyz.at/ServerTest/test/test1"
But why? I heard this shouldn't happen when I use servlet 3.0.
EDIT:
The index.html worked before - only the rest services (GET, POST) don't work yet.
It's funny because in netbeans it works perfectly.
I just noticed that in development I have tomcat 8.0.9 but on remote server I have 8.0.15 - does this make trouble?