0

I have RestApplication class:

@ApplicationPath("/orcr")
public class RestApplication extends Application {

    @Override
    public Map<String, Object> getProperties() {
        Map<String, Object> properties = new HashMap<>();
        properties.put("jersey.config.server.disableMoxyJson", true);
        properties.put("jersey.config.disableMoxyJson", true);

        return properties;
    }

And some resource:

@Slf4j
@Stateless
@Path("/unhold")
public class UnholdResource {

    @GET
    @Path("/test")
    public Response test() {
        return Response.ok("cool").build();
    }
}

i deploy it on my local glassfish4. Some logs:

org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer > Registering the Jersey servlet application, named lv.lpb.rest.RestApplication, at the servlet mapping /orcr/ *, with the Application class of the same name.
javax.enterprise.web > Loading application [orcr-unholder] at [/orcr-unholder-r75.6944126]
javax.enterprise.system.core > orcr-unholder was successfully deployed in 4,222 milliseconds.

But if i try ant of urls like:

localhost:8081/orcr-unholder/orcr/unhold/test

localhost:8081/orcr-unholder/orcr/unhold

localhost:8081/orcr-unholder/orcr

localhost:8081/orcr/unhold/test

localhost:8081/orcr/unhold

it`s always 404 Not Found

localhost:8081 - server is running

So, what can it be?


Solved

right url was: localhost:8081/orcr-unholder-r75.6944126/orcr/unhold/test

VitBuk
  • 19
  • 2
  • Ain't it necessary to register all your resource classes in your sub-application classes overriding getClasses() method ? try adding `public Set> getClasses() { return new HashSet>(Arrays.asList(UnholdResource .class)); }` in your `RestApplication ` class – Jimmy Jun 08 '16 at 15:52
  • 1
    The log message says the application is deployed in context "/orcr-unholder-r75.6944126". – unwichtich Jun 08 '16 at 16:03
  • @unwichtich thanks! that helps – VitBuk Jun 09 '16 at 07:35
  • @unwichtich how can i not mention project name and version in url, btw? – VitBuk Jun 09 '16 at 07:45
  • I guess this depends on your IDE and how it deploys the application on Glassfish. Normally the project name is used as URL context root if not configured otherwise. – unwichtich Jun 09 '16 at 08:06
  • @unwichtich i use netbeans as IDE. Gradle task to deploy my .war How can i config path to not use app context in URL? – VitBuk Jun 09 '16 at 11:03

0 Answers0