Web.xml for jersey2 not allowing rest calls from other applications

荒凉一梦 提交于 2020-01-05 05:10:20

问题


I recently upgraded my jersey jars from version 1 to 2 . With jersey-1 my web.xml mappings were as follows

<servlet>
        <servlet-name>Restful App</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Restful App</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>

I have other applications talking to this application through rest calls. After upgrading to jersey 2 I have changed web.xml as follows

<servlet>
            <servlet-name>javax.ws.rs.core.Application</servlet-name>
       </servlet>
        <servlet-mapping>
            <servlet-name>javax.ws.rs.core.Application</servlet-name>
            <url-pattern>/rest/*</url-pattern>
        </servlet-mapping>

Normal REST calls within the application seems to work fine, but rest calls made by other applications are not hitting my application now. No error logs also.

PS: Also I am having elasticsearch configured to talk to this application, even that gives me this error elasticsearch error

来源:https://stackoverflow.com/questions/53002465/web-xml-for-jersey2-not-allowing-rest-calls-from-other-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!