Lỗi: Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed

Lượt xem: 731

Bub

Bub

Administrator
Ban Quản Trị
3 Tháng chín 2015
454
75
28
HCMC
4online.net


Lỗi xảy ra khi generate tự động các class từ WSDL sử dụng maven trong spring mvc.
Chi tiết mã lỗi:
Mã:
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/xml/bind/v2/model/core/TypeInfoSet ----------------------------------------------------- realm = plugin>org.jvnet.jaxb2.maven2:maven-jaxb2-
plugin:0.12.3 strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy urls[0] = file:/C:/Users/datdaot/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin/
0.12.3/maven-jaxb2-plugin-0.12.3.jar urls[1] = file:/C:/Users/datdaot/.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/datdaot/.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar urls[3] = file:/C:/Users/datdaot/.m2/
repository/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar urls[4] = file:/C:/Users/datdaot/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar urls[5] =
file:/C:/Users/datdaot/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar urls[6] = file:/C:/Users/datdaot/.m2/repository/org/jvnet/jaxb2/maven2/
maven-jaxb22-plugin/0.12.3/maven-jaxb22-plugin-0.12.3.jar urls[7] = file:/C:/Users/datdaot/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
urls[8] = file:/C:/Users/datdaot/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar urls[9] = file:/C:/Users/datdaot/.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]] -----------------------------------------------------
Cách sửa lỗi đơn giản nhất là thay đổi version của maven-jaxb2-plugin từ 0.12.3 xuống 0.12.1
và thêm <generateDirectory>${project.build.sourceDirectory} </generateDirectory>
HTML:
<executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaLanguage>WSDL</schemaLanguage>
                    <generatePackage>com.test.wsconsumer.wsdl</generatePackage>
                    <schemas>
                        <schema>
                            <url>http://localhost:8080/ws/countries.wsdl</url>
                        </schema>
                    </schemas>
                </configuration>
....
thành
HTML:
<executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaLanguage>WSDL</schemaLanguage>
                    <generateDirectory>${project.build.sourceDirectory}                                                    </generateDirectory>
                    <generatePackage>com.test.wsconsumer.wsdl</generatePackage>
                    <schemas>
                        <schema>
                            <url>http://localhost:8080/ws/countries.wsdl</url>
                        </schema>
                    </schemas>
  </configuration>
....