0

I precisely followed the steps in the tutorial at this link to create a Spring Boot web service. I am able to run the service on my local CentOS 7 devbox when the terminal is pointed to the root directory of the uncompiled app, and I type in the following:

# ./gradlew clean build && java -jar build/libs/gs-actuator-service-0.1.0.jar  

However, the app is throwing an error instead of loading when I scp the resulting jar to a remote CentOS 7 web server and move the jar to /some/arbitrary/path/to/jar/gs-actuator-service-0.1.0.jar and then cd /some/arbitrary/path/to/jar/ and java -jar gs-actuator-service-0.1.0.jar. How can I resolve this error and thus be able to start the app succesfully on the remote CentOS 7 web server?

I imagine that the error has to do with directory structure, but I just want the jar on the web server. I do not want the un-jarred app on the server. And the only way I know to eliminate the error would be to recreate the un-jarred app on the server. How can I fix the problem without resorting to loading the whole un-jarred app to the server?

Here is the stack trace:

$ java -jar gs-actuator-service-0.1.0.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: hello/HelloWorldConfiguration : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47)
    at java.lang.Thread.run(Thread.java:745)
$ 
CodeMed
  • 9,527
  • 70
  • 212
  • 364
  • What Spring Boot version? – Branislav Lazic Dec 28 '15 at 19:53
  • @BranislavLazic Not sure. What do I type to get that information? I see that the devbox is running Java 8 while the server is running Java 7. I am researching how to recompile the jar on the devbox using Java 7. – CodeMed Dec 28 '15 at 20:02
  • Your problem is very simple. You are using unsupported Java version. Your code is probably compiled with Java 8 compiler and ran with Java 7. – Branislav Lazic Dec 28 '15 at 20:04
  • @BranislavLazic Yep. I am trying to find out how to list the jdk version installed on my devbox and then, if necessary, download version 1.7.0_75. Then I will have to specify version to be used in compilation in order to assess whether this is the problem or not. – CodeMed Dec 28 '15 at 20:08

0 Answers0