Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-342

NPE in AbstractAnnotationMethodEndpointMapping on line 47 during postProcessAfterInitialization

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.5.1
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Spring Frameworm v2.5.3, Weblogic v9.2.3, Spring WS v1.5.0

      Description

      The stack trace is as follows:

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personMaintenanceSpringWebServiceEndpoint' defined in class path resource [tanzan-web-context.xml]: Cannot resolve reference to bean 'personMaintenanceService' while setting bean property 'personMaintenanceService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personMaintenanceService': Post-processing of the FactoryBean's object failed; nested exception is java.lang.NullPointerException
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:217)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:376)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
      at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:82)
      at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1616)
      at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2761)
      at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:889)
      at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:333)
      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
      at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
      at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
      at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
      at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
      at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
      at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
      at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
      at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
      at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
      at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:181)
      at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:358)
      at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:52)
      at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:186)
      at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
      at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
      at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
      at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
      at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
      at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
      at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personMaintenanceService': Post-processing of the FactoryBean's object failed; nested exception is java.lang.NullPointerException
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:142)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116)
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:91)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1285)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:275)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
      ... 56 more
      Caused by: java.lang.NullPointerException
      at org.springframework.ws.server.endpoint.mapping.AbstractAnnotationMethodEndpointMapping.postProcessAfterInitialization(AbstractAnnotationMethodEndpointMapping.java:47)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1427)
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:139)
      ... 64 more

      The problem occurs when AbstractAnnotationMethodEndpointMapping#postProcessAfterInitialization calls getEndpointClass(bean) which in turn calls AopUtils.getTargetClass(endpoint).

      'bean' in getEndpointClass(bean) is actually a local-slsb as shown by its config here:

      <jee:local-slsb id="personMaintenanceService"
      business-interface="uk.co.serin.tanzan.personmaintenance.facade.PersonMaintenanceService"
      jndi-name="ejb/uk.co.serin.tanzan.personmaintenance.facade.PersonMaintenanceLocal"
      resource-ref="true"/>

      I can see that SWS-222 was raised to address proxies but it does not appear to work with EJBs.

      Unfortunatly I cannot easily override the AbstractAnnotationMethodEndpointMapping#postProcessAfterInitialization method because it is final otherwise I could create a quick work around.

      Hopefully the above will assist with diagnosis but if any further information would be of assistance just let me know.

        Activity

        serin Wayne Robinson created issue -
        Hide
        serin Wayne Robinson added a comment -

        I forgot to add that the NPE is as a result of AopUtils.getTargetClass(endpoint) returning null

        Show
        serin Wayne Robinson added a comment - I forgot to add that the NPE is as a result of AopUtils.getTargetClass(endpoint) returning null
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Fix Version/s 1.5.1 [ 10917 ]
        arjen.poutsma Arjen Poutsma made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        serin Wayne Robinson added a comment -

        Many thanks for the prompt turnaround Arjen, very much appreciated. I have tested the fix and can confirm that all is now fine!

        Wayne.

        Show
        serin Wayne Robinson added a comment - Many thanks for the prompt turnaround Arjen, very much appreciated. I have tested the fix and can confirm that all is now fine! Wayne.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing issues for 1.5.1

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing issues for 1.5.1
        arjen.poutsma Arjen Poutsma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        21h 48m 1 Arjen Poutsma 27/Apr/08 1:12 AM
        Resolved Resolved Closed Closed
        8d 20h 9m 1 Arjen Poutsma 05/May/08 9:21 PM

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            serin Wayne Robinson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: