use of org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException in project cxf by apache.
the class JCABusFactory method init.
protected synchronized void init() throws ResourceException {
LOG.info("Initializing the CXF Bus ...");
new UriHandlerInit();
ClassLoader original = Thread.currentThread().getContextClassLoader();
try {
ClassLoader cl = this.getClass().getClassLoader();
// ensure resourceadapter: url handler can be found by URLFactory
Thread.currentThread().setContextClassLoader(cl);
// TODO Check for the managed connection factory properties
// TODO We may need get the configuration file from properties
BusFactory bf = BusFactory.newInstance();
bus = bf.createBus();
initializeServants();
} catch (Exception ex) {
if (ex instanceof ResourceAdapterInternalException) {
throw (ResourceException) ex;
}
throw new ResourceAdapterInternalException(new Message("FAIL_TO_INITIALIZE_JCABUSFACTORY", BUNDLE).toString(), ex);
} finally {
Thread.currentThread().setContextClassLoader(original);
}
}
use of org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException in project cxf by apache.
the class DummyClassLoader method testInvalidMonitorConfigNoPropsURL.
@Test
public void testInvalidMonitorConfigNoPropsURL() throws Exception {
ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
mcf.setMonitorEJBServiceProperties(Boolean.TRUE);
JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
try {
Bus mockBus = EasyMock.createMock(Bus.class);
jcaBusFactory.setBus(mockBus);
jcaBusFactory.initializeServants();
fail("exception expected");
} catch (ResourceAdapterInternalException re) {
assertTrue("EJBServiceProperties is not set.", re.getMessage().indexOf("EJBServicePropertiesURL is not set") != -1);
}
}
Aggregations