Search in sources :

Example 1 with EJBEndpoint

use of org.apache.cxf.jca.servant.EJBEndpoint in project cxf by apache.

the class JCABusFactory method initializeServantsFromProperties.

private void initializeServantsFromProperties(Properties ejbServants) throws ResourceException {
    deregisterServants(bus);
    LOG.info("Initializing EJB endpoints from properties file...");
    try {
        Enumeration<?> keys = ejbServants.keys();
        while (keys.hasMoreElements()) {
            String theJNDIName = (String) keys.nextElement();
            String value = (String) ejbServants.get(theJNDIName);
            EJBServantConfig config = new EJBServantConfig(theJNDIName, value);
            EJBEndpoint ejbEndpoint = new EJBEndpoint(config);
            ejbEndpoint.setEjbServantBaseURL(mcf.getEJBServantBaseURL());
            ejbEndpoint.setWorkManager(getWorkManager());
            Server servant = ejbEndpoint.publish();
            synchronized (servantsCache) {
                if (servant != null) {
                    servantsCache.add(servant);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw new ResourceException(new Message("FAIL_TO_START_EJB_SERVANTS", BUNDLE).toString(), e);
    }
}
Also used : EJBServantConfig(org.apache.cxf.jca.servant.EJBServantConfig) Server(org.apache.cxf.endpoint.Server) Message(org.apache.cxf.common.i18n.Message) EJBEndpoint(org.apache.cxf.jca.servant.EJBEndpoint) ResourceException(javax.resource.ResourceException) ResourceException(javax.resource.ResourceException) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ResourceException (javax.resource.ResourceException)1 Message (org.apache.cxf.common.i18n.Message)1 Server (org.apache.cxf.endpoint.Server)1 ResourceAdapterInternalException (org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException)1 EJBEndpoint (org.apache.cxf.jca.servant.EJBEndpoint)1 EJBServantConfig (org.apache.cxf.jca.servant.EJBServantConfig)1