将应用程序推送到具有Microsft Azure依赖性的PCF Cloud时出现Nullpointer异常

时间:2018-04-25 15:46:34

标签: azure azure-storage pivotal-cloud-foundry spring-boot-starter

我们使用Microsoft Azure来存储文件并使用com.microsoft.azure:azure-storage-spring-boot-starter依赖项。连接URL很适合连接到azure,并且应用程序在本地正常运行。

在推入具有低于堆栈的PCF时给出NullPointerException。

    15:26:15.493 [main] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/home/vcap/app/BOOT-INF/classes/, jar:file:/home/vcap/app/BOOT-INF/lib/annotations-2.0.1.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/azure-keyvault-core-0.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/azure-spring-boot-0.2.3.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/azure-spring-boot-starter-0.2.3.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/azure-storage-5.5.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/azure-storage-spring-boot-starter-0.2.3.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/classmate-1.3.4.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/client_certificate_mapper-1.4.0_RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/commons-io-1.3.2.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/commons-lang3-3.4.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/error_prone_annotations-2.0.19.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/googleapis-common-protos-0.0.3.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-context-1.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-core-1.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-netty-1.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-protobuf-1.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-protobuf-lite-1.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-services-1.5.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-spring-boot-starter-2.0.5.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/grpc-stub-1.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/gson-2.8.2.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/guava-18.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/hackathon-bytestream-grpc-client.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/hibernate-validator-5.3.5.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/instrumentation-api-0.4.3.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/jackson-annotations-2.9.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/jackson-core-2.9.3.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/jackson-databind-2.9.3.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/jboss-logging-3.3.1.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/jcl-over-slf4j-1.7.25.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/json-20140107.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/jsr305-3.0.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/jul-to-slf4j-1.7.25.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/log4j-over-slf4j-1.7.25.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/logback-classic-1.1.11.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/logback-core-1.1.11.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/lombok-1.16.18.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/mapstruct-1.0.0.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-buffer-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-codec-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-codec-http-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-codec-http2-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-codec-socks-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-common-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-handler-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-handler-proxy-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-resolver-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-tcnative-boringssl-static-2.0.6.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/netty-transport-4.1.16.Final.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/opencensus-api-0.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/opencensus-contrib-grpc-metrics-0.8.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/proto-google-common-protos-0.1.9.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/protobuf-java-3.4.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/protobuf-java-util-3.4.0.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/slf4j-api-1.7.25.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/snakeyaml-1.17.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-aop-4.3.12.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-beans-4.3.12.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-actuator-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-autoconfigure-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-starter-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-starter-actuator-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-starter-logging-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-starter-tomcat-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-starter-validation-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-boot-starter-web-1.5.8.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-context-4.3.12.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-core-4.3.12.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-expression-4.3.12.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-plugin-core-1.2.0.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-plugin-metadata-1.2.0.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-web-4.3.12.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring-webmvc-4.3.12.RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/spring_auto_reconfiguration-2.3.0_RELEASE.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/springfox-core-2.6.1.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/springfox-schema-2.6.1.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/springfox-spi-2.6.1.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/springfox-spring-web-2.6.1.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/springfox-swagger-common-2.6.1.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/springfox-swagger2-2.6.1.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/swagger-annotations-1.5.10.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/swagger-models-1.5.10.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/tomcat-annotations-api-8.5.23.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/tomcat-embed-core-8.5.23.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/tomcat-embed-el-8.5.23.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/tomcat-embed-websocket-8.5.23.jar!/, jar:file:/home/vcap/app/BOOT-INF/lib/validation-api-1.1.0.Final.jar!/]
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at com.microsoft.azure.spring.cloundfoundry.environment.VcapProcessor.parse(VcapProcessor.java:73)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] 15:26:15.506 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] java.lang.NullPointerException: null
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:182)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:168)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at com.microsoft.azure.spring.cloundfoundry.environment.VcapProcessor.postProcessEnvironment(VcapProcessor.java:56)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at com.ford.cv.vadr.aufilemanager.AuFileManagerApplication.main(AuFileManagerApplication.java:11)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at java.lang.reflect.Method.invoke(Method.java:498)
2018-04-25T11:26:15.507-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
2018-04-25T11:26:15.508-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
2018-04-25T11:26:15.508-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
2018-04-25T11:26:15.508-04:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2018-04-25T11:26:15.525-04:00 [APP/PROC/WEB/0] [OUT] Exit status 1
2018-04-25T11:26:15.555-04:00 [CELL/0] [OUT] Exit status 0
2018-04-25T11:26:15.571-04:00 [CELL/0] [OUT] Destroying container
2018-04-25T11:26:18.879-04:00 [CELL/0] [OUT] Successfully destroyed container

2 个答案:

答案 0 :(得分:0)

我建议您查看以下博客: https://dzone.com/articles/one-dollar-solution-to-avoid-null-pointer-exceptio 作者解释了NullPointerException发生的可能原因。

  

让我们考虑付费美元的一个例子:

     

T t = null;

     

我们在这里的意思是什么? 'null'是T的一种类型还是它的子类型?它就像输入以下内容并期望编译器为我们工作一样有效。

     

T t; //编译器强迫我分配,呵呵?

     

现在,变量't'只是一个没有任何对象的引用。 'Null'只是明确支持该惯例。访问'T'的任何属性会使编译器发出着名的'NullPointerException。'

答案 1 :(得分:0)

我今天遇到了这个问题,我已经检查了git存储库中的最新代码。它修复了版本" com.microsoft.azure:azure-storage-spring-boot-starter:2.0.2"。 请尝试使用它。