dice-group / sask

Projectgroups Search and Extraction
GNU Affero General Public License v3.0
2 stars 10 forks source link

Chatbot throws JAXB-API excetpion #77

Open sajjadpz opened 6 years ago

sajjadpz commented 6 years ago

I am running chatbot within IDE and it throws following exception

2018-07-12 13:20:18.019 ERROR [localhost-startStop-1] "chatbot" [com.sun.jersey.server.impl.wadl.WadlApplicationContextImpl] c.s.j.s.i.w.WadlApplicationContextImpl - Implementation of JAXB-API has not been found on module path or classpath.
javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:177)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:364)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:508)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:465)

A bit of research showed that it it is related to Java-9 modularity and a worked around has already been implemented in pom.xml

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!-- ~~~~~~~ support java 9 ~~~~~~~ -->
                    <!-- https://blog.frankel.ch/migrating-to-java-9/1/ -->
                    <jvmArguments>--add-modules java.xml.bind</jvmArguments>
                </configuration>
            </plugin>

which doesn't seem to work. May be someone can look into it who has more insight on this. The application, however seems to work normally, its just an annoying error in the console 😄

prasanthhs commented 6 years ago

@sajjadpz Does adding jaxb explicitly as pom dependency solve your problem? This code is there inside chatbot micro service but is not part of the parent pom.

javax.xml.bind jaxb-api 2.3.0
sajjadpz commented 6 years ago

No it doesn't solve the issue.

prasanthhs commented 6 years ago

That seems to be the only solution available for this issue on the internet. A set of related dependancies to add to pom.xml to avoid this problem.

RicardoUsbeck commented 6 years ago

What is your JDK version? Update your JDK to 10 , it might be a java 8/9 problem

Muzammil1234 commented 6 years ago

Try running by adding dependency at run time, something like this

java --add-modules=java.xml.bind -jar chatbot.jar, there must a way to add use this add module with spring-boot:run too, just search for it.

P.S: It's Guru here

sajjadpz commented 6 years ago

@RicardoUsbeck - I have checked , jdk version is 10.

sajjadpz commented 6 years ago

@guru5590 - it is already added in pom.xml of parent project. Which itself passes those parameters at run time.