running-elephant / datart

Datart is a next generation Data Visualization Open Platform
https://running-elephant.github.io/datart-docs/
Apache License 2.0
1.98k stars 590 forks source link

context-path支持 #1011

Closed Simbafa closed 2 years ago

Simbafa commented 2 years ago

Datart Version 1.0.0-beta.2

To Reproduce 修改:config/datart.config, 增加了 server.servlet.context-path=/springdemo 访问:http://host:8080/springdemo 抛出异常:java.lang.StackOverflowError

Expected behavior 访问的路径上,增加context-path

Screenshots If applicable, add screenshots to help explain your problem.

Environmental details: (optional, depending on where the bug occurs)

Additional context

    77 2022-03-16 05:18:28.027 INFO  s.d.s.w.PropertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]
    78 2022-03-16 05:18:28.142 INFO  o.s.b.a.s.s.UserDetailsServiceAutoConfiguration :
    79 
    80 Using generated security password: 23546b2b-e90f-42c3-8cb8-40d20176c776
    81                                                                                                                                                                                                                                                                        
    82 2022-03-16 05:18:28.210 INFO  o.s.security.web.DefaultSecurityFilterChain : Will secure Ant [pattern='/api/v1/tpa'] with []
    83 2022-03-16 05:18:28.265 INFO  o.s.security.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@5487a8f1, org.springframework.security.web.context.SecurityContextPer       sistenceFilter@7474196, org.springframework.security.web.header.HeaderWriterFilter@7affee54, org.springframework.security.web.authentication.logout.LogoutFilter@62410e1f, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@18209303, org.springfr       amework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7bd694a5, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3e5c7588, org.springframework.security.web.session.SessionManagementFilter@147059f8, org.springframewor       k.security.web.access.ExceptionTranslationFilter@652a1a17]
    84 2022-03-16 05:18:28.615 INFO  o.s.scheduling.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
    85 2022-03-16 05:18:28.699 INFO  o.s.b.a.web.servlet.WelcomePageHandlerMapping : Adding welcome page: ServletContext resource [/index.html]
    86 2022-03-16 05:18:29.295 INFO  o.s.ldap.core.support.AbstractContextSource : Property 'userDn' not set - anonymous context will be used for read-write operations
    87 2022-03-16 05:18:29.404 INFO  org.apache.coyote.http11.Http11NioProtocol : Starting ProtocolHandler ["http-nio-0.0.0.0-8080"]
    88 2022-03-16 05:18:29.428 INFO  o.s.boot.web.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/springdemo'
    89 2022-03-16 05:18:29.430 INFO  s.d.s.web.plugins.DocumentationPluginsBootstrapper : Context refreshed
    90 2022-03-16 05:18:29.452 INFO  s.d.s.web.plugins.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
    91 2022-03-16 05:18:29.702 INFO  s.d.spring.web.scanners.ApiListingReferenceScanner : Scanning for api listing references
    92 2022-03-16 05:18:29.895 INFO  o.a.c.c.C.[Tomcat].[localhost].[/springdemo] : Initializing Spring DispatcherServlet 'dispatcherServlet'
    93 2022-03-16 05:18:29.896 INFO  org.springframework.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
    94 2022-03-16 05:18:29.899 INFO  org.springframework.web.servlet.DispatcherServlet : Completed initialization in 3 ms
    95 2022-03-16 05:18:30.594 INFO  s.d.s.w.r.operation.CachingOperationNameGenerator : Generating unique operation named: executeUsingPOST_1
    96 2022-03-16 05:18:30.711 INFO  s.d.s.w.r.operation.CachingOperationNameGenerator : Generating unique operation named: downloadFileUsingGET_1
    97 2022-03-16 05:18:30.721 INFO  s.d.s.w.r.operation.CachingOperationNameGenerator : Generating unique operation named: executeUsingPOST_2
    98 2022-03-16 05:18:30.824 ERROR o.a.c.c.C.[.[.[/springdemo].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] threw exception
    99 java.lang.StackOverflowError: null
   100     at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryAcquireShared(ReentrantReadWriteLock.java:470)
   101     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
   102     at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:727)
   103     at org.apache.catalina.core.StandardContext.getManager(StandardContext.java:1917)
   104     at org.apache.catalina.connector.Request.doGetSession(Request.java:3021)
   105     at org.apache.catalina.connector.Request.getSession(Request.java:2494)
   106     at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
   107     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   108     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   109     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   110     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   111     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   112     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   113     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   114     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   115     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   116     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   117     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   118     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   119     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   120     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   121     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   122     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   123     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   124     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   125     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   126     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
   127     at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
   128     at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:583)
xiaohuangdou666 commented 2 years ago

server.servlet.context-path 仅能控制后端访问接口前缀,页面需要根据实际情况选择性修改前端配置重新打包,若仅需要修改页面访问前缀建议通过其他方式解决 例如:前后端分离部署仅修改前端请求接口前缀与后端一致;整体部署(默认方式)参考以下配置重新打包部署 前端配置(参考):