itay hindy created FELIX-3840:
---------------------------------
Summary: problem with URLHandlers when running 2 frameworks in one
jvm
Key: FELIX-3840
URL: https://issues.apache.org/jira/browse/FELIX-3840
Project: Felix
Issue Type: Bug
Components: Framework
Affects Versions: framework-4.2.0
Environment: windows 7 64bit
Reporter: itay hindy
This bug happens with 4.0.2 and 4.1.0-SNAPSHOT framework versions.
Run embedded felix with tomcat as describe in
http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
and as shown in http://heapdump.wordpress.com/2010/03/25/osgi-enabled-war/
One war activate Felix and works great. Adding another war gives the below
error :
"Unable to update the bundle. (java.net.MalformedURLException: Unknown
protocol: obr"
After debugging I saw the problem is generally in the URLHandlers classes
implementation.
In URLHandlersStreamHandlerProxy class the getStreamHandlerService function
does not return the correct value. The below code fails since framework is from
current webapp class loader and Felix is from first webapp class loader
if (framework instanceof Felix)
{
service = ((Felix) framework).getStreamHandlerService(m_protocol);
}
so we try to execute the below code and fail with method not recognize error
service = m_action.invoke(
m_action.getMethod(framework.getClass(), "getStreamHandlerService",
STRING_TYPES),
framework, new Object[]{m_protocol});
After I set getStreamHandlerService function to public in Felix class it works.
Then in URLHandlersStreamHandlerProxy class the below function fails (for the
setURL method) since m_service is null
public Object invoke(Object obj, Method method, Object[] params)
throws Throwable
{
try
{
Class[] types = method.getParameterTypes();
if ("parseURL".equals(method.getName()))
{
types[0] =
m_service.getClass().getClassLoader().loadClass(
URLStreamHandlerSetter.class.getName());
params[0] = Proxy.newProxyInstance(
m_service.getClass().getClassLoader(), new
Class[]{types[0]},
(URLHandlersStreamHandlerProxy) params[0]);
}
return
m_action.invokeDirect(m_action.getMethod(m_service.getClass(),
method.getName(), types), m_service, params);
}
catch (Exception ex)
{
throw ex;
}
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira