Best way to avoid this problem is to have different target namespaces for your 
schemas, or same target namespace but without conflicts.

If you can't do that next is to manage the jars/classes in different 
classloaders like Kevin suggested.

If this is not possible, at least use different java package names for the two 
files (see .sconfig files), but there are limitations about this, is you start 
with xml/schema names you'll always get the resources from the first jar on the 
classpath.

Cezar

On Jun 23, 2011, at 12:46 PM, Kevin Krouse wrote:

> If you have schemas that define components in the same namespace you'll need 
> to isolate the generated schema jars using classloaders.  The issue is 
> similar to trying to load two different java classes with the same name.
> 
> Kevin
> 
> 
> On Thu, Jun 16, 2011 at 7:35 AM, Horst Heistermann 
> <horst.heisterm...@oracle.com> wrote:
> Hi,
> 
>  I am having an issue in my environment because I have two XMLBean generated 
> classes pointing to the same schema. Sometimes when I use the factory of one 
> class
> it tries to create an instance of the other XMLBean class (even though I am 
> using the factory of the class I want to create!).  This causes a 
> classcastexeception
> 
> Is there a way to avoid this? The issue is indeterminate because it works 
> fine most of the time but once in a while this issue crashes the program
> 
> Thanks,
> 
> Horst
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
> For additional commands, e-mail: user-h...@xmlbeans.apache.org
> 
> 

Reply via email to