Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile WSDL files using the version 3.1.0 #245

Open
aduilio opened this issue Jan 25, 2023 · 5 comments
Open

Compile WSDL files using the version 3.1.0 #245

aduilio opened this issue Jan 25, 2023 · 5 comments

Comments

@aduilio
Copy link

aduilio commented Jan 25, 2023

I'm using the version 2.5.0 and it is working properly.
I'm trying to update to the version 3.1.0, because I need to generate the Java classes with Jakarta packages instead of javax ones.
I've tried the solution described here #171, changing the dependencies and I have the same behaviour when using the plugin 3.1.0:

org.xml.sax.SAXParseException: Are you trying to compile WSDL? Support for WSDL is experimental. You may enable it by using the -wsdl option.
    at com.sun.tools.xjc.ErrorReceiver.warning (ErrorReceiver.java:76)
    at com.sun.tools.xjc.ModelLoader.sanityCheck (ModelLoader.java:176)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:90)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:76)
    at com.sun.tools.xjc.Driver.run (Driver.java:324)
    at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution (AbstractJavaGeneratorMojo.java:476)
    at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute (AbstractJaxbMojo.java:337)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at com.soebes.maven.plugins.iterator.IteratorMojo.executeMojo (IteratorMojo.java:406)
    at com.soebes.maven.plugins.iterator.IteratorMojo.handlePluginExecution (IteratorMojo.java:305)
    at com.soebes.maven.plugins.iterator.IteratorMojo.execute (IteratorMojo.java:235)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

Actually what I need is: generate Java classes with Jakarta packages from WSDL files, not matter the plugin version.

@Ikrao
Copy link

Ikrao commented Jun 5, 2023

I am also facing same issue do u find solution?

@aduilio
Copy link
Author

aduilio commented Jun 5, 2023

@Ikrao I noticed this is a warning and not an error. I just add this option to remove the logs:

<configuration>
    <quiet>yes<quiet>
</configuration>

@Ikrao
Copy link

Ikrao commented Jun 5, 2023

                     <plugin>
		<groupId>com.evolvedbinary.maven.jvnet</groupId>
    		<artifactId>jaxb30-maven-plugin</artifactId>
    		<version>0.15.0</version>
		<dependencies>
                <dependency>
                    <groupId>org.glassfish.jaxb</groupId>
     				<artifactId>jaxb-runtime</artifactId>
     				<version>2.3.1</version>
                 </dependency>
            </dependencies>
			<executions>
				<execution>
					<goals>
						<goal>generate</goal>
					</goals>
				</execution>
			</executions>
			<configuration>
				<schemaDirectory>${resourcePath}/wsdl/</schemaDirectory>
				<schemaIncludes>
					<include>*.wsdl</include>
				</schemaIncludes>
				<quiet>yes</quiet>
			</configuration>
		</plugin>

still same issue:

[INFO] --- jaxb30-maven-plugin:0.15.0:generate (default) @ ---
[INFO] Sources are not up-to-date, XJC will be executed.
[ERROR] Error while parsing schema(s).Location [ file:/C:/xxxxx//xxxxxxx.wsdl{11,51}].
org.xml.sax.SAXParseException: s4s-elt-schema-ns: The namespace of element 'definitions' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'
.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:204)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error (ErrorHandlerWrapper.java:135)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:396)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr (XSDHandler.java:4254)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError (XSDHandler.java:4237)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.reportSchemaError (XSAttributeChecker.java:1573)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes (XSAttributeChecker.java:993)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes (XSAttributeChecker.java:960)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDocumentInfo. (XSDocumentInfo.java:106)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees (XSDHandler.java:824)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema (XSDHandler.java:653)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema (XMLSchemaLoader.java:618)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar (XMLSchemaLoader.java:577)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar (XMLSchemaLoader.java:543)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema (XMLSchemaFactory.java:281)
at com.sun.tools.xjc.reader.xmlschema.parser.SchemaConst

@HoneyBadgerSeeker
Copy link

HoneyBadgerSeeker commented Sep 21, 2023

It worked for me with the following configuration:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>3.1.0</version>
                <!-- https://github.com/mojohaus/jaxb2-maven-plugin/issues/245 -->
                <dependencies>
                    <dependency>
                        <groupId>jakarta.xml.bind</groupId>
                        <artifactId>jakarta.xml.bind-api</artifactId>
                        <version>3.0.1</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-xjc</artifactId>
                        <version>3.0.0</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-jxc</artifactId>
                        <version>3.0.0</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-impl</artifactId>
                        <version>3.0.0</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>2.3.1</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sources>
                        <source>yourPathToWsdl</source>
                    </sources>
                    <sourceType>wsdl</sourceType>
                    <outputDirectory>yourDirectory</outputDirectory>
                    <packageName>yourPackageName</packageName>
                    <laxSchemaValidation>true</laxSchemaValidation>
                    <failOnNoSchemas>false</failOnNoSchemas>
                    <xjbSources>
                         <xjbSource>pathToBindingXjc</xjbSource>
                     </xjbSources>
                </configuration>
            </plugin>

@apoorvam
Copy link

Hi is there a solution/workaround for this error? I am seeing same error with plugin v3.1.0 using Java 17 as I am in process of upgrading my app from java 1.8 to 17.

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>autogen-public-classes</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                        <configuration>
							<sources>
								<source>src/main/resources/wsdl/open</source>
							</sources>
                            <packageName>xxx</packageName>
                            <sourceType>wsdl</sourceType>
                            <outputDirectory>target/generated-sources/xxx</outputDirectory>
                            <clearOutputDir>true</clearOutputDir>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants