Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to get public no-arg constructor

Recently I have imported Paho MQTT Spy project into Eclipse. Got error atthe end of import:

building has encouted a problem. An internal error occured during: "Build"

An internal error occurred during: "Building".
com.sun.tools.xjc.Plugin: com.sun.tools.xjc.addon.accessors.PluginImpl Unable to get public no-arg constructor

Why I'm getting this message and what does it means? How to fix it?

I'm using Java 13.0.1

I was trying to build mqtt-spy project with maven and got the same error.

I added dependecies below to to pom.xml

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
</dependency>

And now pom.xml looks like below:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.eclipse.paho.mqttspy</groupId>
    <artifactId>mqtt-spy</artifactId>
    <version>1.0.1-beta</version>
    <packaging>jar</packaging>

    <name>mqtt-spy</name>
    <url>https://github.com/eclipse/paho.mqtt-spy</url>

    <scm>
        <connection>scm:git:../.git</connection>
        <url>../.git</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.number>${buildNumber}</project.build.number>

        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyy</maven.build.timestamp.format>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <jaxb2.plugin.version>0.12.1</jaxb2.plugin.version>
        <jaxb2.basics.version>0.11.1</jaxb2.basics.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx</artifactId>
            <version>11</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.eclipse.paho.mqttspy</groupId>
            <artifactId>spy-common</artifactId>
            <version>1.0.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.eclipse.paho.mqttspy</groupId>
            <artifactId>spy-common-ui</artifactId>
            <version>1.0.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.eclipse.paho.mqttspy</groupId>
            <artifactId>mqtt-spy-common</artifactId>
            <version>1.0.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>3.0</version>
        </dependency>

        <!--=== TEST === -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>2.1_3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jmock</groupId>
            <artifactId>jmock-legacy</artifactId>
            <version>2.5.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.objenesis</groupId>
            <artifactId>objenesis</artifactId>
            <version>1.0</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <finalName>${project.artifactId}-${project.version}-b${buildNumber}</finalName>

        <!-- Populate version number in the properties file -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/mqtt-spy.properties</include>
                </includes>
            </resource>

            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/mqtt-spy.properties</exclude>
                </excludes>
            </resource>

        </resources>

        <plugins>

            <!-- Exclude files -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>package-client</id>
                        <phase>package</phase>
                        <configuration>
                            <classifier>exclusions</classifier>
                            <excludes>
                                <exclude>**/log4j.properties</exclude>
                            </excludes>
                        </configuration>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Create a runnable jar with all dependencies -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>pl.baczkowicz.mqttspy.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Generate build number -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>true</doCheck>
                    <doUpdate>true</doUpdate>
                    <buildNumberPropertiesFileLocation>buildNumber.properties</buildNumberPropertiesFileLocation>
                    <format>{0,number,###}</format>
                    <items>
                        <item>buildNumber</item>
                    </items>
                </configuration>
            </plugin>

            <!-- Generate JAXB clases -->
            <plugin>
                <groupId>org.jvnet.jaxb2_commons</groupId>
                <artifactId>jaxb2-basics</artifactId>
                <version>${jaxb2.basics.version}</version>
            </plugin>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>${jaxb2.plugin.version}</version>
                <executions>
                    <execution>
                        <id>configuration</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <locale>en</locale>
                            <schemaDirectory>src/main/resources/</schemaDirectory>
                            <schemaIncludes>
                                <include>mqtt-spy-configuration.xsd</include>
                            </schemaIncludes>

                            <!-- Default to the schemaDirectory -->
                            <bindingDirectory>src/main/resources</bindingDirectory>
                            <bindingIncludes>
                                <include>**/mqtt-spy-configuration-bindings.xjb</include>
                            </bindingIncludes>

                            <generateDirectory>src/main/java/</generateDirectory>
                            <generatePackage>pl.baczkowicz.mqttspy.configuration.generated</generatePackage>
                            <removeOldOutput>false</removeOldOutput>

                            <strict>false</strict>
                            <catalogs>
                                <catalog>
                                    <dependencyResource>
                                        <groupId>org.eclipse.paho.mqttspy</groupId>
                                        <artifactId>mqtt-spy-common</artifactId>
                                        <resource>mqtt-spy-common.catalog</resource>
                                    </dependencyResource>
                                </catalog>
                                <catalog>
                                    <dependencyResource>
                                        <groupId>org.eclipse.paho.mqttspy</groupId>
                                        <artifactId>spy-common</artifactId>
                                        <resource>spy-common.catalog</resource>
                                    </dependencyResource>
                                </catalog>
                            </catalogs>

                            <episode>true</episode>
                            <!-- <episodeFile>src/main/java/META-INF/mqtt-spy-configuration.episode</episodeFile> -->

                            <episodes>
                                <episode>
                                    <groupId>org.eclipse.paho.mqttspy</groupId>
                                    <artifactId>mqtt-spy-common</artifactId>
                                </episode>
                                <episode>
                                    <groupId>org.eclipse.paho.mqttspy</groupId>
                                    <artifactId>spy-common</artifactId>
                                </episode>
                            </episodes>

                            <args>
                                <arg>-XtoString</arg>
                                <arg>-Xequals</arg>
                                <arg>-XhashCode</arg>
                                <arg>-Xcopyable</arg>
                                <arg>-Xvalue-constructor</arg>
                            </args>
                            <plugins>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics</artifactId>
                                    <version>${jaxb2.basics.version}</version>
                                </plugin>
                            </plugins>
                        </configuration>
                    </execution>

                    <execution>
                        <id>stats</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <locale>en</locale>
                            <schemaDirectory>src/main/resources/</schemaDirectory>
                            <schemaIncludes>
                                <include>mqtt-spy-stats.xsd</include>

                            </schemaIncludes>

                            <!-- Default to the schemaDirectory -->
                            <bindingDirectory>src/main/resources</bindingDirectory>
                            <bindingIncludes>
                                <include>**/mqtt-spy-stats-bindings.xjb</include>
                            </bindingIncludes>

                            <generateDirectory>src/main/java/</generateDirectory>
                            <generatePackage>pl.baczkowicz.mqttspy.stats.generated</generatePackage>
                            <removeOldOutput>false</removeOldOutput>

                            <episode>false</episode>
                            <!-- <episodeFile>src/main/java/META-INF/mqtt-spy-stats.episode</episodeFile> -->

                            <args>
                                <arg>-XtoString</arg>
                                <arg>-Xequals</arg>
                                <arg>-XhashCode</arg>
                                <arg>-Xcopyable</arg>
                            </args>
                            <plugins>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics</artifactId>
                                    <version>${jaxb2.basics.version}</version>
                                </plugin>
                            </plugins>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-value-constructor</artifactId>
                        <version>3.0</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <id>replace</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <basedir>${basedir}/src/main/java</basedir>
                    <includes>
                        <include>pl/baczkowicz/mqttspy/configuration/generated/**/*.java</include>
                        <include>pl/baczkowicz/mqttspy/stats/generated/**/*.java</include>
                    </includes>
                    <replacements>
                        <replacement>
                            <token>//${line.separator}// This file was generated by the
                                JavaTM</token>
                            <value>//
                                // Copyright (c) ${maven.build.timestamp} Kamil Baczkowicz
                                //
                                // CSOFF: a.*
                                // This file was generated by the JavaTM</value>
                        </replacement>
                        <replacement>
                            <token>^ \*/</token>
                            <value> */
                                @SuppressWarnings("all")</value>
                        </replacement>
                        <replacement>
                            <token>^// Generated on.*$</token>
                            <value>// Timestamp removed by maven-replacer-plugin to avoid
                                detecting changes - see the project POM for details</value>
                        </replacement>
                    </replacements>
                    <regex>true</regex>
                    <quiet>false</quiet>
                    <regexFlags>
                        <regexFlag>MULTILINE</regexFlag>
                    </regexFlags>
                </configuration>
            </plugin>

        </plugins>

    </build>

</project>

Maven gives error:

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.eclipse.paho.mqttspy:mqtt-spy:jar:1.0.1-beta
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 162, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -----------------< org.eclipse.paho.mqttspy:mqtt-spy >------------------
[INFO] Building mqtt-spy 1.0.1-beta
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.eclipse.paho.mqttspy:spy-common:jar:1.0.1 is missing, no dependency information available
[WARNING] The POM for org.eclipse.paho.mqttspy:spy-common-ui:jar:1.0.1 is missing, no dependency information available
[WARNING] The POM for org.eclipse.paho.mqttspy:mqtt-spy-common:jar:1.0.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.384 s
[INFO] Finished at: 2020-01-08T16:10:33+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mqtt-spy: Could not resolve dependencies for project org.eclipse.paho.mqttspy:mqtt-spy:jar:1.0.1-beta: The following artifacts could not be resolved: org.eclipse.paho.mqttspy:spy-common:jar:1.0.1, org.eclipse.paho.mqttspy:spy-common-ui:jar:1.0.1, org.eclipse.paho.mqttspy:mqtt-spy-common:jar:1.0.1: Failure to find org.eclipse.paho.mqttspy:spy-common:jar:1.0.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

UPD

Java 8 solves problem, but I still trying to make java 13 work with it.

Trying to build very root project with pom.xml defined below. pom.xml now contains required javax dependencies.

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 

    <modelVersion>4.0.0</modelVersion> 

    <name>mqtt-spy project</name> 
    <groupId>pl.baczkowicz.mqttspy</groupId>
    <artifactId>mqtt-spy-pom</artifactId>

    <packaging>pom</packaging> 
    <version>0.0.1-SNAPSHOT</version> 

    <properties>
        <main.basedir>${project.basedir}</main.basedir>
    </properties>


    <dependencies>  
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

    </dependencies>

    <!-- Include all modules in correct order. --> 
    <modules> 
        <module>spy-common</module> 
        <module>spy-common-ui</module> 
        <module>mqtt-spy-common</module> 
        <module>mqtt-spy-daemon</module>
        <module>mqtt-spy</module>  
    </modules> 

</project> 

Got same error:

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.eclipse.paho.mqttspy:mqtt-spy-daemon:jar:1.0.0
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 113, column 15
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.eclipse.paho.mqttspy:mqtt-spy:jar:1.0.1-beta
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 162, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] spy-common                                                         [jar]
[INFO] spy-common-ui                                                      [jar]
[INFO] mqtt-spy-common                                                    [jar]
[INFO] mqtt-spy-daemon                                                    [jar]
[INFO] mqtt-spy                                                           [jar]
[INFO] mqtt-spy project                                                   [pom]
[INFO]
[INFO] ----------------< org.eclipse.paho.mqttspy:spy-common >-----------------
[INFO] Building spy-common 1.0.1                                          [1/6]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-xjc:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-jaxb2-plugin:0.12.1:generate (spy-common) @ spy-common ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] spy-common 1.0.1 ................................... FAILURE [  0.737 s]
[INFO] spy-common-ui 1.0.1 ................................ SKIPPED
[INFO] mqtt-spy-common 1.0.1 .............................. SKIPPED
[INFO] mqtt-spy-daemon 1.0.0 .............................. SKIPPED
[INFO] mqtt-spy 1.0.1-beta ................................ SKIPPED
[INFO] mqtt-spy project 0.0.1-SNAPSHOT .................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.910 s
[INFO] Finished at: 2020-01-08T20:05:25+02:00
[INFO] ------------------------------------------------------------------------

