Tomcat版本:
Geoserver版本:2.15
停止服务:
systemctl stop tomcat
或者直接到tomcat家目录的/bin下执行
./shoutdown.sh
把两个jar包放到tomcat的lib目录下,并不是geoserver的lib下
(jar文件执行百度下载,或者私信联系我)
在tomcat的conf/web.xml文件中
在web-app标签中底部新填
vim web.xml
<!-- 提供跨域支持 --> <filter> <filter-name>CORS</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> <init-param> <param-name>cors.allowOrigin</param-name> <param-value>*</param-value> </init-param> <init-param> <param-name>cors.supportedMethods</param-name> <param-value>GET, POST, HEAD, PUT, DELETE</param-value> </init-param> <init-param> <param-name>cors.supportedHeaders</param-name> <param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified</param-value> </init-param> <init-param> <param-name>cors.exposedHeaders</param-name> <param-value>Set-Cookie</param-value> </init-param> <init-param> <param-name>cors.supportsCredentials</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>CORS</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
在这段话的上面添加
<!-- ==================== Default Welcome File List ===================== -->
实例图:
注释.../webapps/geoserver/WEB-INF/web.xml
相关行:
启动tomcat,完成