Application not starting -RestAPIServletInitializer.init

Been a while since I have played with Cuba.

For some reason my project will not start. Have attached log:

app.log (12.7 KB)

Hello @daryn,

Now the Rest API is a separate add-on, and in itself, it already contains all the settings. To solve the problem, you must remove the lines associated with the Rest API from the web.xml module web.

Delete the lines below:

<servlet>
    <servlet-name>rest_api</servlet-name>
    <servlet-class>com.haulmont.restapi.sys.CubaRestApiServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>rest_api</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>restSpringSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    <init-param>
        <param-name>contextAttribute</param-name>
        <param-value>org.springframework.web.servlet.FrameworkServlet.CONTEXT.rest_api</param-value>
    </init-param>
    <init-param>
        <param-name>targetBeanName</param-name>
        <param-value>springSecurityFilterChain</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>restSpringSecurityFilterChain</filter-name>
    <url-pattern>/rest/*</url-pattern>
</filter-mapping>

And check that the connected add-on is specified in the web.xml of the core and web module

<context-param>
    <param-name>appComponents</param-name>
    <param-value>
        com.haulmont.cuba
        com.haulmont.addon.restapi
    </param-value>
</context-param>

Regards,
Nikita

1 Like

Ok great,

Thanks Nikita - did the trick.

A good idea to have the rest api optional.

Cheers,
Daryn