Thanks for your answer.
It's very strange, I tried the same at home now where I have a linux environment (at work it's Windows) and now it works.
My blueprint.xml looks like this now:
<bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616" />
    </bean>

<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration"> <property name="connectionFactory" ref="activemqConnectionFactory" />
        <property name="transacted" value="true" />
    </bean>

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="configuration" ref="jmsConfig" />
    </bean>

And in my main class I do:
        CamelContext context = new DefaultCamelContext();
JmsConfiguration jmsConfig = new JmsConfiguration(new ActiveMQConnectionFactory("tcp://localhost:61616"));
        context.addComponent("activemq", new JmsComponent(jmsConfig ));
        context.setTracing(true);
        context.addRoutes(new Jms2RestRoute());

I "think" I had the same in my Windows installation, I'm going to compare that on Monday. In my Windows installation I always got that error: 2014-01-30 16:53:47,531 | INFO | l Console Thread | BlueprintContainerImpl | container.BlueprintContainerImpl 344 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Bundle org.apache.camel.example.jmstofile.camel-example-jms-file is waiting for
dependencies [(objectClass=javax.jms.ConnectionFactory)]

Anyway under Linux it's working and I hope I can find a difference in my setup to my Windows installation.

Thanks,
Laci


On 30.01.2014 18:54, Johan Edstrom wrote:
Right now you are doing both, configuring camel via code as well as in 
Blueprint.
You want to pick one, you could let Blueprint instantiate a bean for you
via the init-method and there setup Camel or you could declare the components
and the CamelContext in Blueprint and just add a RouteBuilder.

The latter is the most common.

It looks like you haven't installed camel - you need to add a features url
and do a features:install camel-jms


On Jan 30, 2014, at 6:51 AM, Laci Gaspar <[email protected]> wrote:

Hi JB
This is my MANIFEST file:
Import-Package: javax.jms,org.apache.activemq,org.apache.activemq.camel.
component,org.apache.camel;version="[2.12,3)",org.apache.camel.builder;
version="[2.12,3)",org.apache.camel.component.jms;version="[2.12,3)",or
g.apache.camel.impl;version="[2.12,3)",org.apache.camel.model;version="
[2.12,3)",org.osgi.service.blueprint;version="[1.0.0,2.0.0)"


What I am confused about is:
In the examples I am supposed to configure the connectionFactory in the broker 
configuration of AMQ.
But I want to do this in Java.

Any ideas?
Best,
Laci

On 30.01.2014 13:29, Jean-Baptiste Onofré wrote:
Hi Laci,

do you import org.apache.camel package in your bundle ?

Regards
JB

On 01/30/2014 01:15 PM, Laci Gaspar wrote:
Hi
I'm just starting, please excuse silly questions.

I'm having problems writing an example that uses camel, activemq, karaf.
As a basis I used the Camel Example camel-example-jms-file.

Then I adapted the pom file, so that it builds a bundle. So far so good.
After installing it in karaf nothing happened, the route didn't start.

Then I looked in other examples  (jms2rest in the karaf tutorials ) and
so I added a blueprint.xml file to the project.
    <bean id="jms2FileRoute"
class="org.apache.camel.example.jmstofile.Jms2FileRoute">
     </bean>
     <camelContext id="jms2file"
xmlns="http://camel.apache.org/schema/blueprint";>
         <routeBuilder ref="jms2FileRoute" />
     </camelContext>
      <bean id="connectionFactory" class="javax.jms.ConnectionFactory" />
     <bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
         <property name="connectionFactory" ref="connectionFactory"/>
     </bean>
     <bean id="jms-test"
class="org.apache.camel.component.jms.JmsComponent">
         <argument ref="jmsConfig"/>
     </bean>
       <bean id="activemqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
          <property name="brokerURL" value="tcp://0.0.0.0:61616" />
      </bean>
      <bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
          <property name="maxConnections" value="8" />
          <property name="connectionFactory"
ref="activemqConnectionFactory" />
      </bean>

In my main class i do:
         CamelContext context = new DefaultCamelContext();
         JmsConfiguration jmsConfig = new JmsConfiguration(new
ActiveMQConnectionFactory("tcp://localhost:61616"));
         context.addComponent("jms-test", new JmsComponent(jmsConfig ));


After installing the bundle in karaf,  i get the log message:
2014-01-30 13:09:38,145 | INFO  | l Console Thread |
BlueprintContainerImpl           | container.BlueprintContainerImpl  360
| 7 - org.apache.aries.blueprint.core - 1.1.0 | Bundle
org.apache.camel.example.jmstofile.camel-example-jms-file is waiting for
dependencies
[(&(component=test-jms)(objectClass=org.apache.camel.spi.ComponentResolver))]


It seems that something is wrong with my ActiveMQConnectionFactory, but
I can't figure out what.

Any advice would be most helpful as well as a working up to date example
that involves AMQ, camel and karaf.

Thanks a lot,
Laci


Reply via email to