spring-guides / gs-spring-boot

Building an Application with Spring Boot :: Learn how to build an application with minimal configuration.
https://spring.io/guides/gs/spring-boot/
Apache License 2.0
890 stars 4.51k forks source link

Unable to run the sample application. #5

Closed Muzamri closed 10 years ago

Muzamri commented 10 years ago

Hi there,

Using this commit: b84d2a438a199b66971aa196d0e079629e6107ab

I am unable to successfully run the sample application using: ./gradlew build && java -jar build/libs/gs-spring-boot-0.1.0.jar

However, using this commit: 5aadeabf282f4dc872957dbb79887cb7e0929f1a

The sample runs successfully. Anyone else facing this issue?

Kind regards.

gregturn commented 10 years ago

I'll check it first thing in the morning.

Muzamri commented 10 years ago

Thanks Greg, but there is no rush, I can just use the previous commit to try out the samples.

gregturn commented 10 years ago

If you can leave a demo of the version of Java you are running and a console output showing it crashing, that would help a lot.

Muzamri commented 10 years ago

commit: b84d2a438a199b66971aa196d0e079629e6107ab

gs-spring-boot/complete$ ./gradlew -v


Gradle 1.8

Build time: 2013-09-24 07:32:33 UTC Build number: none Revision: 7970ec3503b4f5767ee1c1c69f8b4186c4763e3d

Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013 Ivy: 2.2.0 JVM: 1.6.0_27 (Sun Microsystems Inc. 20.0-b12) OS: Linux 3.2.0-56-generic-pae i386

gs-spring-boot/complete$ ./gradlew build && java -jar build/libs/gs-spring-boot-0.1.0.jar :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar :repackage :assemble :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build

BUILD SUCCESSFUL

Total time: 9.439 secs Exception in thread "main" java.lang.IllegalStateException: java.lang.NullPointerException at org.springframework.boot.loader.ExecutableArchiveLauncher.(ExecutableArchiveLauncher.java:47) at org.springframework.boot.loader.JarLauncher.(JarLauncher.java:29) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:42) Caused by: java.lang.NullPointerException at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.getPosition(RandomAccessDataJarInputStream.java:79) at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.getNextEntry(RandomAccessDataJarInputStream.java:70) at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.getNextEntry(RandomAccessDataJarInputStream.java:35) at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.java:166) at java.util.jar.JarInputStream.(JarInputStream.java:90) at java.util.jar.JarInputStream.(JarInputStream.java:60) at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.(RandomAccessDataJarInputStream.java:59) at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.(RandomAccessDataJarInputStream.java:47) at org.springframework.boot.loader.jar.RandomAccessJarFile.(RandomAccessJarFile.java:120) at org.springframework.boot.loader.jar.RandomAccessJarFile.(RandomAccessJarFile.java:100) at org.springframework.boot.loader.jar.RandomAccessJarFile.(RandomAccessJarFile.java:89) at org.springframework.boot.loader.archive.JarFileArchive.(JarFileArchive.java:46) at org.springframework.boot.loader.ExecutableArchiveLauncher.createArchive(ExecutableArchiveLauncher.java:64) at org.springframework.boot.loader.ExecutableArchiveLauncher.(ExecutableArchiveLauncher.java:44) ... 2 more

commit: 5aadeabf282f4dc872957dbb79887cb7e0929f1a

gs-spring-boot/complete$ ./gradlew -v


Gradle 1.8

Build time: 2013-09-24 07:32:33 UTC Build number: none Revision: 7970ec3503b4f5767ee1c1c69f8b4186c4763e3d

Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013 Ivy: 2.2.0 JVM: 1.6.0_27 (Sun Microsystems Inc. 20.0-b12) OS: Linux 3.2.0-56-generic-pae i386

gs-spring-boot/complete$ ./gradlew build && java -jar build/libs/gs-spring-boot-0.1.0.jar :compileJava :processResources UP-TO-DATE :classes :jar :repackage :assemble :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build

BUILD SUCCESSFUL

Total time: 11.606 secs

. _ /\ / **' () \ \ \ \ ( ( )** | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |_| .**|| ||| |**, | / / / / =========||==============|_/=///_/ :: Spring Boot :: (v0.5.0.M5)

Muzamri commented 10 years ago

Ah, switching to : JVM: 1.7.0_21 (Oracle Corporation 23.21-b01)

I am able to run commit: b84d2a438a199b66971aa196d0e079629e6107ab

gregturn commented 10 years ago

A) I Java 6, 7, and 8 installed (lots to support). My version of Java 6 is Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) appears much more up-to-date than the one I saw you list. I can run the "complete" version with this version of Java 6. Not sure if that's the issue.

B) I also see that Spring Boot 0.5.0.M5 is on the tag line. We updated that guide recently to 0.5.0.M6. Perhaps if you delete your workspace and then refetch it, it will run smoother with your version of Java 6 (if 6 is a requirement for you).

Muzamri commented 10 years ago

A) I have installed the latest version for the 1.6 SDK I could find. (You are right about this, ) I managed to get commit: b84d2a438a199b66971aa196d0e079629e6107ab working. I will list the out put below.

B) Spring Boot 0.5.0.M5 appeared because I reverted to the previous commit (in order to run it successfully). Java 6 is not a requirement for me.

Output: gs-spring-boot/complete$ ./gradlew -v


Gradle 1.8

Build time: 2013-09-24 07:32:33 UTC Build number: none Revision: 7970ec3503b4f5767ee1c1c69f8b4186c4763e3d

Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013 Ivy: 2.2.0 JVM: 1.6.0_45 (Sun Microsystems Inc. 20.45-b01) <<<<< UPDATED OS: Linux 3.2.0-56-generic-pae i386

blitzkrieg@blitzkrieg-nb:~/data/gits/gs-spring-boot/complete$ ./gradlew build && java -jar build/libs/gs-spring-boot-0.1.0.jar :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar :repackage :assemble :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build

BUILD SUCCESSFUL

Total time: 8.606 secs

. _ /\ / **' () \ \ \ \ ( ( )** | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |_| .**|| ||| |**, | / / / / =========||==============|_/=///_/ :: Spring Boot :: (v0.5.0.M6)

gregturn commented 10 years ago

Given that it now works, I'll consider the bug was the older version of Java 6.