[
https://issues.apache.org/jira/browse/WICKET-4663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan updated WICKET-4663:
---------------------------
Description:
The method LazyInitProxyFactory#createProxy use
Thread.currentThread().getContextClassLoader() to create a new proxy instance.
It seems that this is not correct in an OSGi environment.
Preferred is to use the ClassLoader provided by the AbstractClassResolver class
(getClassResolver is not part of IClassResolver).
Then it will be something like:
{code:java}
ClassLoader classLoader;
if (Application.exists())
{
AbstractClassResolver classResolver =
(AbstractClassResolver) Application.get()
.getApplicationSettings()
.getClassResolver();
classLoader = classResolver.getClassLoader();
}
else
{
classLoader =
Thread.currentThread().getContextClassLoader();
}
try
{
return Proxy.newProxyInstance(classLoader, new
Class[] { type, Serializable.class,
ILazyInitProxy.class,
IWriteReplace.class }, handler);
}
{code}
was:
The method LazyInitProxyFactory#createProxy use
Thread.currentThread().getContextClassLoader() to create a new proxy instance.
It seems that this is not correct in an OSGi environment.
Preferred is to use the ClassLoader provided by the AbstractClassResolver class
(getClassResolver is not part of IClassResolver).
Then it will be something like:
{code}
ClassLoader classLoader;
if (Application.exists())
{
AbstractClassResolver classResolver =
(AbstractClassResolver) Application.get()
.getApplicationSettings()
.getClassResolver();
classLoader = classResolver.getClassLoader();
}
else
{
classLoader =
Thread.currentThread().getContextClassLoader();
}
try
{
return Proxy.newProxyInstance(classLoader, new
Class[] { type, Serializable.class,
ILazyInitProxy.class,
IWriteReplace.class }, handler);
}
{code}
> LazyInitProxyFactory uses wrong ClassLoader in OSGi environment
> ---------------------------------------------------------------
>
> Key: WICKET-4663
> URL: https://issues.apache.org/jira/browse/WICKET-4663
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.7
> Reporter: Stefan
>
> The method LazyInitProxyFactory#createProxy use
> Thread.currentThread().getContextClassLoader() to create a new proxy
> instance. It seems that this is not correct in an OSGi environment.
> Preferred is to use the ClassLoader provided by the AbstractClassResolver
> class (getClassResolver is not part of IClassResolver).
> Then it will be something like:
> {code:java}
> ClassLoader classLoader;
> if (Application.exists())
> {
> AbstractClassResolver classResolver =
> (AbstractClassResolver) Application.get()
> .getApplicationSettings()
> .getClassResolver();
> classLoader = classResolver.getClassLoader();
> }
> else
> {
> classLoader =
> Thread.currentThread().getContextClassLoader();
> }
>
> try
> {
> return Proxy.newProxyInstance(classLoader, new
> Class[] { type, Serializable.class,
> ILazyInitProxy.class,
> IWriteReplace.class }, handler);
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira