question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sample built with Gradle doesn't run with "java -jar" on Java 11

See original GitHub issue

Hello

My JDK

openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.17.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20191016_371 (JIT enabled, AOT enabled)
OpenJ9   - 77c1cf708
OMR      - 20db4fbc
JCL      - 2a7af5674b based on jdk-11.0.5+10)

Exception

java.lang.IllegalStateException: Failed to execute CommandLineRunner
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:768) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
        at com.example.consumingwebservice.ConsumingWebServiceApplication.main(ConsumingWebServiceApplication.java:15) ~[classes!/:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[gs-consuming-web-service-0.0.1.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[gs-consuming-web-service-0.0.1.jar:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[gs-consuming-web-service-0.0.1.jar:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[gs-consuming-web-service-0.0.1.jar:na]
Caused by: org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: class com.example.consumingwebservice.wsdl.GetCountryRequest nor any of its super class is known to this context.
        at org.springframework.oxm.jaxb.Jaxb2Marshaller.convertJaxbException(Jaxb2Marshaller.java:955) ~[spring-oxm-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
        at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:713) ~[spring-oxm-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
        at org.springframework.ws.support.MarshallingUtils.marshal(MarshallingUtils.java:81) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
        at org.springframework.ws.client.core.WebServiceTemplate$2.doWithMessage(WebServiceTemplate.java:399) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
        at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:590) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
        at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
        at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
        at com.example.consumingwebservice.CountryClient.getCountry(CountryClient.java:25) ~[classes!/:na]
        at com.example.consumingwebservice.ConsumingWebServiceApplication.lambda$lookup$0(ConsumingWebServiceApplication.java:26) ~[classes!/:na]
        at com.example.consumingwebservice.ConsumingWebServiceApplication$$Lambda$287.0000000000000000.run(Unknown Source) ~[na:na]
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:784) ~[spring-boot-2.2.0.RELEASE.jar!/:2.2.0.RELEASE]
        ... 13 common frames omitted
Caused by: javax.xml.bind.JAXBException: class com.example.consumingwebservice.wsdl.GetCountryRequest nor any of its super class is known to this context.
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:563) ~[jaxb-runtime-2.3.2.jar!/:2.3.2]
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:452) ~[jaxb-runtime-2.3.2.jar!/:2.3.2]
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:298) ~[jaxb-runtime-2.3.2.jar!/:2.3.2]
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:226) ~[jaxb-runtime-2.3.2.jar!/:2.3.2]
        at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:709) ~[spring-oxm-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
        ... 22 common frames omitted

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
wilkinsonacommented, Jan 15, 2020

from genJaxb.classesDir is adding the classes to the root of the jar. It is redundant and can be removed.

1reaction
dsyercommented, Jan 15, 2020

I’m not sure why that means the “problem is bigger than this”. The jar file is invalid. Let’s see if someone can fix it, then we can decide.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Gradle doesn't run tests - Stack Overflow
It works with Gradle 6.0.1, Java 8 and 11. In order to run the tests you can use the following command: gradle test...
Read more >
Building Java & JVM projects - Gradle User Manual
If you don't have much experience with building JVM-based projects with Gradle, take a look at the Java samples for step-by-step instructions on...
Read more >
It's time to move your applications to Java 17. Here's why ...
Java SE 11 however is an LTS release, and therefore Oracle Customers will ... The example is built on Java 17 and creates...
Read more >
The Gradle build system- Tutorial - Vogella.com
One example is the Java plug-in. This plug-in adds tasks to your project which allow compiling Java source code, run unit tests and...
Read more >
Building and testing Java with Gradle - GitHub Docs
Using the Gradle starter workflow · The checkout step downloads a copy of your repository on the runner. · The setup-java step configures...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found