1
bubbleshadow% ls -l build/libs
total 83544
-rw-r--r--  1 dlynch  staff  42772394 May 14 08:37 bubbleshadow-0.0.1-SNAPSHOT.jar

When running the above .jar file (which is supposed to be a fat jar), I get the following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path res
ource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException 

I have attempted to follow instructions from: https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/

In 8.1 it says Reacting (sic) to the Java Plugin:

And then:

Creates a BootJar task named bootJar that will create an executable (sic), fat jar for the project.

My build runs within IntelliJ IDEA but not when executing on the command line.

According to Josh Long's Book Learning Spring Boot 2.0 - Second Edition, see it says:

If we peek at the output, we'll find the original JAR file (non-FAT) along with the rebundled one containing our application code as well as the third-party dependencies, as shown here: $ ls build/libs
learning-spring-boot-0.0.1-SNAPSHOT.jar
learning-spring-boot-0.0.1-SNAPSHOT.jar.original

Turnquist, Greg L.. Learning Spring Boot 2.0 - Second Edition: Simplify the development of lightning fast applications based on microservices and reactive programming (Kindle Locations 664-667 (sic)). Packt Publishing. Kindle Edition.

I don't understand why the .original jar is not being produced and the jar that it is producing for me is un-runnable.

Daniel Lynch
  • 313
  • 1
  • 4
  • 8
  • I think both of the books that you have referenced are for Spring Boot 1.5, whereas you're using Spring Boot 2.0. Are you using Java 9 by any chance? It'd would also improve your question if you listed the contents of the jar that has been built. It's not clear why you think it isn't a fat jar. – Andy Wilkinson May 14 '18 at 17:06
  • try to check this answer https://stackoverflow.com/a/25232334/1063509 – Ishikawa Yoshi May 15 '18 at 02:54

0 Answers0