I am not really sure if this is a Apache Karaf issue or a Apache ServiceMix
but this seemed the most appropriate place to post this question.

I wanted to try the Scala DSL for appache camel, I followed the instructions
at http://camel.apache.org/scala-dsl.html and everything works when I run
'mvn compile exec:java'. So far everything works.

I packaged it as a OSGI bundle with a basic blueprint.xml like this, build
it using 'mvn deploy' and placed the .jar file in ServiceMixs 'deploy'
folder.

        <?xml version="1.0" encoding="UTF-8"?>
        <blueprint
            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xsi:schemaLocation="
              http://www.osgi.org/xmlns/blueprint/v1.0.0
              http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>

            <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
                <package>foo.bar</package>
            </camelContext>

        </blueprint>

There was no complaints in the ServiceMix log but it said something like
"Total 0 routes, of which 0 is started" so I figured my "MyRouteBuilder"
class was not found, when I declared it manually like this:

        <?xml version="1.0" encoding="UTF-8"?>
        <blueprint
            xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xsi:schemaLocation="
              http://www.osgi.org/xmlns/blueprint/v1.0.0
              http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>

            <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
                <package>foo.bar</package>
                <routeBuilder ref="myRoute"/>
            </camelContext>

            <bean id="myRoute" class="foo.bar.MyRouteBuilder"/>
        </blueprint>

I got a critical ClassNotFoundException in my log file:

        Caused by: org.apache.camel.NoSuchBeanException: Cannot lookup:
myRoute from registry:
org.apache.camel.blueprint.BlueprintContainerRegistry@19518d26 with expected
type: interface org.apache.camel.RoutesBuilder due: Cound not create
component instance for myRoute
        [REMOVED]
        Caused by:
org.osgi.service.blueprint.container.ComponentDefinitionException: Cound not
create component instance for myRoute
        [REMOVED]
        Caused by: java.lang.NoClassDefFoundError:
org/apache/camel/scala/dsl/builder/RouteBuilder
        [REMOVED]
        Caused by: java.lang.ClassNotFoundException:
org.apache.camel.scala.dsl.builder.RouteBuilder not found by stgfiles [199]
        [REMOVED]

At this point I realised that I never told ServiceMix / Camel what my
dependencies was so I tried running 'features:install camel-scala' in the
ServiceMix console. This failed with a 

        Error executing command: URL
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.scala-library/2.9.1_3]
could not be resolved.

I have 'camel-scala' declared as a dependency in my maven POM file and maven
can find it but for some reason Apache Karaf can not find it.

Am I doing something wrong?



--
View this message in context: 
http://servicemix.396122.n5.nabble.com/Problems-with-camel-scala-features-install-camel-scala-does-not-work-tp5718364.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to