You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Horst Heistermann <ho...@oracle.com> on 2011/06/16 16:35:49 UTC

Conflict When Having Two XMLBean Generated classes for the same Schema...

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-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Conflict When Having Two XMLBean Generated classes for the same Schema...

Posted by Cezar Andrei <ce...@oracle.com>.
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 <ho...@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-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 


Re: Conflict When Having Two XMLBean Generated classes for the same Schema...

Posted by Kevin Krouse <kk...@apache.org>.
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.heistermann@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-unsubscribe@xmlbeans.**apache.org<us...@xmlbeans.apache.org>
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>