2016-04-02 8 views
0

Ich bin neu in Java und derzeit für die Verwaltung einer neuen Anwendung verantwortlich. Ich versuche, die Anwendung zu starten und es mit dem folgenden Fehler fehlschlägt:Embedded Tomcat konnte aufgrund von "Injection von Abhängigkeiten mit Autowired fehlgeschlagen" nicht gestartet werden.

Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat 
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) 
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) 
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) 
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:967) 
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:956) 
     at com.thinkbiganalytics.controller.Application.main(Application.java:53) 
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat 
     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:98) 
     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:75) 
     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:378) 
     at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:155) 
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157) 
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) 
     ... 7 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formBasedWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.authentication.AuthenticationProvider com.thinkbiganalytics.auth.FormBasedWebSecurityConfiguration.authenticationProvider; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thinkbiganalytics.auth.AuthenticationService com.thinkbiganalytics.auth.AuthServiceAuthenticationProvider.authenticationService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.thinkbiganalytics.datalake.podium.restclient.PodiumRestClient com.thinkbiganalytics.datalake.podium.auth.PodiumAuthenticationService.podiumRestClient; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'podiumRestClientImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private boolean com.thinkbiganalytics.datalake.podium.restclient.PodiumRestClientImpl.useHttps; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${podium.useHttps}] 
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) 

Antwort

5

TL; DR: Lesen Sie den Fehler, den Spring Ihnen gibt.

Lässt den Fehler übernehmen und systematisch durchgehen:

Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat 
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) 
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) 
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) 
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687) 
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) 
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:967) 
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:956) 
      at com.thinkbiganalytics.controller.Application.main(Application.java:53) 
    Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat 
      at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:98) 
      at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:75) 
      at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:378) 
      at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:155) 
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157) 
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) 
      ... 7 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formBasedWebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.authentication.AuthenticationProvider com.thinkbiganalytics.auth.FormBasedWebSecurityConfiguration.authenticationProvider; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.thinkbiganalytics.auth.AuthenticationService com.thinkbiganalytics.auth.AuthServiceAuthenticationProvider.authenticationService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.thinkbiganalytics.datalake.podium.restclient.PodiumRestClient com.thinkbiganalytics.datalake.podium.auth.PodiumAuthenticationService.podiumRestClient; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'podiumRestClientImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private boolean com.thinkbiganalytics.datalake.podium.restclient.PodiumRestClientImpl.useHttps; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${podium.useHttps}] 
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) 

Zuerst haben wir Exception in thread "main" haben - das sagt uns nicht alles, außer dass der Status wegen „Kann nicht eingebetteten Behälter starten“ durchgebrannt ist.

Okay, was das verursacht wird, lässt auf die nächste Stufe gehen:

Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat 

Okay, nicht viel mehr gibt. Lets go auf die nächste Stufe:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed 

Okay, jetzt sind wir immer irgendwo - wir kein WebSecurityConfiguration aufgrund eines autowiring Problem schaffen könnte, aber was ist das Problem?

Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) 

Ah, okay, Frühling konnte diese Methode nicht autowire, warum nicht?

nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formBasedWebSecurityConfiguration' 

Ah, okay - so könnte es nicht, dass die Methode Methode autowire es keine formBasedWebSecurityConfiguration schaffen könnte. Warum nicht?

Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.authentication.AuthenticationProvider 

Ah, nein AuthenticationProvider. Warum nicht?

Could not autowire field: private com.thinkbiganalytics.auth.AuthenticationService com.thinkbiganalytics.auth.AuthServiceAuthenticationProvider.authenticationService 

Ah, nein authenticationService. Warum nicht?

Could not autowire field: com.thinkbiganalytics.datalake.podium.restclient.PodiumRestClient 

Ah, keine PodiumRestClient. Warum nicht?

Could not autowire field: private boolean com.thinkbiganalytics.datalake.podium.restclient.PodiumRestClientImpl.useHttps 

Okay, es kann nicht die PodiumRestClientImpl schaffen, weil es nicht die boolean useHttps autowire kann. Warum nicht?

Failed to convert value of type 'java.lang.String' to required type 'boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${podium.useHttps}] 

So konnte es nicht autowire PodiumRestClientImpl.useHttps, weil es nicht die String mit einem Wert von ${podium.useHttps} zu einem boolean umwandeln könnte. Meinetwegen.

So scheint es, dass Sie SpEL nicht korrekt verwenden, wenn Sie einen Konfigurationswert automatisch ablaufen lassen, oder Sie haben PropertySource nicht konfiguriert, um Platzhalter auf Konfigurationswerte aufzulösen.

+0

Dank eine Tonne, Boris und schätzen den Weg, es Schritt für Schritt zu brechen. – Des

+0

Ich bin froh, dass ich @Des helfen konnte. Wenn diese Antwort Ihr Problem gelöst hat, dann überlegen Sie [akzeptieren] (http://meta.stackexchange.com/a/5235/214894). –

Verwandte Themen