mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
106 stars 77 forks source link

Eclipse error: Execution of XJC goal... A required class was missing.. #118

Open edtshuma opened 6 years ago

edtshuma commented 6 years ago

In my Spring SOAP web service when I run

mvn eclipse:eclipse I get an exception:

A required class was missing while executing org.codehaus.mojo:jaxb2-maven-plugin:2.2:xjc: com/sun/codemodel/CodeWriter*.

1)`Specifying a JDK for my Eclipse installation in eclipse.ini. I am not sure however if i should remove the Default JRE definition in the IDE and if so should i define a new JRE that pints to my JDK. 2)Force update of project and release snapshots. 3) I have checked the relevant jars in in my repository to see if they are any a malformed(size) but they are all ok. I am using Eclipse Oxygen.3a Release (4.7.3a).Build id: 20180405-1200 .Also Spring Boot 1.5.9,,wsdl4j Ver 1.6.3, jaxb-api 2.3.0 In my pom.xml i have:

<plugins>
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
              </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <id>xjc-schema</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <sources>
                          <source>src/main/resources/xsds</source>
                        </sources>
                        <packageName>webservices.disburse.generated</packageName>
                <clearOutputDir>false</clearOutputDir>
            </configuration>
          </plugin>
      </plugins>

In my disburse.xsd i have:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:tns="http://www.onewallet.com/webservices/disburse/generated"
           targetNamespace="http://www.onewallet.com/webservices/disburse/generated" elementFormDefault="qualified">     
     <xs:element name="getAllDisbursementsRequest">
        <xs:complexType/>
    </xs:element>    
    <xs:element name="getAllDisbursementsResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="disburseInfo" type="tns:disburseInfo" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>   
    <xs:complexType name="serviceStatus">
        <xs:sequence>
            <xs:element name="statusCode" type="xs:string"/>
            <xs:element name="message" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>     
</xs:schema>

.Any assistance on what i may be missing would be greatly appreciated.

ghost commented 6 years ago

Which version of JRE/JDK are you using ? This error sound familiar, I think it was one of the errors I got when trying it on Java 9 (which jax2-maven-plugin does not yet work on).

edtshuma commented 6 years ago

JDK im using ver 1.8..

edtshuma commented 6 years ago

Did you get a workaround in your case? I am following the example here https://www.concretepage.com/spring-boot/spring-boot-soap-web-service-example. Let me know if im missing something else that might not be apparent

ghost commented 6 years ago

Well my problem was related to Java 9/10. So I had to stay with Java 1.8. Your problem must be something else. (I thought it unlikely you were on Java 9 (since your not using Spring Boot 2) but I thought it was a possibility)

joshimanish1986 commented 5 years ago

I am facing similar issues. It worked fine on the previous workspace, but fails on a new workspace.