You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Michael Furtak <mf...@cra.com> on 2009/10/06 21:33:20 UTC

SchemaTypeLoader problems in Equinox (OSGi): A solution

Hi, all. This is my first message to the mailing list, so I apologize if
I am stating some very old news.


Recently I have been encountering some classloading problems when using
XMLBeans in an OSGi environment (Equinox), and I have seen some other
users with similar issues [1, 2]. The common symptom was that xsi:type
information could neither be generated, nor interpreted while running in
an OSGi environment.

To my understanding, the use of the Thread Context ClassLoader, within
the SchemaTypeLoader [3] needs some extra help to work properly within
an OSGi environment. Equinox provides this help in the form of "Buddy
Class Loading" (unfortunately, this is *not* part of the OSGi spec,
making it an Equinox specific fix) [4].

By marking the XMLBeans bundle with an Eclipse-BuddyPolicy header in its
manifest, and the compiled schema bundle with an Eclipse-RegisterBuddy
header in its manifest, Equinox is able to bridge the classloading gap
between the core XMLBeans jar and your compiled schema classes.


Assuming that my XMLBeans bundle has:

Bundle-SymbolicName: org.apache.xmlbeans


I would include in that XMLBeans bundle manifest the line:

Eclipse-BuddyPolicy: registered


I would then alter my scomp'd schema classes bundle manifest to include:

Eclipse-RegisterBuddy: org.apache.xmlbeans


After doing this, my problems are resolved. I hope this can help someone
else, and was not incredibly old news.


Regards,
-Mike Furtak


1)
http://markmail.org/message/vx2vdg7yhb4l3ej6#query:+page:1+mid:vx2vdg7yh
b4l3ej6+state:results

2)
http://mail-archives.apache.org/mod_mbox/ws-axis-user/200701.mbox/%3C8d2
a81130701171341p55f95b70o7f144ea7d941639a@mail.gmail.com%3E

3)
http://grepcode.com/file/repo1.maven.org$maven2@org.apache.xmlbeans$xmlb
eans@2.4.0@org$apache$xmlbeans$impl$schema$SchemaTypeLoaderImpl.java#Sch
emaTypeLoaderImpl.getContextTypeLoader%28%29

4)
http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements#Ecli
pse-BuddyPolicy_Header
 
 
 
 
THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.

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


Re: SchemaTypeLoader problems in Equinox (OSGi): A solution

Posted by Jacob Danner <ja...@gmail.com>.
Thanks Mike!
I'll add this to the FAQs when I get a chance.
-jacobd

On Tue, Oct 6, 2009 at 12:33 PM, Michael Furtak <mf...@cra.com> wrote:

> Hi, all. This is my first message to the mailing list, so I apologize if
> I am stating some very old news.
>
>
> Recently I have been encountering some classloading problems when using
> XMLBeans in an OSGi environment (Equinox), and I have seen some other
> users with similar issues [1, 2]. The common symptom was that xsi:type
> information could neither be generated, nor interpreted while running in
> an OSGi environment.
>
> To my understanding, the use of the Thread Context ClassLoader, within
> the SchemaTypeLoader [3] needs some extra help to work properly within
> an OSGi environment. Equinox provides this help in the form of "Buddy
> Class Loading" (unfortunately, this is *not* part of the OSGi spec,
> making it an Equinox specific fix) [4].
>
> By marking the XMLBeans bundle with an Eclipse-BuddyPolicy header in its
> manifest, and the compiled schema bundle with an Eclipse-RegisterBuddy
> header in its manifest, Equinox is able to bridge the classloading gap
> between the core XMLBeans jar and your compiled schema classes.
>
>
> Assuming that my XMLBeans bundle has:
>
> Bundle-SymbolicName: org.apache.xmlbeans
>
>
> I would include in that XMLBeans bundle manifest the line:
>
> Eclipse-BuddyPolicy: registered
>
>
> I would then alter my scomp'd schema classes bundle manifest to include:
>
> Eclipse-RegisterBuddy: org.apache.xmlbeans
>
>
> After doing this, my problems are resolved. I hope this can help someone
> else, and was not incredibly old news.
>
>
> Regards,
> -Mike Furtak
>
>
> 1)
> http://markmail.org/message/vx2vdg7yhb4l3ej6#query:+page:1+mid:vx2vdg7yh
> b4l3ej6+state:results<http://markmail.org/message/vx2vdg7yhb4l3ej6#query:+page:1+mid:vx2vdg7yh%0Ab4l3ej6+state:results>
>
> 2)
> http://mail-archives.apache.org/mod_mbox/ws-axis-user/200701.mbox/%3C8d2
> a81130701171341p55f95b70o7f144ea7d941639a@mail.gmail.com%3E
>
> 3)
> http://grepcode.com/file/repo1.maven.org$maven2@org.apache.xmlbeans$xmlb
> eans@2.4.0@org$apache$xmlbeans$impl$schema$SchemaTypeLoaderImpl.java#Sch
> emaTypeLoaderImpl.getContextTypeLoader%28%29
>
> 4)
> http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements#Ecli
> pse-BuddyPolicy_Header<http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements#Ecli%0Apse-BuddyPolicy_Header>
>
>
>
>
> THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED.
> IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM
> DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your
> use of this message for any purpose is strictly prohibited. If you have
> received this communication in error, please delete the message and notify
> the sender so that we may correct our records.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

AW: SchemaTypeLoader problems in Equinox (OSGi): A solution

Posted by Oliver Pfau <Ol...@scalaris.com>.
Hi Mike,

yesterday tried to solve exactly this problem. With your description it works. Thanks a lot.

Regards,
Oliver

 

-----Ursprüngliche Nachricht-----
Von: Michael Furtak [mailto:mfurtak@cra.com] 
Gesendet: Dienstag, 6. Oktober 2009 21:33
An: user@xmlbeans.apache.org
Betreff: SchemaTypeLoader problems in Equinox (OSGi): A solution

Hi, all. This is my first message to the mailing list, so I apologize if I am stating some very old news.


Recently I have been encountering some classloading problems when using XMLBeans in an OSGi environment (Equinox), and I have seen some other users with similar issues [1, 2]. The common symptom was that xsi:type information could neither be generated, nor interpreted while running in an OSGi environment.

To my understanding, the use of the Thread Context ClassLoader, within the SchemaTypeLoader [3] needs some extra help to work properly within an OSGi environment. Equinox provides this help in the form of "Buddy Class Loading" (unfortunately, this is *not* part of the OSGi spec, making it an Equinox specific fix) [4].

By marking the XMLBeans bundle with an Eclipse-BuddyPolicy header in its manifest, and the compiled schema bundle with an Eclipse-RegisterBuddy header in its manifest, Equinox is able to bridge the classloading gap between the core XMLBeans jar and your compiled schema classes.


Assuming that my XMLBeans bundle has:

Bundle-SymbolicName: org.apache.xmlbeans


I would include in that XMLBeans bundle manifest the line:

Eclipse-BuddyPolicy: registered


I would then alter my scomp'd schema classes bundle manifest to include:

Eclipse-RegisterBuddy: org.apache.xmlbeans


After doing this, my problems are resolved. I hope this can help someone else, and was not incredibly old news.


Regards,
-Mike Furtak


1)
http://markmail.org/message/vx2vdg7yhb4l3ej6#query:+page:1+mid:vx2vdg7yh
b4l3ej6+state:results

2)
http://mail-archives.apache.org/mod_mbox/ws-axis-user/200701.mbox/%3C8d2
a81130701171341p55f95b70o7f144ea7d941639a@mail.gmail.com%3E

3)
http://grepcode.com/file/repo1.maven.org$maven2@org.apache.xmlbeans$xmlb
eans@2.4.0@org$apache$xmlbeans$impl$schema$SchemaTypeLoaderImpl.java#Sch
emaTypeLoaderImpl.getContextTypeLoader%28%29

4)
http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements#Ecli
pse-BuddyPolicy_Header
 
 
 
 
THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.

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


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