0

We are using Microsoft Azure to store files and using com.microsoft.azure:azure-storage-spring-boot-starter dependency. The connection URL is good to connect to azure and the app is running properly in local.

It is giving NullPointerException while pushing into PCF with below stack.

    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
user09
  • 920
  • 2
  • 12
  • 38

2 Answers2

0

I'd recommend checking the following blog: https://dzone.com/articles/one-dollar-solution-to-avoid-null-pointer-exceptio The author explained the possible reasons for the NullPointerException happen.

Let's consider an example for the paid dollar:

T t = null;

What do we actually mean here? Is 'null' a type of T or its subtype? It is just as valid a piece of code as typing what's below way and expecting the compiler to work for us.

T t; // compiler compels me to assign, huh?

Now, the variable 't' is just a reference without any object. 'Null' just explicitly endorses that convention. Accessing any of the properties of 'T' would make the compiler spew the famous 'NullPointerException.'

Community
  • 1
  • 1
0

I have met this issue today, and I have check the latest code in git repository. It has fixed in the version "com.microsoft.azure:azure-storage-spring-boot-starter:2.0.2". Please try with it.

wesley
  • 1
  • Hi arjun, Please use the denpency "com.microsoft.azure:azure-storage“ instead of "com.microsoft.azure:azure-storage-spring-boot-starter" in your project if you don not want to improve spring boot version to 2.0. It works OK for me in PCF platform. – wesley May 23 '18 at 09:35