Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1571

Proxy creation fails when a superclass does not have a no-arg constructor

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.1.1.Final
    • Fix Version/s: 2.1.2.Final, 2.2.0.Alpha1
    • Component/s: Proxies
    • Labels:
      None
    • Environment:

      Wildfly master build (2013-12-19)

      Description

      When injecting an @ApplicationScoped bean, which extends a class that does not have a no-arg constructor, the following NPE occurs:

      Caused by: java.lang.NullPointerException
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:214) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:727) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:789) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:358) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:369) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:72) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:60) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.injection.producer.DefaultInjector$1.proceed(DefaultInjector.java:66) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:64) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:90) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:150) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:94) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:98) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:78) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
      	at nl.topicus.digdag.rest.integration.RemoteClientBuilder$Proxy$_$$_WeldClientProxy.createTopicusClient(Unknown Source) [classes:]
      	at nl.topicus.digdag.rest.RemoteAuthenticationRESTService.getRemoteAuthentication(RemoteAuthenticationRESTService.java:223) [classes:]
      

      Debugging the code in ClientProxyProvider.getClientProxy reveals that this caused by the following problem (in Proxies.getUnproxyableTypesExceptionInt):

      org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435: Normal scoped bean class org.openid4java.consumer.AbstractNonceVerifier is not proxyable because it has no no-args constructor - Managed Bean [class nl.topicus.digdag.rest.integration.CachedNonceVerifier] with qualifiers [@Any @Default].
      

      CachedNonceVerifier extends AbstractNonceVerifier. CachedNonceVerifier does have a no-arg constructor, AbstractNonceVerifier does not, but I do not see why it would need it as CachedNonceVerifier is the type that is proxied.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mbriskar Matej Briskar
                  Reporter:
                  papegaaij Emond Papegaaij
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: