Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-380

NPE in PartialBeanLifecycle if javassist not on classpath

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.4
    • 0.5
    • PartialBean
    • None

    Description

      I am getting

      java.lang.NullPointerException
      at org.apache.deltaspike.partialbean.impl.PartialBeanLifecycle.<init>(PartialBeanLifecycle.java:73)
      at org.apache.deltaspike.partialbean.impl.PartialBeanBindingExtension.createPartialBean(PartialBeanBindingExtension.java:142)
      at org.apache.deltaspike.partialbean.impl.PartialBeanBindingExtension.createBeans(PartialBeanBindingExtension.java:109)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
      at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:274)
      at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:121)
      at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:261)
      at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:240)
      at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:171)
      at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:130)
      at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:104)
      at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:63)
      at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:35)
      at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:58)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:516)
      at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1974)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1907)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)

      when javassist is not on the classpath. The corresponding code is:

      Object proxyFactory = ClassUtils.tryToInstantiateClassForName("javassist.util.proxy.ProxyFactory");

      Method setSuperclassMethod = proxyFactory.getClass().getDeclaredMethod("setSuperclass", Class.class);

      proxyFactory is null when javassist is not on classpath.

      Also note that tests for partial beans do not bundle javassist within the test archive which they should! Otherwise those tests won't pass on a container that does not implicitly add javassist to the classpath (e.g. WildFly).

      Attachments

        1. DELTASPIKE-380.patch
          1 kB
          Jozef Hartinger

        Issue Links

          Activity

            struberg Mark Struberg added a comment -

            applied for jozef as he is not avail right now.

            struberg Mark Struberg added a comment - applied for jozef as he is not avail right now.

            Path that fixes the test for WildFly (Weld 2 incontainer). The patch depends on DELTASPIKE-408

            jharting Jozef Hartinger added a comment - Path that fixes the test for WildFly (Weld 2 incontainer). The patch depends on DELTASPIKE-408
            struberg Mark Struberg added a comment -

            we need to add javassist to the @Deployment for some containers. Otherwise quite a few tests fail.

            struberg Mark Struberg added a comment - we need to add javassist to the @Deployment for some containers. Otherwise quite a few tests fail.

            i see what you mean, we need a better error message

            gpetracek Gerhard Petracek added a comment - i see what you mean, we need a better error message

            it also fails in the standalone test-mode with weld 2.x (it works with owb and weld 1.x)

            gpetracek Gerhard Petracek added a comment - it also fails in the standalone test-mode with weld 2.x (it works with owb and weld 1.x)
            jharting Jozef Hartinger added a comment - - edited It may be available to the test itself but is not part of the tested web archive and therefore not available to DeltaSpike in the incontainer mode. https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;a=blob;f=deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java;h=40fadde3313eb4c8ba0cab0511719d3c5abbddd7;hb=HEAD
            gpetracek Gerhard Petracek added a comment - - edited javassist is available for tests ( see https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;a=blob;f=deltaspike/modules/partial-bean/impl/pom.xml;h=36b05913ec182fc8d7381995a8efbf8ecd07fe76;hb=HEAD )

            People

              struberg Mark Struberg
              jharting Jozef Hartinger
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: