jaxb2-maven-plugin icon indicating copy to clipboard operation
jaxb2-maven-plugin copied to clipboard

org.xml.sax.SAXParseException: generating code

Open zosrothko opened this issue 6 years ago • 4 comments

Hi I am running this configuration

<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>jaxb2-maven-plugin</artifactId>
	<version>2.4</version>
	<executions>
		<execution>
			<goals>
				<goal>xjc</goal>
			</goals>
			<configuration>
				<outputDirectory>src-generated</outputDirectory>
				<packageName>com.scort.logconfigurator.jaxb</packageName>
				<schemaDirectory>src/main/xsd</schemaDirectory>
				<schemaFiles>logmetadata.xsd</schemaFiles>
				<clearOutputDir>true</clearOutputDir>
				<extension>true</extension>
				<verbose>true</verbose>
			</configuration>
		</execution>
	</executions>
</plugin>

with those src/main/xsd files log4j.xsd.txt log4j1.xsd.txt logmetadata.xsd.txt

and got this exception

Z:\MXW\MI\MI-4.3\LogConfigurator>C:\ASF\apache-maven-3.5.4\bin\mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ----------< com.scort.mi.logconfigurator:scortlogconfigcore >-----------
[INFO] Building Scort LogConfigurator Core Library 1.3.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ scortlogconfigcore ---
[INFO] Deleting Z:\MXW\MI\MI-4.3\LogConfigurator\target
[INFO] Deleting Z:\MXW\MI\MI-4.3\LogConfigurator\src-generated (includes = [*], excludes = [])
[INFO] Deleting Z:\MXW\MI\MI-4.3\LogConfigurator\xmlbeans (includes = [*], excludes = [])
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ scortlogconfigcore ---
[INFO]
[INFO] --- xmlbeans-maven-plugin:2.3.3:xmlbeans (default) @ scortlogconfigcore ---
[INFO]
[INFO] --- jaxb2-maven-plugin:2.4:xjc (default) @ scortlogconfigcore ---
[INFO] Created EpisodePath [Z:\MXW\MI\MI-4.3\LogConfigurator\src-generated\META-INF\JAXB]: true
[INFO] Created EpisodePath [Z:\MXW\MI\MI-4.3\LogConfigurator\src-generated\META-INF\JAXB]: true
[INFO] null [-1,-1]
org.xml.sax.SAXParseException: generating code
    at com.sun.tools.xjc.ErrorReceiver.debug (ErrorReceiver.java:140)
    at com.sun.tools.xjc.Driver.run (Driver.java:382)
    at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution (AbstractJavaGeneratorMojo.java:468)
    at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute (AbstractJaxbMojo.java:315)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    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:305)
    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:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO]

The log of this command: C:\ASF\apache-maven-3.5.4\bin\mvn clean install -X -l mvn.log mvn.log

zosrothko avatar Dec 07 '18 16:12 zosrothko

Same problem here, when i use the default <xjbSources> at src/main/xjb/ all Adapters are created, when i use custom xjbSources i get the silence error shown with verbose as above

stefanwendelmann avatar Dec 05 '19 15:12 stefanwendelmann

Is it possible that verbose are the culprit

see #159

knuspertante avatar Apr 07 '20 06:04 knuspertante

@knuspertante commenting out the <verbose>true</verbose> is hiding the error, but the pojos are still not generated.

stefanwendelmann avatar Mar 31 '21 05:03 stefanwendelmann

Also having this issue.

In my case the classes do get generated, but they are not added to classpath in vscode, although they should. While investigating this I came across this error.

JSamir avatar Jun 04 '21 20:06 JSamir