Reputation: 919
Im trying to generate sources from a wsdl file, but I keep running into an error on my pom.xml that I believe might be my issue? Below is the error that I get from my pom, and my pom file. Also I cannot build the project with "mvn clean install". I just seem to get an error with no real cause.
The error at the generates tag:
Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate: com/sun/codemodel/CodeWriter
-----------------------------------------------------
realm = plugin>org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3-715230752
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/Windows/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin/0.12.3/maven-jaxb2-plugin-0.12.3.jar
urls[1] = file:/C:/Users/Windows/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin-core/0.12.3/maven-jaxb2-plugin-core-0.12.3.jar
urls[2] = file:/C:/Users/Windows/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
urls[3] = file:/C:/Users/Windows/.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar
urls[4] = file:/C:/Users/Windows/.m2/repository/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar
urls[5] = file:/C:/Users/Windows/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar
urls[6] = file:/C:/Users/Windows/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar
urls[7] = file:/C:/Users/Windows/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb22-plugin/0.12.3/maven-jaxb22-plugin-0.12.3.jar
urls[8] = file:/C:/Users/Windows/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
urls[9] = file:/C:/Users/Windows/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
urls[10] = file:/C:/Users/Windows/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.2/maven-plugin-annotations-3.2.jar
Number of foreign imports: 5
import: Entry[import org.sonatype.plexus.build.incremental from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.Scanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.DirectoryScanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.AbstractScanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
-----------------------------------------------------
(org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate:default:generate-sources)
my pom.xml file :
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>com.bigthunk</groupId>
<artifactId>BigThunkCore</artifactId>
<version>0.0.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.bigthunk</groupId>
<artifactId>BigThunkWeb</artifactId>
<version>0.0.4-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::wsdl[] -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>hello.wsdl</generatePackage>
<forceRegenerate>true</forceRegenerate>
<schemas>
<schema>
<url>http://172.19.137.21:8280/services/umarketsc?wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
<!-- end::wsdl[] -->
</plugins>
</build>
<repositories>
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
Upvotes: 22
Views: 49608
Reputation: 39
I fixed similar problem just by updating maven-jaxb2-plugin to latest version (0.15.3)
Upvotes: 0
Reputation: 11
I had the same issue and setting an environment variable for jdk worked.
e.g. JAVA_HOME=C:\yourfilepath\jdk-11.0.13.8-hotspot
Upvotes: 0
Reputation: 605
Personnally, I'm using sdkman to manage my Java versions and I solved the problem by switching from Java 11 to 8 before running the Maven command.
Upvotes: 0
Reputation: 201
I had this problem, but I was able to solve it:
C:\Program Files\Java\jdk1.8.0_91\jre\bin
(I work on Win10)Problem was on version 0.12.2 - 0.13.1 and it totally disappeared.
Upvotes: 1
Reputation: 832
For me this is a environment (java runtime) problem. I could solve similar issue triggered by m2e in my context, by launching eclipse in Windows command prompt : eclipse.exe -vm "C:\Program Files\Java\jdk1.8.0_25\bin\javaw.exe" (ensure it comes before "-vmargs") Then i tried to clean up my eclipse.ini in the same way to launch eclipse from explorer, it does work. When I have look at the eclipse command in Javavisual VM I see through Jvisual vm that eclipse looks that way
eclipse.commands=-os
win32
...
-vm "C:\Program Files\Java\jdk1.8.0_25\bin\javaw.exe"
-vm C:\Program Files\Java\jre1.8.0_25\bin\server\jvm.dll
Last line does not come from my eclipse.ini, but was appended by Eclipse launcher.In the system prooperties: eclipse.vm=C:\Program Files\Java\jre1.8.0_25\bin\server\jvm.dll This looks like "when launched from explorer", Eclipse luna appends parameter from jre found on the PATH which overrides eclipse.ini... There must be some difference in the environment that can account for the different behaviour of the process.
Upvotes: 3
Reputation: 19074
Enclosing the <plugins>
tag inside <pluginManagement>
tag (as detailed here: How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds) fixed the issue for me.
Upvotes: 42
Reputation: 2112
Add
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
to your pom, it contains the missing class, with this I fixed it.
Upvotes: 0
Reputation: 326
In my case, I fixed it by changing the JAXB specification version as instructed in the plugin wiki:
https://github.com/highsource/maven-jaxb2-plugin/wiki/Using-a-Specific-JAXB-Version
Either by using the config option specVersion=2.0 or by using the version-specific plugin: maven-jaxb20-plugin
Upvotes: 4
Reputation: 109
Change your Java Path jre to your jdk path and it will be fine! In Eclipse you can also change your "Installed JRE" to your jdk.
Hope it will work for you.
Upvotes: 10