Hi All,

I like to add something to this on child-first class loading of web-apps
which i found some times back. I tested this, when I tried the example.war
on a AS pack(after tomcat was moved into osgi environment). I got the
following error with Carbon Authentication Example,

java.lang.LinkageError: loader constraint violation in interface itable
initialization: when resolving method
"org.apache.axis2.databinding.ADBDataSource.getReader()Ljavax/xml/stream/XMLStreamReader;"
the class loader (instance of org/apache/catalina/loader/WebappClassLoader)
of the current class, org/apache/axis2/databinding/ADBDataSource, and the
class loader (instance of
org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for interface
org/apache/axiom/om/OMDataSource have different Class objects for the type
javax/xml/stream/XMLStreamReader used in the signature
 at org.wso2.carbon.authenticator.stub.Login.getOMElement(Login.java:168)
at
org.wso2.carbon.authenticator.stub.AuthenticationAdminStub.toEnvelope(AuthenticationAdminStub.java:2288)
 at
org.wso2.carbon.authenticator.stub.AuthenticationAdminStub.login(AuthenticationAdminStub.java:642)
at
org.wso2.carbon.authenticator.proxy.AuthenticationAdminClient.login(AuthenticationAdminClient.java:64)
 at
org.apache.jsp.carbon.authentication.login_jsp._jspService(login_jsp.java:82)

>From the trace we can find that, first the class loader of ADBDataSource
(WebAppClassLoader [1], which is the child) is trying to resolve getReader
method which uses XMLStreamReader. But since its already loaded by
DefaultClassLoader of osgi, along with some other default classes, we get
this error. So we can find that the child-first class loading is working
with web-apps in AS because of the above error. To resolve this error, we
can remove the duplicated libraries found in WEB-INF/lib of the webapp
since they are already available in the /plugins directory. More on this
error at[2]. Also we can note that WebAppClassLoader [1], by default, uses
the child-first post-delegation model.

Thanks,
Kishanthan.
[1]
http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/loader/WebappClassLoader.html
[2]
http://stackoverflow.com/questions/244482/how-to-deal-with-linkageerrors-in-java
On Sat, Mar 17, 2012 at 10:34 AM, Afkham Azeez <[email protected]> wrote:

> AS folks please note, and create Jiras if necessary
>
> --
> Afkham Azeez
> Sent from my phone
> On Mar 17, 2012 10:18 AM, "Amila Suriarachchi" <[email protected]> wrote:
>
>> And the thread context class loader. For a web app thread context class
>> loader should also set the the web app class loader (which should be child
>> first).
>> Because some libraries load classes from thread context class loader.
>>
>> thanks,
>> Amila.
>>
>>
>> On Sat, Mar 17, 2012 at 10:12 AM, Amila Suriarachchi <[email protected]>wrote:
>>
>>> +1. This is a must feature. Otherwise we can not grantee any arbitery
>>> web app working.
>>>
>>> thanks,
>>> Amila.
>>>
>>> On Sat, Mar 17, 2012 at 8:51 AM, Afkham Azeez <[email protected]> wrote:
>>>
>>>> Folks,
>>>> Please note $subject
>>>>
>>>> --
>>>> *Afkham Azeez*
>>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>>> Member; Apache Software Foundation; http://www.apache.org/
>>>> * <http://www.apache.org/>**
>>>> email: **[email protected]* <[email protected]>* cell: +94 77 3320919
>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>>> twitter: 
>>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>>>> *
>>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
>>>> *
>>>> *
>>>> *Lean . Enterprise . Middleware*
>>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> *Amila Suriarachchi*
>>>
>>> Software Architect
>>> WSO2 Inc. ; http://wso2.com
>>> lean . enterprise . middleware
>>>
>>> phone : +94 71 3082805
>>>
>>>
>>
>>
>> --
>> *Amila Suriarachchi*
>>
>> Software Architect
>> WSO2 Inc. ; http://wso2.com
>> lean . enterprise . middleware
>>
>> phone : +94 71 3082805
>>
>>


-- 
*Kishanthan Thangarajah*
Software Engineer,
Development Technologies Team,
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94773426635
Blog - *http://kishanthan.wordpress.com*
Twitter - *http://twitter.com/kishanthan*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to