You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Murphy, Eric" <er...@pfc.cfs.nrcan.gc.ca> on 2005/01/05 18:44:40 UTC

Generated .jar files have conflicts

XmlBeans -

We are implementing different versions of a specification which are based on
very similar schemas. Many of the tags in these schemas have the same names.
The specification authors have not used any namespaces.

We would like to use one servlet to evaluate the request then pass it to the
API that handles that version. We have compiled the XmlBeans classes into
different packages using a xsdconfig file and deploy the classes in separate
jars.  

gdas090.jar and gdas091.jar are both in the class path.

Unfortunately when marshalling the main XML document we don't always get the
correct version returned from the Factory class. Example:

Org.nfis.gdas.v091.GdasCapabilitiesDocument doc =
GDASCapabilitiesDocument.Factory.parse(in);

The above line can throw a ClassCastException from the generated code from
at this line:

public static org.nfis.gdas.v091.GDASCapabilitiesDocument
parse(java.io.InputStream is) 
	throws org.apache.xmlbeans.XmlException, java.io.IOException {
 return (org.nfis.gdas.v091.GDASCapabilitiesDocument)
org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null );
}

Debugging I discovered the returned class was actually
org.nfis.gdas.v090.GDASCapabilitiesDocument (the incorrect version) which
resulted in the ClassCastException.

While we can put these versions in separate web containers to resolve this
problem we would rather not do this.  Any thoughts about why this is
occurring?

Eric Murphy
Software Developer (NFIS)

erimurph@pfc.forestry.ca
tel/tél: 250-363-6038
fax / télécopieur 250-363-6004

Natural Resources Canada
Pacific Forestry Centre
506 West Burnside Road
Victoria BC V8Z 1M5

Ressources naturelles Canada
Centre de foresterie du Pacifique
506 rue Burnside ouest
Victoria, Colombie-Britanique V8Z 1M5

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org