// Needed to retain prior semantics of fail-on-initialise if service lookup fails
try {
Collection<EPR> _targetEprs = RegistryUtil.getEprs(_targetServiceCategory,
_targetServiceName);
if (null == _targetEprs || _targetEprs.size() < 1)
throw new ManagedLifecycleException("EPR <"
+ _targetServiceName + "> not found in registry");
} catch (ServiceNotFoundException snfe) {
throw new ManagedLifecycleException("EPR <" + _targetServiceName + " "
+ _targetServiceName + "> not found in registry");
}
catch (final RegistryException re) {
throw new ManagedLifecycleException(
"Unexpected registry exception", re);
}
try {
_serviceInvoker = new ServiceInvoker(_targetServiceCategory, _targetServiceName);
} catch (MessageDeliverException e) {
throw new ManagedLifecycleException(e);
}
durableSubscriptionName = _config.getAttribute(JMSEpr.DURABLE_SUBSCRIPTION_NAME);
try {
prepareMessageReceiver();
}
catch (final ConnectionException ce) {
throw new ManagedLifecycleException(
"Unexpected connection exception from prepareMessageReceiver",
ce);
}
catch (final JMSException jmse) {
throw new ManagedLifecycleException(
"Unexpected JMS error from prepareMessageReceiver", jmse);
}
catch (final ConfigurationException ce) {
throw new ManagedLifecycleException(
"Unexpected configuration exception from prepareMessageReceiver",
ce);
} catch (final NamingContextException nce) {
throw new ManagedLifecycleException(
"Unexpected naming context exception from prepareMessageReceiver",
nce);
}
if (_serviceName != null) {
try {
RegistryUtil.register(_config, _myEpr);
}
catch (final RegistryException re) {
throw new ManagedLifecycleException(
"Unexpected error during registration for epr "
+ _myEpr, re);
}
}
}