Karaf
  1. Karaf
  2. KARAF-1547

NullpointerException when running commands on jdk 6 update 33 or jdk 7 update 5

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.2.8, 2.3.0, 3.0.0
    • Fix Version/s: 2.2.9, 2.3.0, 3.0.0
    • Component/s: karaf-shell
    • Labels:
      None

      Description

      Start fresh karaf 3

      Karaf seems to come up fine but when you enter any command you get:

      2012-06-14 14:15:33,306 | INFO | Thread-8 | Console | 39 - org.apache.karaf.shell.console - 3.0.0.SNAPSHOT | Exception caught while executing command
      java.lang.NullPointerException
      at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:61)
      at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
      at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)
      at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)
      at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
      at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)
      at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)
      at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
      at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
      at org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:169)
      at java.lang.Thread.run(Thread.java:662)[:1.6.0_33]
      at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.doRun(ConsoleFactoryService.java:87)[39:org.apache.karaf.shell.console:3.0.0.SNAPSHOT]
      at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3$1.run(ConsoleFactoryService.java:78)
      at java.security.AccessController.doPrivileged(Native Method)[:1.6.0_33]
      at javax.security.auth.Subject.doAs(Subject.java:337)[:1.6.0_33]
      at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.run(ConsoleFactoryService.java:76)[39:org.apache.karaf.shell.console:3.0.0.SNAPSHOT]

      1. KARAF-1547.patch
        14 kB
        Achim Nierbeck

        Issue Links

          Activity

          Hide
          Christian Schneider added a comment - - edited

          It seems the CommandProxy.getTarget() returns null

          Show
          Christian Schneider added a comment - - edited It seems the CommandProxy.getTarget() returns null
          Hide
          Christian Schneider added a comment -

          I have tracked the problem to aries blueprint and proxy.

          In org.apache.aries.blueprint.container.ServiceRecipe.TriggerServiceFactory.getService(Bundle, ServiceRegistration) the following exception occurs:
          org.osgi.framework.ServiceException: Service factory exception: (class: org/apache/karaf/shell/console/commands/$BlueprintCommand16496117, method: <init> signature: (Ljava/lang/reflect/InvocationHandler;)V) Call to wrong initialization method

          This happens when the following line is called:
          intercepted = blueprintContainer.getProxyManager().createInterceptingProxy(b, getClassesForProxying(original), original, collaborator);

          Felix does not seem to log the exception but it catches it and sends a FrameWork event. Because of this exception the service can not be resolved and null is returned for the service object.

          Show
          Christian Schneider added a comment - I have tracked the problem to aries blueprint and proxy. In org.apache.aries.blueprint.container.ServiceRecipe.TriggerServiceFactory.getService(Bundle, ServiceRegistration) the following exception occurs: org.osgi.framework.ServiceException: Service factory exception: (class: org/apache/karaf/shell/console/commands/$BlueprintCommand16496117, method: <init> signature: (Ljava/lang/reflect/InvocationHandler;)V) Call to wrong initialization method This happens when the following line is called: intercepted = blueprintContainer.getProxyManager().createInterceptingProxy(b, getClassesForProxying(original), original, collaborator); Felix does not seem to log the exception but it catches it and sends a FrameWork event. Because of this exception the service can not be resolved and null is returned for the service object.
          Hide
          Christian Schneider added a comment -

          Tracked it down deeper into the proxy:
          The exception happens in
          org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.newProxySubclassInstance

          There it gets a proxy for org.apache.karaf.shell.console.commands.BlueprintCommand. Then the exception happens when it tries to get the constructor for the class.

          Show
          Christian Schneider added a comment - Tracked it down deeper into the proxy: The exception happens in org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.newProxySubclassInstance There it gets a proxy for org.apache.karaf.shell.console.commands.BlueprintCommand. Then the exception happens when it tries to get the constructor for the class.
          Hide
          Daniel Kulp added a comment - - edited

          It's a VerifyError while the JVM is trying to verify the class. Looks like the ASM stuff is generating an invalid class. THAT is not going to be fun.

          Show
          Daniel Kulp added a comment - - edited It's a VerifyError while the JVM is trying to verify the class. Looks like the ASM stuff is generating an invalid class. THAT is not going to be fun.
          Hide
          Christian Schneider added a comment -

          Yes I also suspected that but I have no knowledge of ASM so no idea how to check or fix this.

          Show
          Christian Schneider added a comment - Yes I also suspected that but I have no knowledge of ASM so no idea how to check or fix this.
          Hide
          Jean-Baptiste Onofré added a comment -

          As explain on IRC, it works with ASM. Aries Proxy uses ASM if presents, but "fallback" to JDK proxy if ASM is not present. So ASM is "optional" for Aries Proxy.

          Removing ASM bundle from startup.properties works. So the problem looks inside ASM or Aries Proxy usage of ASM.

          However, Aries Proxy delegating to JDK proxy suffered to an issue with some class generation (I raise a Jira at Aries for that), let me check if it's still the case.

          Show
          Jean-Baptiste Onofré added a comment - As explain on IRC, it works with ASM. Aries Proxy uses ASM if presents, but "fallback" to JDK proxy if ASM is not present. So ASM is "optional" for Aries Proxy. Removing ASM bundle from startup.properties works. So the problem looks inside ASM or Aries Proxy usage of ASM. However, Aries Proxy delegating to JDK proxy suffered to an issue with some class generation (I raise a Jira at Aries for that), let me check if it's still the case.
          Hide
          Jean-Baptiste Onofré added a comment -

          Here's the corresponding Aries Jira: https://issues.apache.org/jira/browse/ARIES-835

          Show
          Jean-Baptiste Onofré added a comment - Here's the corresponding Aries Jira: https://issues.apache.org/jira/browse/ARIES-835
          Hide
          Jean-Baptiste Onofré added a comment -

          As:
          1/ the problem occurs on trunk with ASM 4
          2/ the problem occurs on 2.3.x branch with ASM 3.3.1
          3/ the problem doesn't occurs on 2.2.x branch with ASM 3.3.1 but with a previous version of Aries Proxy

          It's clear for me that the problem is not in ASM but in Aries Proxy usage of ASM.

          I will dig around that to submit a patch to Aries too

          Show
          Jean-Baptiste Onofré added a comment - As: 1/ the problem occurs on trunk with ASM 4 2/ the problem occurs on 2.3.x branch with ASM 3.3.1 3/ the problem doesn't occurs on 2.2.x branch with ASM 3.3.1 but with a previous version of Aries Proxy It's clear for me that the problem is not in ASM but in Aries Proxy usage of ASM. I will dig around that to submit a patch to Aries too
          Hide
          Christian Schneider added a comment -

          The fix in aries works and the NPE does not happen anymore

          Show
          Christian Schneider added a comment - The fix in aries works and the NPE does not happen anymore
          Hide
          Jean-Baptiste Onofré added a comment -

          Unfortunately, not only 3.0.0 seems to be affected: 2.3.x and 2.2.x are also affected.

          @Christian, it seems that you ignored my comment (and the fact that the Jira was affected to me) about the fact that 2.3.x is affected also.

          I gonna find a fix for all branches.

          Show
          Jean-Baptiste Onofré added a comment - Unfortunately, not only 3.0.0 seems to be affected: 2.3.x and 2.2.x are also affected. @Christian, it seems that you ignored my comment (and the fact that the Jira was affected to me) about the fact that 2.3.x is affected also. I gonna find a fix for all branches.
          Hide
          Achim Nierbeck added a comment -

          This is a patch to switch the 2.2.x branch to 0.4 Blueprint and utils and 0.4.1 proxy

          It builds to the point of the iTests

          Show
          Achim Nierbeck added a comment - This is a patch to switch the 2.2.x branch to 0.4 Blueprint and utils and 0.4.1 proxy It builds to the point of the iTests
          Hide
          Daniel Kulp added a comment -


          0.4 is not compatible with the 0.3 versions currently on the 2.2.x branch. 2.2.x cannot be updated to 0.4.

          Show
          Daniel Kulp added a comment - 0.4 is not compatible with the 0.3 versions currently on the 2.2.x branch. 2.2.x cannot be updated to 0.4.
          Hide
          Achim Nierbeck added a comment -

          so this is a blocker then ...

          Show
          Achim Nierbeck added a comment - so this is a blocker then ...
          Hide
          Christian Schneider added a comment -

          Not sure if it is a blocker as our current releases do not have the fix and at least on 2.2.x it took me a while to find out that we have the bug. So for many people it may not be an issue. I found the problem when using <jpa:unit> in a blueprint context. Apart from that everything worked.

          Show
          Christian Schneider added a comment - Not sure if it is a blocker as our current releases do not have the fix and at least on 2.2.x it took me a while to find out that we have the bug. So for many people it may not be an issue. I found the problem when using <jpa:unit> in a blueprint context. Apart from that everything worked.
          Hide
          Scott Parkerson added a comment -

          FWIW, I didn't experience the problem with Karaf commands when using Fuse ESB (based on Karaf 2.2.5), but I did have problems with Aries Blueprint when I tried to instantiate some of our own beans as an OSGi service.

          Workaround for me was to remove the Aries Proxy 0.3 bundle shipped with Fuse ESB and install Aries Proxy 0.3.1. After I did that and restarted the container, the problem was resolved for me.

          Show
          Scott Parkerson added a comment - FWIW, I didn't experience the problem with Karaf commands when using Fuse ESB (based on Karaf 2.2.5), but I did have problems with Aries Blueprint when I tried to instantiate some of our own beans as an OSGi service. Workaround for me was to remove the Aries Proxy 0.3 bundle shipped with Fuse ESB and install Aries Proxy 0.3.1. After I did that and restarted the container, the problem was resolved for me.
          Hide
          Achim Nierbeck added a comment -

          I consider this to be a blocker since it's not necessarily an issue of the commands but customer software runs into this so this needs to be fixed for the next release.

          Show
          Achim Nierbeck added a comment - I consider this to be a blocker since it's not necessarily an issue of the commands but customer software runs into this so this needs to be fixed for the next release.
          Hide
          Jean-Baptiste Onofré added a comment -

          Karaf 2.2.9-SNAPSHOT updated to Aries Blueprint 0.3.2, let see if the problem occurs with this version.

          Show
          Jean-Baptiste Onofré added a comment - Karaf 2.2.9-SNAPSHOT updated to Aries Blueprint 0.3.2, let see if the problem occurs with this version.
          Hide
          Achim Nierbeck added a comment -

          Just some experiences I made recently with a openjdk 1.6.0 u 22
          I've seen the following exception which might be related:

          2012-07-13 13:01:27,039 | ERROR | rint Extender: 1 | BlueprintContainerImpl | 9 - org.apache.aries.blueprint - 0.3.2 | Unable to start blueprint container for bundle de.XXXXXXXX
          org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate components
                  at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:635)[9:org.apache.aries.blueprint:0.3.2]
                  at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:337)[9:org.apache.aries.blueprint:0.3.2]
                  at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:230)[9:org.apache.aries.blueprint:0.3.2]
                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.6.0_22]
                  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.6.0_22]
                  at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.6.0_22]
                  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)[:1.6.0_22]
                  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)[:1.6.0_22]
                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.6.0_22]
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.6.0_22]
                  at java.lang.Thread.run(Thread.java:679)[:1.6.0_22]
          Caused by: java.lang.VerifyError: (class: de/XXXXXXXXX/$ProductionJpaDao1195944438, method: <init> signature: (Ljava/lang/reflect/InvocationHandler;)V) Call to wrong initialization method
                  at java.lang.Class.getDeclaredConstructors0(Native Method)[:1.6.0_22]
                  at java.lang.Class.privateGetDeclaredConstructors(Class.java:2406)[:1.6.0_22]
                  at java.lang.Class.getConstructor0(Class.java:2716)[:1.6.0_22]
                  at java.lang.Class.getConstructor(Class.java:1674)[:1.6.0_22]
                  at org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.newProxySubclassInstance(ProxySubclassGenerator.java:159)
                  at org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:81)
                  at org.apache.aries.proxy.impl.AbstractProxyManager.createProxy(AbstractProxyManager.java:50)
                  at org.apache.aries.blueprint.container.BeanRecipe.addInterceptors(BeanRecipe.java:690)[9:org.apache.aries.blueprint:0.3.2]
                  at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:730)[9:org.apache.aries.blueprint:0.3.2]
                  at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[9:org.apache.aries.blueprint:0.3.2]
                  at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[9:org.apache.aries.blueprint:0.3.2]
                  at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[9:org.apache.aries.blueprint:0.3.2]
                  at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:631)[9:org.apache.aries.blueprint:0.3.2]
                  ... 10 more
          
          Show
          Achim Nierbeck added a comment - Just some experiences I made recently with a openjdk 1.6.0 u 22 I've seen the following exception which might be related: 2012-07-13 13:01:27,039 | ERROR | rint Extender: 1 | BlueprintContainerImpl | 9 - org.apache.aries.blueprint - 0.3.2 | Unable to start blueprint container for bundle de.XXXXXXXX org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate components at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:635)[9:org.apache.aries.blueprint:0.3.2] at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:337)[9:org.apache.aries.blueprint:0.3.2] at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:230)[9:org.apache.aries.blueprint:0.3.2] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.6.0_22] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.6.0_22] at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.6.0_22] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)[:1.6.0_22] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)[:1.6.0_22] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.6.0_22] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.6.0_22] at java.lang. Thread .run( Thread .java:679)[:1.6.0_22] Caused by: java.lang.VerifyError: (class: de/XXXXXXXXX/$ProductionJpaDao1195944438, method: <init> signature: (Ljava/lang/reflect/InvocationHandler;)V) Call to wrong initialization method at java.lang. Class .getDeclaredConstructors0(Native Method)[:1.6.0_22] at java.lang. Class .privateGetDeclaredConstructors( Class .java:2406)[:1.6.0_22] at java.lang. Class .getConstructor0( Class .java:2716)[:1.6.0_22] at java.lang. Class .getConstructor( Class .java:1674)[:1.6.0_22] at org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.newProxySubclassInstance(ProxySubclassGenerator.java:159) at org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:81) at org.apache.aries.proxy.impl.AbstractProxyManager.createProxy(AbstractProxyManager.java:50) at org.apache.aries.blueprint.container.BeanRecipe.addInterceptors(BeanRecipe.java:690)[9:org.apache.aries.blueprint:0.3.2] at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:730)[9:org.apache.aries.blueprint:0.3.2] at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[9:org.apache.aries.blueprint:0.3.2] at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[9:org.apache.aries.blueprint:0.3.2] at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[9:org.apache.aries.blueprint:0.3.2] at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:631)[9:org.apache.aries.blueprint:0.3.2] ... 10 more
          Hide
          Jean-Baptiste Onofré added a comment -

          I made a set of tests using Oracle JDK 1.6.0_33 without problem (with the latest Karaf 2.2.9-SNAPSHOT).

          I plan to make a couple of new tests in the following hours, but this issue seems fix to me.

          Show
          Jean-Baptiste Onofré added a comment - I made a set of tests using Oracle JDK 1.6.0_33 without problem (with the latest Karaf 2.2.9-SNAPSHOT). I plan to make a couple of new tests in the following hours, but this issue seems fix to me.
          Hide
          Jamie goodyear added a comment -

          Just to add to the testing notes:

          http://karaf.922171.n3.nabble.com/Tentative-Release-Dates-for-2-2-9-and-or-2-3-0-td4025591.html

          There has been a fare amount of testing around this issue, I believe we can mark it as resolved.

          Show
          Jamie goodyear added a comment - Just to add to the testing notes: http://karaf.922171.n3.nabble.com/Tentative-Release-Dates-for-2-2-9-and-or-2-3-0-td4025591.html There has been a fare amount of testing around this issue, I believe we can mark it as resolved.
          Hide
          Kristof Vanbecelaere added a comment -

          As far as I can see this issue is still in 2.3.0. In which version is this fixed? The Fix version/s field on this ticket cannot be correct, as it includes the affected versions.

          Show
          Kristof Vanbecelaere added a comment - As far as I can see this issue is still in 2.3.0. In which version is this fixed? The Fix version/s field on this ticket cannot be correct, as it includes the affected versions.
          Hide
          Jean-Baptiste Onofré added a comment -

          Thanks for the update Kristof, however, it should have been fixed (in Aries). Maybe it's a "regression" in Aries (we updated the Aries version in Karaf 2.3.0). I try to reproduce.

          Show
          Jean-Baptiste Onofré added a comment - Thanks for the update Kristof, however, it should have been fixed (in Aries). Maybe it's a "regression" in Aries (we updated the Aries version in Karaf 2.3.0). I try to reproduce.
          Hide
          Kristof Vanbecelaere added a comment -

          Sorry, my mistake. Turns out that if you do not have these imports in the bundle with the command
          org.apache.felix.service.command,
          org.apache.felix.gogo.commands,
          org.apache.karaf.shell.console
          then you get the above exception.

          Show
          Kristof Vanbecelaere added a comment - Sorry, my mistake. Turns out that if you do not have these imports in the bundle with the command org.apache.felix.service.command, org.apache.felix.gogo.commands, org.apache.karaf.shell.console then you get the above exception.
          Hide
          Kristof Vanbecelaere added a comment -

          In my previous comment, I am referring to the NPE mentioned in the description of this issue.

          Show
          Kristof Vanbecelaere added a comment - In my previous comment, I am referring to the NPE mentioned in the description of this issue.

            People

            • Assignee:
              Jean-Baptiste Onofré
              Reporter:
              Christian Schneider
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development