felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ali Naddaf <...@naddaf.org>
Subject Re: java.lang.LinkageError exception
Date Mon, 03 Nov 2008 05:36:40 GMT
Hi Richard.

Thanks for your suggestion. I made the upgrade and understandably, it 
wasn't without some fun; some constructors and methods had changed their 
signatures, etc. I have got the application up and running with the new 
version and haven't run into my old issue yet so hopefully that has been 
resolved. I, however, noticed having some less serious exceptions in my 
log and looked further into it. Basically, I am seeing an exception in 
the URLHandlersBundleStreamHandler.openConnection(URL) method. Here is 
the part I am referring to:

 if (framework != null)
        {
            // TODO: optimize this to not use reflection if not needed
            try
            {
                Class targetClass = 
framework.getClass().getClassLoader().loadClass(
                    URLHandlersBundleURLConnection.class.getName());
               
                return (URLConnection) 
m_action.invoke(m_action.getConstructor(targetClass,
                    new Class[]{URL.class, framework.getClass()}),
                    new Object[]{url, framework});
            }
            catch (Exception ex)
            {
                throw new IOException(ex.getMessage());
            }
        }
        throw new IOException("No framework context found");

The problem happens when reflection fails to find the appropriate 
constructor and throws a NoSuchMethodException; here the targetClass 
resolves to "org.apache.felix.framework.URLHandlersBundleURLConnection" and
the exception is:

java.lang.NoSuchMethodException: 
org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(java.net.URL, 
org.simplecenter.application.SimpleCenterApplication)

Note that SimpleCenterApplicaion extends Felix and  
URLHandlersBundleURLConnection has the constructor 
URLHandlersBundleURLConnection(URL, Felix).

Any thoughts?

Thanks
Ali.

P.S. In the older version, it was not relying on the reflection and was 
calling the URLHandlersBundleURLConnection(URL, Felix) directly.

Richard S. Hall wrote:
> If you are using 0.8.0 of Felix, then you seriously need to upgrade. 
> You can get the version of Felix by starting it and typing "version" 
> in the Felix shell or by typing "ps" and looking at the version of the 
> system bundle.
>
> If you really are using 0.8.0, then it is possible that this was 
> related to a bug from a while ago where Felix was not properly 
> guarding class definition with a lock. Try upgrading to the latest 
> 1.2.2 release (1.4.0 will be coming soon too).
>
> -> richard
>
>
> Ali Naddaf wrote:
>> Hi Richard.
>>
>> In the manifest of felix.jar I see "Bundle-Version: 0.8.0.incubator", 
>> so is that the version you are asking for? As for what I was doing, 
>> this is a multimedia application and I was trying to open a media 
>> file for playback. I am trying to see how I can deterministically 
>> reproduce this but otherwise, do yo have any suggestion as to how I 
>> can debug the issue?
>>
>> Thanks,
>> Ali.
>>
>>
>> Richard S. Hall wrote:
>>> Which version of Felix are you using?
>>>
>>> What are you doing when this error occurs?
>>>
>>> It certainly would be great to find some way to reproduce it. I am 
>>> sure it is explainable.
>>>
>>> -> richard
>>>
>>> Ali Naddaf wrote:
>>>> Hello all.
>>>>
>>>> I have an OSGi based application (using Felix) that is under heavy 
>>>> development and a few days ago, I started seeing the following 
>>>> exception showing up in my logs:
>>>>
>>>> java.lang.LinkageError: loader (instance of  
>>>> org/apache/felix/framework/searchpolicy/ContentClassLoader): 
>>>> attempted  duplicate class definition for name: 
>>>> "org/simplecenter/upnp/av/DIDLParser"
>>>>    at java.lang.ClassLoader.defineClass1(Native Method)
>>>>    at java.lang.ClassLoader.defineClass(Unknown Source)
>>>>    at java.lang.ClassLoader.defineClass(Unknown Source)
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.ContentClassLoader.findClass(ContentClassLoader.java:149)

>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClassFromModule(ContentClassLoader.java:51)

>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.ContentLoaderImpl.getClass(ContentLoaderImpl.java:121)

>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:86) 
>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.searchImports(R4SearchPolicyCore.java:392)

>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:353)

>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:136)

>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4SearchPolicy.java:45)

>>>>
>>>>    at 
>>>> org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClass(ContentClassLoader.java:70)

>>>>
>>>>    at java.lang.ClassLoader.loadClass(Unknown Source)
>>>>    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>>    at 
>>>> org.simplecenter.upnp.av.controlpoint.BaseAVTransportListener.parseMetaData(BaseAVTransportListener.java:87)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.controlpoint.BaseAVTransportListener.change(BaseAVTransportListener.java:78)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.controlpoint.LastChangeListener.parseStates(LastChangeListener.java:98)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.controlpoint.LastChangeListener.parseEvent(LastChangeListener.java:74)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.controlpoint.LastChangeListener.LastChangeChanged(LastChangeListener.java:45)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.renderer.RendererAVTransport.LastChangeChanged(RendererAVTransport.java:48)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.renderer.RendererDeviceInstance$1.sendEvent(RendererDeviceInstance.java:101)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.renderer.LastChangeEventSender.flushEvents(LastChangeEventSender.java:122)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.renderer.LastChangeEventSender.access$300(LastChangeEventSender.java:38)

>>>>
>>>>    at 
>>>> org.simplecenter.upnp.av.renderer.LastChangeEventSender$EventTimer.run(LastChangeEventSender.java:101)

>>>>
>>>>    at java.lang.Thread.run(Unknown Source)
>>>>
>>>> I cannot find any duplicate classes in my code and also this 
>>>> problem doesn't show itself all the times, and yet I haven't been 
>>>> able to find accurate reproduction steps. Anyhow, if any one has 
>>>> any suggestion as to what this may mean and how I can debug that, 
>>>> it would be greatly appreciated.
>>>>
>>>> Many thanks
>>>> Ali
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message