Jersey 2 with Guice 4 on Glassfish 4.1

335 views Asked by At

Deploying REST service on Glassfish 4.1 using Jersey 2, Guice 4, and Jersey2-guice glue provides 404 error.

Source code is based on HK2Linker

@Inject
public HK2Linker(Injector injector, ServiceLocator locator) {
    BootstrapUtils.link(locator, injector);
    BootstrapUtils.install(locator);
}

and JerseyModule

protected void configureServlets() {
    final ServiceLocator locator = BootstrapUtils.newServiceLocator();
    install(new BootstrapModule(locator));
    bind(HK2Linker.class).asEagerSingleton();

    serve("/*").with(ServletContainer.class);
}

There is no declaration in "web.xml".

REST services are provided using this code

protected void configure() {
    bind(MyRest1.class);
    bind(MyRest2.class);
}

Is there something missing ?

0

There are 0 answers