Rehan
Rehan

Reputation: 1039

Apache Camel error starting bundle

Learning Apache Camel- Trying to deploy an application on jboss-fuse-6.1.0.redhat-379.

The POM is as follows

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.dao</groupId>
        <artifactId>camelDAO</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>bundle</packaging>
        <properties>
        <camel-version>2.13.0</camel-version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.17</version>
            </dependency>
            <dependency>
                <groupId>commons-dbcp</groupId>
                <artifactId>commons-dbcp</artifactId>
                <version>1.4</version>
            </dependency>
            <dependency>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-jdbc</artifactId>
                <version>2.13.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-sql</artifactId>
                <version>2.13.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-core</artifactId>
                <version>${camel-version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-spring</artifactId>
                <version>${camel-version}</version>
            </dependency>
            <dependency>
                <groupId>commons-pool</groupId>
                <artifactId>commons-pool</artifactId>
                <version>1.4</version>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <extensions>true</extensions>
                </plugin>

                <plugin>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-maven-plugin</artifactId>
                    <version>${camel-version}</version>
                </plugin>
            </plugins>
        </build>
    </project>

In database config file have configured the following

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost/univ" />
        <property name="username" value="root" />
        <property name="password" value="pass" />
</bean>


<bean id="sqlComponent"                                       
      class="org.apache.camel.component.sql.SqlComponent">
      <property name="dataSource" ref="dataSource" />
</bean>

and in route have made call to sql component

<to uri="sqlComponent:{{sql.insertData}}" />

while deploying on fuse getting-

Error executing command: Error starting bundles:
    Unable to start bundle 255: Unresolved constraint in bundle  
com.dao.came
lDAO [255]: Unable to resolve 255.0: missing requirement [255.0]   
osgi.wiring.pac
kage; (&(osgi.wiring.package=org.apache.camel.component.sql)  
(version>=2.13.0)(!(
version>=3.0.0))) [caused by: Unable to resolve 253.0: missing   
requirement [253.
0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.camel) 
(version>=2.13.0
)(!(version>=3.0.0)))]

Have installed the jars using wrap:install, still getting the above error

Kindly help me figure out. Thanks

Upvotes: 1

Views: 3203

Answers (2)

Sabari
Sabari

Reputation: 11

You need to install Mysql Connector in Jboss Fuse. For install we need to run the following statement in the Fuse terminal.

osgi:install -s wrap:mvn:mysql/mysql-connector-java/5.1.39

Version can be changed based on your mysql connector used.

Once after install. try to run your project.

Upvotes: 1

Alexey Yakunin
Alexey Yakunin

Reputation: 1771

Try to import missing packages:

    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.7</version>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                <Bundle-Description>${project.description}</Bundle-Description>
                <Import-Package>
                    *,
                    org.apache.camel.osgi,
                    org.apache.camel.component.sql,
                    org.apache.camel
                </Import-Package>
            </instructions>
        </configuration>
    </plugin>

And camel-sql feature must be installed.

UPDATED:

Have installed the jars using wrap:install

You need to do that only for database drivers, all other must be installed by features.

>    <bean id="sqlComponent"                                       
>          class="org.apache.camel.component.sql.SqlComponent">
>          <property name="dataSource" ref="dataSource" />    
>    </bean>

That can be implemented simpler:

<to uri="sql:{{sql.insertData}}?dataSource=dataSource" />

And please, check your Camel version, installed on jboss fuse server, it must match the one specified in your project.

Upvotes: 1

Related Questions