Bug 984919 - NPE in DefaultServiceRegistry on DEBUG level when unregistering service
NPE in DefaultServiceRegistry on DEBUG level when unregistering service
Status: CLOSED CURRENTRELEASE
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: SwitchYard (Show other bugs)
6.0.0 GA
Unspecified Unspecified
unspecified Severity low
: ER2
: ---
Assigned To: tcunning
Jiri Sedlacek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-16 07:26 EDT by Jiri Pechanec
Modified: 2015-08-02 19:44 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker SWITCHYARD-1632 Major Resolved NPE in DefaultServiceRegistry on DEBUG level when unregistering service 2013-09-16 04:46:49 EDT

  None (edit)
Description Jiri Pechanec 2013-07-16 07:26:24 EDT
In method unregisterService(Service service)

            if (_logger.isDebugEnabled()) {
                QName serviceName = service.getName();
                String domainName = service.getDomain() == null ? "" : service.getDomain().getName().toString();
                _logger.debug("Unregistered Service '" + serviceName + "' from ServiceDomain '" + domainName + "'.");
            }

service.getDomain().getName() can be null, thus calling toString() generates NPE.

13:16:46,969 WARN  [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000004: Failure during stop of service jboss.deployment.unit."implementations-component-test.jar".SwitchYardService: java.lang.NullPointerException
	at org.switchyard.internal.DefaultServiceRegistry.unregisterService(DefaultServiceRegistry.java:90)
	at org.switchyard.internal.ServiceImpl.unregister(ServiceImpl.java:118)
	at org.switchyard.deploy.internal.Deployment.undeployImplementations(Deployment.java:552)
	at org.switchyard.deploy.internal.Deployment.stop(Deployment.java:163)
	at org.switchyard.as7.extension.deployment.SwitchYardDeployment.stop(SwitchYardDeployment.java:123)
	at org.switchyard.as7.extension.services.SwitchYardService.stop(SwitchYardService.java:93)
	at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1911) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1874) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
	at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
Comment 1 Keith Babo 2013-07-16 07:31:39 EDT
Adding defensive code there is not a problem, but I'm curious about when the domain name is null for a registered service.  Can you provide some more detail on the scenario in which you see this?
Comment 2 Jiri Pechanec 2013-07-16 07:43:29 EDT
We are using Arquillian for deployments so this might be the issue.
Comment 3 Jiri Pechanec 2013-07-18 04:17:58 EDT
ok, upon further investigation I dare to claim that domain name will always be null.

ServiceDomain is created in SwitchYardDeployment.create(), line
_appServiceDomain = _domainManager.createDomain(_deployment.getName(), _deployment.getConfig());

The name of the domain is taken form the name of deployment. The problem is that Deployment._name attribute is initialized in method Deployment.init(). But this method is called AFTER the domain is created. So the name of the deployment is always NULL when a new domain is created.
Comment 4 JBoss JIRA Server 2013-08-20 15:24:03 EDT
Keith Babo <kbabo@redhat.com> made a comment on jira SWITCHYARD-1632

pushed
Comment 5 Jiri Pechanec 2013-09-16 04:46:26 EDT
Verified in ER2

Note You need to log in before you can comment on or make changes to this bug.