0

我们使用 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
4

2 回答 2

0

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

于 2018-05-22T10:47:07.227 回答
0

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

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

T t = 空;

我们在这里的真正意思是什么?'null' 是 T 的类型还是它的子类型?它与输入下面的代码并期望编译器为我们工作一样有效。

吨; // 编译器强迫我分配,对吧?

现在,变量 't' 只是一个没有任何对象的引用。'Null' 只是明确支持该约定。访问“T”的任何属性都会使编译器产生著名的“NullPointerException”。

于 2018-04-26T16:37:52.490 回答