[switchyard-issues] [JBoss JIRA] Created: (SWITCHYARD-265) Bean component throws NPE when service reference in unavailable

Keith Babo (JIRA) jira-events at lists.jboss.org
Tue Jun 7 22:55:59 EDT 2011


Bean component throws NPE when service reference in unavailable 
----------------------------------------------------------------

                 Key: SWITCHYARD-265
                 URL: https://issues.jboss.org/browse/SWITCHYARD-265
             Project: SwitchYard
          Issue Type: Bug
          Components: component-bean
    Affects Versions: 0.1
            Reporter: Keith Babo


Say you have something like this in your Bean class:

{noformat}
@Inject @Reference
private MyService myService;
{noformat}

If "MyService" is not available when the Bean component's activator is kicked then we get this:

22:46:19,809 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."test1-1.0.0-SNAPSHOT.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."test1-1.0.0-SNAPSHOT.jar".SwitchYardService: java.lang.NullPointerException
	at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:75)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1675)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_24]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
	at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
Caused by: java.lang.NullPointerException
	at org.switchyard.component.bean.deploy.BeanComponentActivator.start(BeanComponentActivator.java:106)
	at org.switchyard.deploy.internal.Activation.start(Deployment.java:371)
	at org.switchyard.deploy.internal.Deployment.deployReferences(Deployment.java:297)
	at org.switchyard.deploy.internal.Deployment.start(Deployment.java:121)
	at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:76)
	at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:68)
	... 4 more

Might be nicer to just throw a deployment exception indicating that the target service could not be located.  Maybe this should even be part of the deployer validation ...

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

        


More information about the switchyard-issues mailing list