Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.82 KB | None | 0 0
  1. 重大 [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
  2. org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/app]]
  3. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
  4. at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
  5. at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
  6. at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
  7. at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
  8. at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
  9. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  10. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  11. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  12. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  13. at java.lang.Thread.run(Thread.java:748)
  14. Caused by: java.lang.IllegalStateException: Duplicate Filter registration for 'springSecurityFilterChain'. Check to ensure the Filter is only configured once.
  15. at org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer.registerFilter(AbstractSecurityWebApplicationInitializer.java:217)
  16. at org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer.insertSpringSecurityFilterChain(AbstractSecurityWebApplicationInitializer.java:151)
  17. at org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer.onStartup(AbstractSecurityWebApplicationInitializer.java:124)
  18. at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
  19. at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)
  20. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  21. ... 10 more
  22.  
  23. buildscript {
  24. ext {
  25. springBootVersion = '1.5.9.RELEASE'
  26. tomcatVersion = '8.5.24'
  27. }
  28. repositories {
  29. mavenCentral()
  30. }
  31. dependencies {
  32. classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
  33. }
  34. }
  35.  
  36. apply plugin: 'java'
  37. apply plugin: 'eclipse'
  38. apply plugin: 'war'
  39. apply plugin: 'org.springframework.boot'
  40.  
  41. version = '0.0.0-SNAPSHOT'
  42. sourceCompatibility = 1.8
  43.  
  44. repositories {
  45. mavenCentral()
  46. }
  47.  
  48. [compileJava,compileTestJava]*.options*.encoding='UTF-8'
  49.  
  50. processResources.destinationDir = compileJava.destinationDir
  51. compileJava.dependsOn processResources
  52.  
  53. dependencies {
  54. compile('org.springframework.boot:spring-boot-starter-web') {
  55. exclude(module: 'spring-boot-starter-tomcat')
  56. exclude(group: 'org.apaceh.tomcat.embed')
  57. }
  58. compile('org.springframework.boot:spring-boot-starter-thymeleaf')
  59. compile('org.springframework.boot:spring-boot-starter-security')
  60. compile('org.springframework.boot:spring-boot-devtools')
  61. compile('org.springframework.boot:spring-boot-starter-mail')
  62.  
  63. providedCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
  64. providedCompile("org.apache.tomcat.embed:tomcat-embed-el:${tomcatVersion}")
  65. providedCompile("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}")
  66. providedCompile('org.apache.tomcat.embed:tomcat-embed-logging-juli:8.5.2')
  67. providedCompile("org.apache.tomcat.embed:tomcat-embed-websocket:${tomcatVersion}")
  68. providedCompile("org.apache.tomcat:tomcat-jdbc:${tomcatVersion}")
  69. providedCompile("org.apache.tomcat:tomcat-jsp-api:${tomcatVersion}")
  70.  
  71. compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4')
  72.  
  73. compile('org.projectlombok:lombok:1.16.16')
  74.  
  75. compile('org.postgresql:postgresql:9.3-1100-jdbc4')
  76.  
  77. compile('org.seasar.doma.boot:doma-spring-boot-starter:1.1.0')
  78.  
  79. testCompile('org.springframework.boot:spring-boot-starter-test')
  80. }
  81.  
  82. war {
  83. archiveName 'app.war';
  84. }
  85.  
  86. ・・省略
  87. @Configuration
  88. @EnableWebSecurity
  89. public class AppWebSecurityConfigurer extends WebSecurityConfigurerAdapter {
  90. @Autowired
  91. AppLogoutHandler logoutHandler;
  92.  
  93. @Autowired
  94. AppLoginSuccessHandler loginSuccessHandler;
  95.  
  96. @Autowired
  97. LoginService loginService;
  98.  
  99. @Bean
  100. AppLoginSuccessHandler loginSuccessHandler() {
  101. return new AppLoginSuccessHandler();
  102. }
  103. @Bean
  104. PasswordEncoder passwordEncoder() {
  105. return new BCryptPasswordEncoder();
  106. }
  107.  
  108. @Override
  109. protected void configure(HttpSecurity http) throws Exception {
  110. http.authorizeRequests()
  111. .antMatchers("/app/auth/**")
  112. .authenticated()
  113. .antMatchers("/js/**"
  114. ,"/css/**"
  115. ,"/images/**"
  116. , "/vendor/**"
  117. ,"/app/**")
  118. .permitAll()
  119. .and()
  120. .formLogin()
  121. .loginPage(URL_LOGIN)
  122. .usernameParameter("username")
  123. .passwordParameter("password")
  124. .successHandler(loginSuccessHandler)
  125. .failureUrl(URL_LOGIN + "?error=true")
  126. .permitAll()
  127. .and()
  128. .logout()
  129. .logoutRequestMatcher(new AntPathRequestMatcher(U_LOGOUT))
  130. .logoutSuccessUrl(U_HOME_INDEX)
  131. .deleteCookies("JSESSIONID")
  132. .addLogoutHandler(logoutHandler)
  133. .invalidateHttpSession(true)
  134. .permitAll()
  135. .and()
  136. .sessionManagement()
  137. .sessionFixation()
  138. .newSession()
  139. .invalidSessionUrl(URL_LOGIN);
  140. }
  141.  
  142. @Override
  143. protected void configure(AuthenticationManagerBuilder auth) throws Exception {
  144. auth.userDetailsService(loginService).passwordEncoder(passwordEncoder());
  145. }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement