I'm trying to use wsimport to generate classes from a WSDL.
I'm using the Maven POP generated by Netbeans (7.1) but I get the following output when I attempt to build it:
[jaxws:wsimport]
Processing: C:\Users\...\src\wsdl\ShipService_v5.wsdl
jaxws:wsimport args: [-s, C:\Users\...\target\generated-sources\jaxws-wsimport, -d, C:\Users\...\target\classes, -verbose, -catalog, C:\Users\...\src\jax-ws-catalog.xml, -wsdllocation, file:/C:/Users/.../Desktop/ShipService_v5.wsdl, -extension, -Xnocompile, C:\Users\...\src\wsdl\ShipService_v5.wsdl]
parsing WSDL...
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.361s
Finished at: Mon Apr 09 12:51:52 BST 2012
Final Memory: 4M/120M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:jaxws-maven-plugin:1.10:wsimport (wsimport-generate-ShipService_v5) on project RPDataStreams: Error executing: wsimport [-s, C:\Users\...\target\generated-sources\jaxws-wsimport, -d, C:\Users\...\target\classes, -verbose, -catalog, C:\Users\...\src\jax-ws-catalog.xml, -wsdllocation, file:/C:/Users/.../Desktop/ShipService_v5.wsdl, -extension, -Xnocompile, C:\Users\...\src\wsdl\ShipService_v5.wsdl] -> [Help 1]
The Plugin section from my POM is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>ShipService_v5.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>file:/C:/Users/.../Desktop/ShipService_v5.wsdl</wsdlLocation>
<staleFile>${project.build.directory}/jaxws/stale/ShipService_v5.stale</staleFile>
</configuration>
<id>wsimport-generate-ShipService_v5</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>
I know that there's nothing wrong with the WSDL I'm using, I've also tried it with the WSDL from http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl.
I've tried building this project from Netbeans and on the command line from an Ubuntu server, both times I get the same result.
I've now narrowed this down to the dependency on jconfig. If I Comment out the block below then the web service sources are build successfully.
<dependency>
<groupId>org.jconfig</groupId>
<artifactId>jconfig</artifactId>
<version>2.9</version>
<exclusions>
<exclusion>
<artifactId>jmxri</artifactId>
<groupId>com.sun.jmx</groupId>
</exclusion>
</exclusions>
</dependency>
Thanks for the help.
You should use:
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
which is the latest version (notice that the plugin got moved to org.jvnet.jax-ws-commons)
Edit:
You could try selectively excluding jconfig build dependencies. The complete list looks like:
<dependency>
<groupId>org.jconfig</groupId>
<artifactId>jconfig</artifactId>
<version>2.9</version>
<exclusions>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.parsers</groupId>
<artifactId>jaxp-api</artifactId>
</exclusion>
<exclusion>
<groupId>crimson</groupId>
<artifactId>crimson</artifactId>
</exclusion>
</exclusions>
</dependency>
Edit: do you actually need jconfig? If not, just get rid of it.
You might be using JRE rather than JDK.
Please try changing the JDK and Run again maven build.
Change JRE to JDK - http://www.gamefromscratch.com/post/2011/11/15/Telling-Eclipse-to-use-the-JDK-instead-of-JRE.aspx
In the JRE tab of run configuration of your project, select the alternate JRE and add the path of the installed JDK.
For me, doing this solved the issue.
Related
I'm running a little test project where I want my JUL logs to be redirected and appear as log4j2 logs.
I'm using the following Maven dependencies:
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
<version>2.13.3</version>
</dependency>
To use the log4j-jul adapter, I'm supposed to set the system property java.util.logging.manager to org.apache.logging.log4j.jul.LogManager.
When I do that in my project's main method with
System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager");
then logging works as desired. But if I use a JUnit test (run with mvn test) that does the same, like
#Test
public void loggingJULTest() {
System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager");
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(MainTest.class.getName());
julLogger.info("Info Message from JUL");
julLogger.severe("Severe message from JUL");
julLogger.fine("Fine message from JUL");
}
then the logs appear in JUL style instead.
I tried to add the following configuration to Maven's Surefire Plugin in the pom.xml
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.apache.logging.log4j.jul.LogManager</java.util.logging.manager>
<buildDirectory>${project.build.directory}</buildDirectory>
</systemPropertyVariables>
</configuration>
but then the test gives no output and shows a warning
[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file[..]
I'm confused about about what I'm supposed to be doing here.
If you are using version 3.0.0-M5 of the maven-surefire-plugin, you need to add <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/> to the configuration.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
...
</configuration>
</plugin>
</plugins>
</build>
Details: According to the Jira issue SUREFIRE-1614
P.S.: In the future for similar questions, please add version information for Java and Maven.
I have to override dependency in maven plugin: org.apache.maven.plugins:maven-site-plugin:maven-plugin:3.9.1 and in this plugin I have dependency commons-beanutils:commons-beanutils:jar:1.7.0 and I have to override version to ver 1.9.4 and I added dependencies tag with new version of commons-utils but it still doesn't override. When I run mvn dependency:resolve-plugins I still see old version
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
<dependencies>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
</dependencies>
</plugin>
[INFO] org.apache.maven.plugins:maven-site-plugin:maven-plugin:3.3:runtime
[INFO] commons-beanutils:commons-beanutils:jar:1.7.0
As we can see in this log common beanutils is nessesery
[INFO] --- maven-dependency-plugin:3.1.2:resolve-plugins (default-cli) # everything ---
Downloading from central: https://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.pom (357 B at 645 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar (189 kB at 586 kB/s)
And I found where this beanutils is used
org.apache.maven.reporting:maven-reporting-impl:2.3
commons-validator:commons-validator:1.3.1
commons-beanutils:commons-beanutils:1.7.0
maven dependency tree doesn't have any beanutils
and plugins which I'm using are:
org.codehaus.mojo.jaxb2-maven-plugin.2.3.1
org.apache.maven.plugin
org.springframework.boot.spring-boot-maven-plugin
org.jacoco.jacoco-maven-plugin.0.8.7
Thanks in advance for help
You can double check your dependencies one by one to find more dependencies which are using maven-reporting-impl:2.3. Somehow I think what could be reason for that is jaxb2-maven-plugin.2.3.1. The maven-checkstyle-plugin is defined in the pom of the plugin. It has a dependence to maven-reporting-impl:2.3
jaxb2-maven-plugin
<reporting>
<plugins>
<!-- Apache plugins in alphabetical order -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<skip>true</skip>
<configLocation>config/maven_checks.xml</configLocation>
<headerLocation>config/maven-header.txt</headerLocation>
</configuration>
</plugin>
</plugins>
</reporting>
maven-checkstyle-plugin
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>2.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
</exclusion>
</exclusions>
</dependency>
You are not possible to override as it comes from another project
Trying to build an example from camel via mvn package
apache-camel-2.22.0/examples/camel-example-cdi-xml
Getting an error never seen before, i checked dependency tree for transitive deps and apache-collections is 3.2.1 and not corrupt so can't explain it, obviously i know what it means, just can't figure out why it's happening because everything that should be required is provided:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (process-resource-bundles) on project camel-example-cdi-xml: Execution process-resource-bundles of goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process failed: A required class was missing while executing org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process: org/apache/commons/collections/ExtendedProperties
Not really sure how to trouble shoot it.
I tried building with several different versions of maven. JDK = 1.8
update pom.xml add the following code
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.6.0</version>
<dependencies>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
I have a project that uses Netty 4.0.29 and I have another dependency that pulls in netty 3.9.0. I put in an exclusion but it is still roping in 3.9.0 when I run copy-dependencies.
<dependency>
<groupId>com.ning</groupId>
<artifactId>async-http-client</artifactId>
<version>1.9.31</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
</exclusions>
</dependency>
If I run mvn dependency:tree with this exclusion in place, I see that it is indeed excluded:
[INFO] +- com.ning:async-http-client:jar:1.9.31:compile
But when I run mvn clean dependency:copy-dependencies I see the jar 3.9.0 being copied along with the 4.0.29. According to the documentation and Google, this should not copy when there is an exclusion.
[INFO] Copying netty-3.9.0.Final.jar to /Users/udonom1/wk/141/coursecopy-api/target/dependency/netty-3.9.0.Final.jar
[INFO] Copying netty-all-4.0.29.Final.jar to /Users/udonom1/wk/141/coursecopy-api/target/dependency/netty-all-4.0.29.Final.jar
I tried excluding as suggested by the first answer below and that did not work.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeArtifactIds>io.netty:netty:3.9.0.Final</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
I also added a dependency as further suggested:
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.29.Final</version>
</dependency>
What am I doing wrong?
For those who are having the same issue. I used mvn -X and discovered that dependency:tree is omitting two other jars that are referencing netty. I added exclusions for those and I'm good to go. Spent a whole day on this.
If you are writing not library you have simple way to control versions of any dependency in your project - dependencyManagement block in root pom file, example:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>4.0.29.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
Additional bonuses from this block - you can omit version and scope for dependency in concrete dependency (with same group id, artifact id and packaging).
PS another look to your dependencies make me ask you: are you sure that this dependency have single maven artifact id? netty-all-4.0.29.Final.jar - seems that this artifact should have netty-all artifact id... If they have different artifact id's my recipe wouldn't help. In this case you should define build configuration for maven-dependency-plugin, example:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<configuration>
<excludeArtifactIds>io.netty:netty:3.9.0.Final</excludeArtifactIds>
</configuration>
</plugin>
</plugins>
</build>
or just use -DexcludeArtifactIds parameter in your maven call
I am running a maven script which uses maven-jaxb1-plugin version 1.0.rc-11 to generate the jaxb classes from xsd. The script was running successfully in the java version 1.4 and maven version less than 3 . Now the same script when run in java version 1.6 and maven version 3.0.3 environment throws an exception **
A required class was missing while executing
org.jvnet.jaxb1.maven2:maven-jaxb1-plugin:1.0.rc-11:generate:com.sun.msv.grammar.Grammar
**
All the dependencies for this plugin are available in my repository.Still I am getting this error.
Below is my pom.xml
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>javax.xml.parsers</groupId>
<artifactId>jaxp-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb1.maven2</groupId>
<artifactId>maven-jaxb1-plugin</artifactId>
<version>1.0.rc-11</version>
<executions>
<execution>
<configuration>
<schemaIncludes>
<include>response.xsd</include>
</schemaIncludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Is it like maven-jaxb1-plugin can not be used in jdk1.6 and maven 3.0.3 environment.Any help is much appreciated,Thanks.
The class that it says it is missing, com.sun.msv.grammar.Grammar, is present in jaxb1-impl.jar according to findjar.com:
http://www.findjar.com/class/com/sun/msv/grammar/Grammar.html
That class does not seem to be present in jaxb-impl.jar:
http://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl/1.0.6
It does seem to be present in jaxb1-impl.jar:
http://mvnrepository.com/artifact/com.sun.xml.bind/jaxb1-impl/2.0
So maybe change your dependency to:
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb1-impl</artifactId>
<version>2.0</version>
</dependency>