问题
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