On Tue, Jul 11, 2017 at 3:42 PM, Niranjan Karunanandham
<niranjan.k...@gmail.com> wrote:
> Hi Devs,
>
> I am using axis2 in an OSGi environment and I have an OSGi bundle which
> exposes a web-service. When I invoke the service, I am always getting the
> warning [1]. On debugging the code, this is happening since it does not
> satisfy any of the condition in [2] and the cache is being set to null.
> When I debugged the code, the bean.getClassLoader() is
> "org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader" and therefore
> does not satisfy the condition. This works when i deploy the service as an
> axis2 service.
>
> Is there any particular reason as to why we check whether the if statement
> in [2] instead of directly caching?

Yes. As explained in the Javadoc, this method is designed to not leak
class loaders. If you use the static cache in BeanInfoCache to cache
the BeanInfo for a class loaded by a class loader that is not the one
that loaded BeanInfoCache, you will get a class loader leak.

> If so, in the case of an OSGi web
> service, is it possible to change the classloader from
> "org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader" to a custom one?
>
>
> [1] -
> WARN - BeanInfoCache Unable to locate a BeanInfo cache for class
> org.nira.sample.service (stopClass=class java.lang.Object). This will
> negatively affect performance!
>
> [2] -
> https://github.com/apache/axis2-java/blob/1_6/modules/kernel/src/org/apache/axis2/classloader/BeanInfoCache.java#L110
>
> Regards,
> Niranjan Karunanandham

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to