我有一个spring-boot war应用程序在windows和ios中运行完美,然后我尝试在linux中运行它。它确实运行并正常构建,但是当我尝试通过浏览器打开它时,它会返回chrome中的无效http响应和Firefox中的一些未解密的代码。我用这台电脑运行另一个弹簧启动项目,它们工作得很好。我正在使用Maven 3.3.9和Ubuntu 16.04。
这是我的pom.xml的样子
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>hris</artifactId>
<version>0.1</version>
<packaging>war</packaging>
<name>hris</name>
<description>sso template for hris</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212.jre7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/nz.net.ultraq.thymeleaf/thymeleaf-layout-dialect -->
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring4 -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
<!-- CAS Integration -->
<dependency>
<groupId>com.kakawait</groupId>
<artifactId>cas-security-spring-boot-starter</artifactId>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>com.github.dandelion</groupId>
<artifactId>datatables-core</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>22.0</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>${compilerArgument}</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
</project>
这是我运行应用程序时写出的内容
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building dapil 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) > test-compile @ hris >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hris ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 953 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hris ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hris ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /******/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hris ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) < test-compile @ hris <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) @ hris ---
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.9.RELEASE)
2018-04-12 12:49:22.096 INFO 30740 --- [ main] c.example.hris.HRISApplication : Starting HRISApplication on Lenovo-G40-70 with PID 30740 (/*******/target/classes started by ****** in **********)
2018-04-12 12:49:22.101 INFO 30740 --- [ main] c.example.hris.HRISApplication : No active profile set, falling back to default profiles: default
2018-04-12 12:49:22.632 INFO 30740 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@9e79a00: startup date [Thu Apr 12 12:49:22 WIB 2018]; root of context hierarchy
2018-04-12 12:49:24.064 WARN 30740 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.example.hris]' package. Please check your configuration.
2018-04-12 12:49:25.583 INFO 30740 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 12000 (https)
2018-04-12 12:49:25.611 INFO 30740 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-04-12 12:49:25.613 INFO 30740 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23
2018-04-12 12:49:25.766 INFO 30740 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-04-12 12:49:25.767 INFO 30740 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3141 ms
2018-04-12 12:49:26.053 INFO 30740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-04-12 12:49:26.054 INFO 30740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-04-12 12:49:26.054 INFO 30740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-04-12 12:49:26.055 INFO 30740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-04-12 12:49:26.056 INFO 30740 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-04-12 12:49:26.057 INFO 30740 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-04-12 12:49:28.032 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@9e79a00: startup date [Thu Apr 12 12:49:22 WIB 2018]; root of context hierarchy
2018-04-12 12:49:28.050 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Detected @ModelAttribute methods in siteController
2018-04-12 12:49:28.175 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/auth/edit/{id}],methods=[POST]}" onto public java.lang.String com.example.hris.controller.AuthController.postAuthEdit(com.example.hris.dto.form.cmd.AuthItemCmd,org.springframework.validation.BindingResult,org.springframework.web.servlet.mvc.support.RedirectAttributes)
2018-04-12 12:49:28.176 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/auth/create],methods=[GET]}" onto public java.lang.String com.example.hris.controller.AuthController.getAuthAdd(org.springframework.ui.Model)
2018-04-12 12:49:28.177 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/auth/create],methods=[POST]}" onto public java.lang.String com.example.hris.controller.AuthController.postAuthAdd(com.example.hris.dto.form.cmd.AuthItemChildCmd,org.springframework.validation.BindingResult,org.springframework.web.servlet.mvc.support.RedirectAttributes)
2018-04-12 12:49:28.177 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/auth/update/{id}],methods=[GET]}" onto public java.lang.String com.example.hris.controller.AuthController.getAuthEdit(java.lang.Long,org.springframework.ui.Model,org.springframework.web.servlet.mvc.support.RedirectAttributes)
2018-04-12 12:49:28.178 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/auth/delete],methods=[POST]}" onto public boolean com.example.hris.controller.AuthController.postUserDeactivate(java.lang.String)
2018-04-12 12:49:28.178 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/auth/manage],methods=[GET]}" onto public java.lang.String com.example.hris.controller.AuthController.indexGet(com.example.hris.dto.form.search.AuthItemSearchForm,org.springframework.validation.BindingResult,org.springframework.ui.Model)
2018-04-12 12:49:28.179 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/auth/table],methods=[POST]}" onto public com.github.dandelion.datatables.core.ajax.DatatablesResponse<com.example.hris.dto.table.AuthItemItem> com.example.hris.controller.AuthController.postTableSearch(com.example.hris.dto.form.search.AuthItemSearchForm,javax.servlet.http.HttpServletRequest)
2018-04-12 12:49:28.181 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/signin],methods=[GET]}" onto public java.lang.String com.example.hris.controller.SiteController.login()
2018-04-12 12:49:28.181 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String com.example.hris.controller.SiteController.index()
2018-04-12 12:49:28.185 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-04-12 12:49:28.186 INFO 30740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-04-12 12:49:28.250 INFO 30740 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-04-12 12:49:28.251 INFO 30740 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-04-12 12:49:28.337 INFO 30740 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-04-12 12:49:29.686 INFO 30740 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/css/**'], Ant [pattern='/js/**'], Ant [pattern='/images/**'], Ant [pattern='/webjars/**'], Ant [pattern='/**/favicon.ico'], Ant [pattern='/error']]], []
2018-04-12 12:49:29.830 INFO 30740 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/**']]], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@551f663f, org.springframework.security.web.context.SecurityContextPersistenceFilter@223b66, org.springframework.security.web.header.HeaderWriterFilter@37dc0139, org.jasig.cas.client.session.SingleSignOutFilter@4b658c91, org.springframework.security.web.authentication.logout.LogoutFilter@274ccf4f, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@13f8799a, org.springframework.security.cas.web.CasAuthenticationFilter@764ed709, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@422b1740, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6e1eddc, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7886ebc0, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@58ce6961, org.springframework.security.web.session.SessionManagementFilter@48408088, org.springframework.security.web.access.ExceptionTranslationFilter@4fa73638, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@46775723]
2018-04-12 12:49:29.853 INFO 30740 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/**']]], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2ff438ee, org.springframework.security.web.context.SecurityContextPersistenceFilter@d3ea90c, org.springframework.security.web.header.HeaderWriterFilter@41ef1e45, org.springframework.security.web.authentication.logout.LogoutFilter@4e1c5a6a, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@3657e01, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@381dbdc1, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1b991b1, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@4dd194c2, org.springframework.security.web.session.SessionManagementFilter@3b7b329e, org.springframework.security.web.access.ExceptionTranslationFilter@7f495bf9, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@ad57ac4]
2018-04-12 12:49:30.176 INFO 30740 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-04-12 12:49:31.983 INFO 30740 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 12000 (https)
2018-04-12 12:49:31.991 INFO 30740 --- [ main] c.example.hris.HRISApplication : Started HRISApplication in 10.454 seconds (JVM running for 16.918)
2018-04-12 12:49:48.922 INFO 30740 --- [ Thread-4] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@9e79a00: startup date [Thu Apr 12 12:49:22 WIB 2018]; root of context hierarchy
2018-04-12 12:49:48.928 INFO 30740 --- [ Thread-4] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
我在Ubuntu 17.10上试过这个但是同样的事情发生了。我能做些什么来解决它吗?提前致谢
编辑:我在ubuntu和windows版本中都有openjdk8。我不知道ios,因为它是我朋友的。以下是我试图构建它时的样子
in chromium&amp; in firefox
答案 0 :(得分:-1)
我在spring-boot 1.4.0.RELEASE版本中遇到了这个问题,并在切换到2.1.8.RELEASE版本时得到了解决