......

---------------------------------------------------
Exception in thread "main" java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: com.sun.tools.xjc.addon.accessors.PluginImpl Unable to get public no-arg constructor
        at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:583)
        at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:674)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1233)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1265)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385)
        at com.sun.tools.xjc.Options.findServices(Options.java:960)
        at com.sun.tools.xjc.Options.getAllPlugins(Options.java:374)
        at com.sun.tools.xjc.Options.parseArgument(Options.java:688)
        at com.sun.tools.xjc.Options.parseArguments(Options.java:812)
        at org.jvnet.mjiip.v_2.OptionsFactory.createOptions(OptionsFactory.java:87)
        at org.jvnet.mjiip.v_2.OptionsFactory.createOptions(OptionsFactory.java:18)
        at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:462)
        at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:311)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlAccessType
        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3138)
        at java.base/java.lang.Class.getConstructor0(Class.java:3343)
        at java.base/java.lang.Class.getConstructor(Class.java:2152)
        at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:661)
        at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:658)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
        at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:669)
        ... 34 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlAccessType
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        ... 42 more
like image 922
vico Avatar asked Jan 08 '20 12:01

vico


People also ask

Why does JPA require no-arg constructor?

The JPA specification requires that all persistent classes have a no-arg constructor. This constructor may be public or protected. Because the compiler automatically creates a default no-arg constructor when no other constructor is defined, only classes that define constructors must also include a no-arg constructor.

Why Hibernate has no-arg constructor?

Though, In the case of Hibernate Persistent classes or Entities, it's must to provide a no argument constructor, so that Hibernate can create instance of Persistence classes, when you hibernate load them from database. It also uses newInstance() method to create instance of persistent classes.

What is a no args constructor?

No-Arg Constructor - a constructor that does not accept any arguments. Parameterized constructor - a constructor that accepts arguments. Default Constructor - a constructor that is automatically created by the Java compiler if it is not explicitly defined.


1 Answers

You are propably not using JAVA 8. Please define Java 8 in project properties and try to build it again. If you are using Java9 or greater, since they droped the use of classpath you need to add --add-modules java.xml.bind as a JVM param in order to wire the mdule

like image 180
Alexius DIAKOGIANNIS Avatar answered Sep 18 '22 15:09

Alexius DIAKOGIANNIS