Search in sources :

Example 6 with ResourceAdapterInternalException

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);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) BusFactory(org.apache.cxf.BusFactory) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) UriHandlerInit(org.apache.cxf.jca.core.resourceadapter.UriHandlerInit) ResourceException(javax.resource.ResourceException) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) IOException(java.io.IOException)

Example 7 with ResourceAdapterInternalException

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);
    }
}
Also used : Bus(org.apache.cxf.Bus) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) AbstractCXFTest(org.apache.cxf.test.AbstractCXFTest) Test(org.junit.Test)

Aggregations

ResourceAdapterInternalException (org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException)7 Message (org.apache.cxf.common.i18n.Message)5 IOException (java.io.IOException)3 ResourceException (javax.resource.ResourceException)2 WebServiceException (javax.xml.ws.WebServiceException)2 InputStream (java.io.InputStream)1 URL (java.net.URL)1 Properties (java.util.Properties)1 NotSupportedException (javax.resource.NotSupportedException)1 Bus (org.apache.cxf.Bus)1 BusFactory (org.apache.cxf.BusFactory)1 ClientProxyFactoryBean (org.apache.cxf.frontend.ClientProxyFactoryBean)1 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1 AbstractManagedConnectionImpl (org.apache.cxf.jca.core.resourceadapter.AbstractManagedConnectionImpl)1 UriHandlerInit (org.apache.cxf.jca.core.resourceadapter.UriHandlerInit)1 CXFInvocationHandler (org.apache.cxf.jca.cxf.CXFInvocationHandler)1 CXFInvocationHandlerData (org.apache.cxf.jca.cxf.CXFInvocationHandlerData)1 AbstractCXFTest (org.apache.cxf.test.AbstractCXFTest)1 Test (org.junit.Test)1