Errai JAX-RS Rest service returns 404 Not found

132 views Asked by At

I've followed instruction that was here: http://docs.jboss.org/errai/latest/errai/reference/html_single/#sid-19398997

Unfortunatelly I can not make this work. Here is my service interface:

package pl.korbeldaniel.erpe.shared.rest.api;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("anonymous/fileService/get/MenuService")
public interface MenuService {
    @GET
    @Produces("application/json")
    public List<String> getMenuEntries();
}

And server implementation:

package pl.korbeldaniel.erpe.server.rest.api;

import java.util.ArrayList;
import java.util.List;

import pl.korbeldaniel.erpe.shared.rest.api.MenuService;

public class MenuServiceImpl implements MenuService {
    @Override
    public List<String> getMenuEntries() {
        List<String> customers = new ArrayList<String>();
        for (int i = 0; i < 11; i++) {
            customers.add("Menu entry " + i);
        }
        return customers;
    }
}

Running such service return 404 not found. And I don't know why. After changing server implementation so Spring Rest controller it works grate, so I don't understand, what is wrong.

I've already added to pom.xml's dedicated libraries. I've already added to module.gwt.xml dedicated inheritances.

I am out of options now. One think that I consider as a source of problem, is web.xml, but there was no world about it in official docs.

Currently I don't have any web.xml file cause I use Java configuration, but I don't see that to be a problem. Please help.


Edit

Here is my Java Configuration for spring (used instead of web.xml) based on f.e.: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/WebApplicationInitializer.html

src:

package pl.korbeldaniel.erpe.server.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

import pl.korbeldaniel.erpe.server.config.security.SecurityConfig;
import pl.korbeldaniel.erpe.shared.ServerRouting;

public class WebServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
    return new Class<?>[] { SecurityConfig.class };
    }
    @Override
    protected Class<?>[] getServletConfigClasses() {
    return new Class<?>[] { WebConfig.class };
    }
    @Override
    protected String[] getServletMappings() {
    return new String[] { ServerRouting.SPRING_WEB_SERVLET_INITIALIZER_URL };
    }
}

package pl.korbeldaniel.erpe.server.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@EnableWebMvc
@ComponentScan(basePackages = "pl.korbeldaniel.erpe.server")
public class WebConfig extends WebMvcConfigurerAdapter {
}

This is my gwt module configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<module>
<inherits name="com.google.gwt.user.User"/>
    <inherits name="gwt.material.design.GwtMaterialWithJQueryDebug" />
    <inherits name="gwt.material.design.themes.ThemeBlue" />
    <inherits name="gwt.material.design.addins.GwtMaterialAddins" />
    <inherits name="gwt.material.design.GwtMaterialTableDebug" />
    <inherits name="org.jboss.errai.enterprise.All" />
    <inherits name="org.jboss.errai.enterprise.Jaxrs"/>
    <inherits name="org.jboss.errai.ioc.Container" />
    <inherits name='org.jboss.errai.bus.ErraiBus' />

    <set-property name="gwt.logging.enabled" value="TRUE" />
    <set-property name="gwt.logging.consoleHandler" value="ENABLED" />
    <set-property name="gwt.logging.logLevel" value="INFO" />
    <source path="" />

    <set-property name="user.agent" value="safari" />
</module>
0

There are 0 answers