Yes, i'm trying to deply my application in glassfish.

My EJB for setup Camel:

@Singleton
@Startup
public class CamelLoadContext {

    Logger log = Logger.getLogger(CamelLoadContext.class);

    @PostConstruct
    public void camelSetUp() {
        try {
            CamelContext context = new DefaultCamelContext();

            // enlist EJB component using the JndiContext
            EjbComponent ejb = context.getComponent("ejb",
EjbComponent.class);

            Properties properties = new Properties();
            properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");

            ejb.setContext(new InitialContext(properties));

            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() throws Exception {
                    from("time:foo?period=10s")
                            .to("ejb:testEjb?method=hello")
                            .to("mock:result");
                }
            });

            context.start();
        } catch (Exception e) {
            log.error(e);
        }
    }
}

EJB which should be called by Camel:

@Stateless(name = "testEjb", mappedName = "testEjb")
public class MessageEjb {
    Logger log = Logger.getLogger(MessageEjb.class);

    public void hello(Message message) {
        log.info("HELLO!");
        log.info(message.toString());
    }
}

Maven dependencies:

    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-ejb</artifactId>
            <version>2.12.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.12.1</version>
        </dependency>


        <dependency>
            <groupId>org.apache.openejb</groupId>
            <artifactId>openejb-core</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.openejb</groupId>
            <artifactId>openejb-client</artifactId>
            <version>4.5.2</version>
        </dependency>
    </dependencies>

I package this files in ejb jar by maven plugin, then package this jar and
all dependency into ear which i'm trying to deploy.



--
View this message in context: 
http://openejb.979440.n4.nabble.com/OpenEJB-with-apache-camel-tp4666138p4666143.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to