felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FELIX-3003) NPE in ResolverImpl.permutateIfNeeded
Date Wed, 22 Jun 2011 18:49:47 GMT

     [ https://issues.apache.org/jira/browse/FELIX-3003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Torsten updated FELIX-3003:
---------------------------

    Attachment: felix-3003-resolverimpl-sysout-NPE.txt
                felix-3003-bundle123-headers.txt
                felix-3003-bundle103-headers.txt

I've got ride of the NPE and found out that it was caused by a wrong export statement (exporting
a version that didn't exists) in one of my bundles. I am not sure why this problem has never
occured before and why it only occurs on first start of Karaf. Further startups doesn't show
the NPE at all! I'll guess OSGi is more dynamic then I thought.. ;-)

Here are the involved bundles:
Bundle 103: activemq-core-5.5.0
Bundle 122: custom-api
Bundle 123: custom-osgified-libs (with lots of im/exports)

1) First, I've figured out which requirement caused the NPE through patching felix-framework.jar
with sysout statements in ResolverImpl.permutateIfNeeded:
    	System.out.println("Needed Req: " + req);
    	Iterator<Requirement> iter = candidateMap.keySet().iterator();
    	while (iter.hasNext()) {
			Requirement requirement = (Requirement) iter.next();
			Set<Capability> capabilities = candidateMap.get(requirement);
			System.out.println( "Req: " + req + " --> " + (capabilities!=null?capabilities.toString():"null")
);
		}
		
2) It seems that just before the NPE "org.apache.commons.logging" was needed but only 1 other
packages was in the candidateMap:

    Needed Req: [103.0] package; (package=org.apache.commons.logging)
    Req: [103.0] package; (package=org.apache.commons.logging) --> [[123.0] package; package=org.geotools.geometry.jts]
    13:34:13,546 | WARN  | tenerContainer-2 | AbstractMessageListenerContainer  694 | b120
| Execution of JMS message listener failed, and no ErrorHandler has been set.
    java.lang.NullPointerException
        at org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1164)
        
3) Then, I wondered why the "org.geotools.geometry.jts" package is the only candidate. This
package is exported by bundle 123 ("lib"). Also, this package uses "com.vividsolutions.jts.geom",
which in turn is used, embedded and exported by bundle 122 ("API"). Bundle 122 contains the
domain objects that bundle 103 ("amq") tries to deserialize (imported through DynamicImport
*). This was misleading, tough (at least for my problem, maybe it is still interesting for
you).

4) It turns out, the problem was related to the "org.apache.commons.logging" package that
was exported by bundle 123 ("lib") with a wrong version:
karaf> packages:exports |grep "commons.logging"
     4 org.apache.commons.logging; version=1.1.1
     4 org.apache.commons.logging; version=1.0.4
     4 org.apache.commons.logging.impl; version=1.1.1
     4 org.apache.commons.logging.impl; version=1.0.4
   116 org.apache.commons.logging; version=1.1.1
   116 org.apache.commons.logging.impl; version=1.1.1
   123 org.apache.commons.logging; version=1.7.0
   123 org.apache.commons.logging.impl; version=1.7.0

5) Bundle 103 ("amq"), which caused the NPE, imported this package statically without version
through Import-Package as well as with DynamicImport-Package * (see attached file).
6) Maybe the DynamicImport picked the highest version available, but the framework couldn't
deliver, because, well, this version isn't even implemented.. ;-) 
7) The reason for the commons-logging version export 1.7.0 was due to an misconfigured maven-bundle-plugin,
which included the commons-logging export statement due to transitive dependencies. I actually
only wanted to export commons-beanutils:
    <Export-Package>
        org.apache.commons.*;version=${commons.beanutils.version};-split-package:=merge-first,
        
So, yeah I guess this issue is resolved for me. I am not sure if this is enough information
for you guys to fix the NPE in the framework. If you need any more infos or output of karaf
commands, let me know.

> NPE in ResolverImpl.permutateIfNeeded
> -------------------------------------
>
>                 Key: FELIX-3003
>                 URL: https://issues.apache.org/jira/browse/FELIX-3003
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-3.0.9
>         Environment: karaf 2.2.1, activemq 5.5.0
>            Reporter: Torsten
>         Attachments: felix-3003-bundle103-headers.txt, felix-3003-bundle123-headers.txt,
felix-3003-resolverimpl-sysout-NPE.txt
>
>
> After upgrade to Karaf 2.2.1, I noticed the following NPE in the Felix framework code:
> 14:31:54,306 | WARN  | tenerContainer-1 | AbstractMessageListenerContainer  694 | b120
| Execution of JMS message listener failed, and no ErrorHandler has been set.
> java.lang.NullPointerException
> 	at org.apache.felix.framework.resolver.ResolverImpl.permutateIfNeeded(ResolverImpl.java:1156)
> 	at org.apache.felix.framework.resolver.ResolverImpl.checkPackageSpaceConsistency(ResolverImpl.java:1085)
> 	at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:171)
> 	at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4103)
> 	at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1412)
> 	at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:734)
> 	at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
> 	at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_20]
> 	at java.lang.Class.forName0(Native Method)[:1.6.0_20]
> 	at java.lang.Class.forName(Class.java:247)[:1.6.0_20]
> 	at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.load(ClassLoadingAwareObjectInputStream.java:63)
> 	at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:37)
> 	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)[:1.6.0_20]
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)[:1.6.0_20]
> 	at java.util.ArrayList.readObject(ArrayList.java:593)[:1.6.0_20]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_20]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_20]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_20]
> 	at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_20]
> 	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)[:1.6.0_20]
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)[:1.6.0_20]
> 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)[:1.6.0_20]
> 	at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:184)[103:org.apache.activemq.activemq-core:5.5.0]
> 	at org.springframework.jms.support.converter.SimpleMessageConverter.extractSerializableFromMessage(SimpleMessageConverter.java:215)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.support.converter.SimpleMessageConverter.fromMessage(SimpleMessageConverter.java:103)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.adapter.MessageListenerAdapter.extractMessage(MessageListenerAdapter.java:407)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:345)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)[120:org.springframework.jms:3.0.5.RELEASE]
> 	at java.lang.Thread.run(Thread.java:619)[:1.6.0_20]
> I guess there is nothing I can do except downgrading to karaf 2.2.0? Any other ideas?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message