'Why does the cxf-codegen maven plugin fail to run the wsdl2java goal on OpenJDK 10?
The following plugin invocation keeps failing:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-resources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/emailIRN.wsdl</wsdl>
<extraargs>
<extraarg>-fe</extraarg>
<extraarg>jaxws21</extraarg>
<extraarg>-verbose</extraarg>
</extraargs>
</wsdlOption>
... more wsdlOption blocks...
There are two warnings:
[WARNING] Error: Could not find or load main class org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java
[WARNING] Caused by: java.lang.ClassNotFoundException: org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java
Then the whole thing fails with:
/usr/lib/jvm/java-10-openjdk-amd64/bin/java --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -jar /tmp/cxf-tmp-975998357168064227/cxf-codegen15218503234725715130.jar /tmp/cxf-tmp-975998357168064227/cxf-w2j6542191939703642136args
Solution 1:[1]
After much trial and error, I realized that the issue with that with OpenJDK 10, the JEE API is not defined. This is causing the plugin to fail silently (regardless of what debugging options are given).
I also changed the plugin to an older version, as the newer one does not seem to be satisfied with the JEE 7 API.
<version>3.2.0</version>
I was able to resolve this by adding the javaee-api dependency as follows:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.2.0</version>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-resources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/emailIRN.wsdl</wsdl>
<extraargs>
<extraarg>-fe</extraarg>
<extraarg>jaxws21</extraarg>
<extraarg>-verbose</extraarg>
</extraargs>
</wsdlOption>
... more wsldOption blocks ...
Solution 2:[2]
drop_duplicates() is the best way if you are using pandas
df['name'] = df['name'].str.lower()
df['score'] = df['score'].astype(int)
df['score'] = df['score'].groupby(df['name']).transform(sum)
df.drop_duplicates(subset='name',keep='first',inplace=True)
output:
class name age score
0 a adi 9 75
1 b leon 8 90
3 d leo 9 95
4 e andy 8 85
you will have this output if you set keep='last':
class name age score
1 b leon 8 90
2 c adi 9 75
3 d leo 9 95
4 e andy 8 85
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 |
