Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

pcfdev 0.18.0: Fails to run a Spring Boot 1.4.0 app #130

Closed
rnadler opened this issue Aug 31, 2016 · 3 comments
Closed

pcfdev 0.18.0: Fails to run a Spring Boot 1.4.0 app #130

rnadler opened this issue Aug 31, 2016 · 3 comments

Comments

@rnadler
Copy link

rnadler commented Aug 31, 2016

See log below. The same Java 1.8 app runs fine with SB 1.3.6 and 1.3.7.

2016-08-31T16:22:11.797-07:00 [CELL] [OUT] Creating container
2016-08-31T16:22:12.015-07:00 [CELL] [OUT] Successfully created container
2016-08-31T16:22:16.594-07:00 [CELL] [OUT] Starting health monitoring of container
2016-08-31T16:22:17.540-07:00 [APP] [ERR] Exception in thread "main" java.lang.reflect.InvocationTargetException
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.lang.reflect.Method.invoke(Method.java:497)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:401)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:392)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] Caused by: java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : org.cloudfoundry.reconfiguration.spring.CloudPropertySourceApplicationContextInitializer
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:422)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:261)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] ... 8 more
2016-08-31T16:22:17.541-07:00 [APP] [ERR] Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextInitializer
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.(SpringApplication.java:237)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at io.pivotal.ConfigServerApplication.main(ConfigServerApplication.java:12)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.lang.ClassLoader.defineClass1(Native Method)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.security.AccessController.doPrivileged(Native Method)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:89)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:414)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] ... 15 more
2016-08-31T16:22:17.541-07:00 [APP] [ERR] Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextInitializer
2016-08-31T16:22:17.541-07:00 [APP] [ERR] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
2016-08-31T16:22:17.541-07:00 [APP] [ERR] ... 31 more
2016-08-31T16:22:17.567-07:00 [APP] [OUT] Exit status 1

@andifalk
Copy link

andifalk commented Sep 1, 2016

Spring boot 1.4.0 changed the launcher mechanism which is not compatible any more with older java buildpacks.
To fix this you have to use a more recent java buildpack than the default one in PCFDev.
At least buildpack 3.7 is required.
You may specify the buildpack directly in your manifest (for example version 3.8.1):
buildpack: https://github.com/cloudfoundry/java-buildpack.git#v3.8.1

@rnadler
Copy link
Author

rnadler commented Sep 1, 2016

Yep, that fixed it. Thanks!

@sclevine sclevine closed this as completed Sep 1, 2016
@manojpatil1
Copy link

Thanks, It is really helpful info

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants