SpringFox Swagger无法在IBM Liberty 19.0.0.1上正常工作

时间:2019-03-09 06:18:15

标签: spring-boot swagger swagger-ui websphere-liberty springfox

附在下面(Tomcat上的Swagger)(单击放大)-Tomcat 9上我的应用程序的Swagger UI enter image description here

附加(在Liberty上为Swagger)(单击放大)-我的应用程序在Liberty 19.0.0.1上的Swagger UI enter image description here

在Tomcat中,可以清楚地显示200响应正文,并且“ Try it out”选项的执行是完美的。

但是,在Liberty中,未显示200响应正文,并且执行“尝试一下”会导致响应正文中填充以下错误(已截断):

<H1>Error Page Exception</H1>
<H4>SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.</H4>
<BR><H3>Original Exception: </H3>
<B>Error Message: </B>Unauthorized<BR>
<B>Error Code: </B>401<BR>
<B>Target Servlet: </B>dispatcherServlet<BR>
<B>Error Stack: </B><BR>
com.ibm.ws.webcontainer.webapp.WebAppErrorReport: Unauthorized

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:630)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:648)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1328)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:164)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:164)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at org.springframework.security.web.util.OnCommittedResponseWrapper.sendError(OnCommittedResponseWrapper.java:119)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint.commence(BasicAuthenticationEntryPoint.java:61)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint.commence(DelegatingAuthenticationEntryPoint.java:95)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at org.springframework.security.web.access.ExceptionTranslationFilter.sendStartAuthentication(ExceptionTranslationFilter.java:213)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at org.springframework.security.web.access.ExceptionTranslationFilter.handleSpringSecurityException(ExceptionTranslationFilter.java:185)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:141)

<BR>&nbsp;&nbsp;&nbsp;&nbsp;
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
...
...
more

与此同时,Liberty控制台出现以下错误(滚动至装备以获取更多信息):

Error reported: 406

[ERROR   ] Error Page Exception:
                                                                                                               0-0

                                                                                                               Error Page Exception
                                                                                                               com.ibm.ws.webcontainer.webapp.WebAppErrorReport: SRVE0295E

我的Liberty的server.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>webProfile-8.0</feature>
        <feature>springBoot-2.0</feature>
        <feature>servlet-4.0</feature>
    </featureManager>

    <basicRegistry/>

    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint id="defaultHttpEndpoint"
                  httpPort="9090"
                  httpsPort="9443" />

    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true"/>

</server>

我的应用程序使用Java 8,带有Spring Integration,Spring Security,Spring Security,Spring REST Docs,Springfox 3.0.0-SNAPSHOT和Log4j 2的Spring Boot(2.1.3)。

有人可以帮助指出Liberty无法显示Swagger响应或提供“试用”功能的根本原因吗?就像我说的一样,同样可以在Tomcat 9上正常运行。

此致, 巴拉斯

0 个答案:

没有答案