aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Error while parsing schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Error while parsing schema" Watch "Error while parsing schema" New topic
Author

Error while parsing schema

aneesh veetile
Greenhorn

Joined: Feb 15, 2012
Posts: 9

Hi,

I am using maven for build. while running the maven build i am getting the following error

[ERROR] Error while parsing schema(s).Location [ file:/C:/aneesh/test/test-schemas-jar/src/main/resources/Domain/XML_V0100.xsd{19,88}].
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'u:Service_Request' to a(n) 'element declaration' component.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseLocal(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseLocalElements(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
at com.sun.tools.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check(SchemaConstraintChecker.java:106)
at com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:358)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:172)
at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:118)
at org.jvnet.mjiip.v_2_2.XJC22Mojo.loadModel(XJC22Mojo.java:45)
at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:35)
at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:22)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:282)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:147)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
xsd snapshot as follows:
<xs:choice>
<xs:element ref="u:Service_Request" minOccurs="0"/>
<xs:element ref="u:Service_Response" minOccurs="0"/>
</xs:choice>

and the namespace is correctly defined. i have validated the same using xml spy. validation was successfuly. I am not sure why it is failing when running the maven build. Could you please help meout.

Regards,
Aneesh
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Which plugin are you using? Is it this one: http://jaxb.java.net/jaxb-maven2-plugin/
Are you sure you are using the correct plugin for your configuration file version?

By the way, telling some details on what you are doing and what technologies you are employing, including their versions, would help.


JBoss In Action
aneesh veetile
Greenhorn

Joined: Feb 15, 2012
Posts: 9
Peter Johnson wrote:Which plugin are you using? Is it this one: http://jaxb.java.net/jaxb-maven2-plugin/
Are you sure you are using the correct plugin for your configuration file version?

By the way, telling some details on what you are doing and what technologies you are employing, including their versions, would help.


Thanks for your reply!

I am using the following plugin and version

<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.0</version>

Actually i am developing a part of webservice using RAD, websphere application server 7.0, java 1.6 and jaxb.
I would be getting an xml request and i would be converting it into java objects using jaxb for preedit and post the request on to a server.
I am using maven for building it. i am trying to create the jaxb objects from the xsds. inside one of the xsds my script is failing.

following are the jaxb dependencies in my pom



please let me know if you need any other information.

Regards,
Aneesh
aneesh veetile
Greenhorn

Joined: Feb 15, 2012
Posts: 9
aneesh veetile wrote:
Peter Johnson wrote:Which plugin are you using? Is it this one: http://jaxb.java.net/jaxb-maven2-plugin/
Are you sure you are using the correct plugin for your configuration file version?

By the way, telling some details on what you are doing and what technologies you are employing, including their versions, would help.


Thanks for your reply!

I am using the following plugin and version

<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.0</version>

Actually i am developing a part of webservice using RAD, websphere application server 7.0, java 1.6 and jaxb.
I would be getting an xml request and i would be converting it into java objects using jaxb for preedit and post the request on to a server.
I am using maven for building it. i am trying to create the jaxb objects from the xsds. inside one of the xsds my script is failing.

following are the jaxb dependencies in my pom



please let me know if you need any other information.

Regards,
Aneesh


Hi,

The issue is resolved.

The actual problem was with the way i were giving the xsd's in <includeSchema> tag. I were giving all the xsds explicitly in <includeSchema> tag.(either explicitly mentioning all xsds or giving *.xsds).
The xsd which was showing the error while building is interally refering 6 other xsds. So i dont need to give those 6 xsds explicitly in <includeschema>tag. I have to explicitly give only the xsd which is referring those 6 xsd's and also the order matters.

Thank you for you help!

Regards,
Aneesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while parsing schema