When you install Camel components, you should use the features rather than the 
bundles.  That will make sure you get all the dependencies for that particular 
component.

feature:install camel-sql




> On Oct 23, 2018, at 1:15 PM, John F. Berry <bohnje...@yahoo.com.INVALID> 
> wrote:
> 
> Again.. Quinn.. Thanks!
> 
> OK.. now I feel this is a Karaf issue inside a Camel forum (sorry folks).I 
> did install that hapi "bundle" into Karaf... that only made it complain about 
> camel-sql, but given your example, I found the "bundle" to install for that.. 
> then it complained about apache.commons.dbcp2.. installed that.. then it 
> complained about camel sql again?  and spring? I don't even have reference to 
> spring in my project?
>         Unable to start bundle mvn:org.ZZZ.camel/EDMtoPSoft-java/1.0.0: 
> org.osgi.framework.BundleException: Unable to resolve EDMtoPSoft-java [74](R 
> 74.0): missing requirement [EDMtoPSoft-java [74](R 74.0)] 
> osgi.wiring.package; 
> (&(osgi.wiring.package=org.apache.camel.component.sql)(version>=2.21.0)(!(version>=3.0.0)))
>  [caused by: Unable to resolve org.apache.camel.camel-sql [78](R 
> 78.0):missing requirement [org.apache.camel.camel-sql [78](R 78.0)] 
> osgi.wiring.package; 
> (&(osgi.wiring.package=org.springframework.dao)(version>=4.1.0)(!(version>=5.0.0)))]
>  Unresolved requirements: [[EDMtoPSoft-java [74](R 74.0)] 
> osgi.wiring.package; 
> (&(osgi.wiring.package=org.apache.camel.component.sql)(version>=2.21.0)(!(version>=3.0.0)))]
> Are these dependencies supposed to be listed under the Felix plugin as export 
> packages?
> 
>    On Monday, October 22, 2018, 9:32:22 PM EDT, Quinn Stevenson 
> <qu...@pronoia-solutions.com> wrote:  
> 
> You’ll need to add HAPI to the container
> 
> install mvn:ca.uhn.hapi/hapi-osgi-base/2.3
> 
> 
>> On Oct 22, 2018, at 9:12 AM, John F. Berry <bohnje...@yahoo.com.INVALID> 
>> wrote:
>> 
>> 
>> 
>> I have added these to the POM... just in case that solved the Karaf issue.  
>> No luck!
>> 
>> <dependency>
>>   <groupId>ca.uhn.hapi</groupId>
>>   <artifactId>hapi-base</artifactId>
>>   <version>2.1</version>
>> </dependency>
>> 
>> <dependency>
>>     <groupId>ca.uhn.hapi</groupId>
>>     <artifactId>hapi-osgi-base</artifactId>
>>     <version>2.0</version>
>> </dependency>
>> 
>> 
>> 
>> 
>> On Monday, October 22, 2018, 9:34:31 AM EDT, John F. Berry 
>> <bohnje...@yahoo.com> wrote: 
>> 
>> 
>> 
>> 
>> 
>> You've been so much help Quinn, thanks!
>> I did not realize you could import a bundle though maven like that
>> 
>> So close...
>> 
>> I got an error because of some unresolved requirements with OSGi and my hl7 
>> parsing package:
>> 
>> osgi.wiring.package; (osgi.wiring.package=ca.uhn.hl7v2.model) Unresolved 
>> requirements: [[EDMtoPSoft-java [71](R 71.0)] osgi.wiring.package; 
>> (osgi.wiring.package=ca.uhn.hl7v2.model)
>> 
>> I do have this set under the felix plugin:      
>> <Import-Package>*</Import-Package>
>> 
>> I did notice I was missing a dependency in my POM
>> but it is being imported in my routebuilder java:
>> import ca.uhn.hl7v2.model.Message;
>> import ca.uhn.hl7v2.util.Terser;
>> import ca.uhn.hl7v2.DefaultHapiContext;
>> import ca.uhn.hl7v2.HL7Exception;
>> import ca.uhn.hl7v2.HapiContext;
>> 
>> I assume I should have this declared as a POM dependency?  I've tried a few 
>> blind tries at declaring something, but can't seem to get it. 
>> 
>> 
>> 
>> On ‎Thursday‎, ‎October‎ ‎18‎, ‎2018‎ ‎10‎:‎53‎:‎10‎ ‎PM‎ ‎EDT, Quinn 
>> Stevenson <qu...@pronoia-solutions.com> wrote: 
>> 
>> 
>> 
>> 
>> 
>> I could be a Karaf install issue.  The Karaf setup is usually pretty simple
>> - expand the Karaf archive
>> - start Karaf ( $KARAF_HOME/bin/start )
>> - login to the Karaf console ($KARAF_HOME/bin/client)
>> - add the Came feature repositoryl into the Karaf container ( 
>> feature:repo-add camel 2.21.1)
>> - install Camel into the container ( feature:install camel )
>> 
>> At that point, you should be able to see some Camel bundles when you  list 
>> the bundles in the container ( list )
>> 
>> Now, your “bundle” is just your jar (with the OSGi bundle metadata in the 
>> MANIFEST.MF - that’s what the maven-bundle-plugin adds).  Assuming you’re 
>> bundle doesn’t require anything outside of camel-core, you should be able to 
>> install your bundle in your local Maven repository (mvn install), and then 
>> install it into Karaf from the Karaf console ( install -s 
>> mvn:group-id/artifact-id/version ).
>> 
>> Another option is to you the file deployer.  If you have a simple Camel 
>> Blueprint route, you can put the XML file in the $KARAF_HOME/deploy 
>> directory and the context should start.
>> 
>> BTW - the error below isn’t a Java error - it’s a Blueprint error.  
>> Something went wrong when Blueprint tried to execute the definitions in your 
>> Blueprint XML file.
>> 
>>> On Oct 17, 2018, at 8:53 AM, John F. Berry <bohnje...@yahoo.com.INVALID> 
>>> wrote:
>>> 
>>> Thanks Quinn for your advice and patience (and for the rest of the forum 
>>> members!) 
>>> 
>>> I did attempt to make the changes below.. and to research the elements you 
>>> presented to understand them better.. However, I'm still at an impasse.
>>> I still cannot "deploy" into Karaf.. Perhaps this is a Karaf install issue 
>>> and have also discussed this in that forum.
>>> What exactly is the "bundle" to deploy?  Is it the entire project directory 
>>> and its contents?  
>>> 
>>> A side note:  I've attempted to create a new maven generated 
>>> camel-archetype-blueprint project (selection 1187 from the archetype list 
>>> in maven 3.5.3) and upon installing it (with no mods), I get a java error:  
>>> [        Blueprint Extender: 1] BlueprintContainerImpl        INFO  
>>> Blueprint bundle org.apache.aries.blueprint.core/1.10.0 has been started[   
>>>      Blueprint Extender: 2] BlueprintContainerImpl        ERROR Unable to 
>>> start container for blueprint bundle org.apache.camel.camel-blueprint/2.22.1
>>> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable 
>>> to instantiate components
>>> 
>>> So I was planning to start this new project and attempt deployment to 
>>> Karaf.. and add the steps of my route one at a time.. but I cannot even 
>>> start with this one!
>>> 
>>> Thanks!
>>> 
>>> 
>>> On Wednesday, September 5, 2018, 10:18:53 AM EDT, Quinn Stevenson 
>>> <qu...@pronoia-solutions.com> wrote: 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Assuming you’re using Maven, you can use the maven-bundle-plugin to 
>>> generate the OSGi metadata in the MANIFEST.MF (which is what makes a jar a 
>>> bundle).  You’ll add something like the following to your build plugins
>>> 
>>> <plugin>
>>>     <groupId>org.apache.felix</groupId>
>>>     <artifactId>maven-bundle-plugin</artifactId>
>>>     <version>3.5.0</version>
>>>     <extensions>true</extensions>
>>> </plugin>
>>> 
>>> and you’ll need to change the <packaging> element to bundle for your 
>>> artifact.  If you were creating a jar before you may not have the packaging 
>>> element (since jar is the default for this), so you may need to add it.  
>>> Here’s an example from one of my other projects
>>> 
>>> <groupId>com.github.hqstevenson.splunk</groupId>
>>> <artifactId>splunk.httpec</artifactId>
>>> <packaging>bundle</packaging>
>>> <version>1.5.1</version>
>>> 
>>> After you have a bundle, you can install it into Karaf however you’d like - 
>>> putting the bundle in the deploy folder is one way.  BTW - if you still had 
>>> the Blueprint/XML version of the route, you could put the XML file into the 
>>> deploy folder as well - Karaf would run it for you, and you wouldn’t have 
>>> to package it in bundle (I have a few customers that do this in some cases).
>>> 
>>> 
>>>> On Sep 5, 2018, at 7:17 AM, John F. Berry <bohnje...@yahoo.com.INVALID> 
>>>> wrote:
>>>> 
>>>> Thanks Quinn, 
>>>> I haven't converted my jar at all.. I've only packaged my camel java DSL 
>>>> project into an executable jar from maven.
>>>> So I think you're giving me step #2 of a process if I already converted my 
>>>> jar to an OSGi bundle.  I haven't and don't know offhand how to.
>>>> If I had this jar as an OSGi bundle, couldn't I simply place it in the 
>>>> deploy folder of Karaf?  
>>>> 
>>>> Sorry folks!  I know this is a Camel thread not a Karaf or OSGi forum.
>>>> 
>>>> 
>>>> On Wednesday, September 5, 2018, 9:10:33 AM EDT, Quinn Stevenson 
>>>> <qu...@pronoia-solutions.com> wrote: 
>>>> 
>>>> 
>>>> 
>>>> The easiest way to bootstrap a route in Karaf is to use Blueprint.  I’m 
>>>> assuming you’ve already converted your jar to an OSGi bundle.
>>>> 
>>>> If you add a small XML file to src/main/resources/OSGI-INF/blueprint 
>>>> (assuming you’re using Maven for this) the route should startup in Karaf 
>>>> when you install your bundle.  The XML file will look something like this
>>>> 
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
>>>> 
>>>>   <bean id="route-builder" class="my.route.Builder" />
>>>> 
>>>>   <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
>>>>       <routeBuilder ref="route-builder" />
>>>>   </camelContext>
>>>> 
>>>> </blueprint>
>>>> 
>>>> HTH
>>>> 
>>>> 
>>>>> On Sep 4, 2018, at 10:10 AM, John F. Berry <bohnje...@yahoo.com.INVALID> 
>>>>> wrote:
>>>>> 
>>>>> I've posted a few questions over the past month about various steps in a 
>>>>> camel route.  I had developed both a Spring version and a Java DSL 
>>>>> version simultaneously at the beginning, because of either the lack or 
>>>>> abundance of certain endpoint development in each.  The Java DSL version  
>>>>> worked out best in the continuing development, but then the "powers that 
>>>>> be" asked me to make a Windows service for it.  
>>>>> I ended up being able to package it to en executable jar, but then found 
>>>>> that perhaps I should use Karaf as an OSGi container run as a windows 
>>>>> service.  I have Karaf installed with it's awaiting service container, 
>>>>> but it looks like it's a pain to configure a Camel Java DSL route to an 
>>>>> OSGi container, but what I did seem to find was people have used a Spring 
>>>>> OSGi Camel package and overrode the configuration to execute a java 
>>>>> "bean".
>>>>> My question is:  Can the entire Camel Context developed in Spring be 
>>>>> pointed to the completed Java DSL developed package?  Can I just add a 
>>>>> shell around my already completed work?  My route runs fine from maven 
>>>>> using "mvn exec:java" or running java - jar <package> .
>>>>> Now that I got this running, I'd rather not disassemble and re-wire, 
>>>>> although it would be a good educational experience. 
>>>>> 
>>>>> MyRouteBuilder.java :
>>>>> 
>>>>> import java.util.Base64;
>>>>> import org.apache.camel.spi.DataFormat;
>>>>> 
>>>>> 
>>>>> import ca.uhn.hl7v2.parser.Parser;
>>>>> import org.apache.commons.dbcp2.BasicDataSource;
>>>>> import org.apache.camel.component.sql.SqlComponent;
>>>>> 
>>>>> public class MyRouteBuilder extends RouteBuilder {
>>>>>     @Override
>>>>>     public void configure() throws Exception {
>>>>>                 BasicDataSource basicDataSource = new BasicDataSource();
>>>>>                 
>>>>> basicDataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
>>>>>                 
>>>>> basicDataSource.setUrl("jdbc:sqlserver://XXX:52739;databaseName=XXX;");
>>>>>                 basicDataSource.setUsername("XXX");
>>>>>                 basicDataSource.setPassword("XXX");
>>>>>                 SqlComponent sqlComponent = new SqlComponent();
>>>>>                 sqlComponent.setDataSource(basicDataSource);
>>>>>                 getContext().addComponent("psoft-sql", sqlComponent);
>>>>> 
>>>>> 
>>>>>         from("mllp://ZZZ:8888")
>>>>>         .log("..Received HL7 message with control id 
>>>>> ${header.CamelMllpMessageControlId}")
>>>>>         .convertBodyTo(String.class)
>>>>>         .unmarshal()
>>>>>         .hl7(false)
>>>>>         .process(new Processor() {
>>>>>           public void process(Exchange exchange) throws Exception {
>>>>>           Message message = exchange.getIn().getBody(Message.class);
>>>>>           ca.uhn.hl7v2.util.Terser terser = new Terser(message);
>>>>>           String obx5 = terser.get("/.OBX-5-5");
>>>>>           String EDMId = terser.get("/.OBR-3") + ".pdf";
>>>>>           String voucher = terser.get("/.OBR-2");
>>>>> 
>>>>>           byte[] decoded = Base64.getDecoder().decode(obx5);
>>>>>           exchange.getOut().setBody(decoded);
>>>>>           exchange.getOut().setHeader("voucher", voucher);
>>>>>           exchange.getOut().setHeader("CamelFileName", EDMId );
>>>>>             }
>>>>>           } )
>>>>>       .log("..Processed voucher ${header.voucher} to file 
>>>>> ${header.CamelFileName}")
>>>>>       .to("file:target/messages/others")
>>>>>       .recipientList(simple("psoft-sql:INSERT INTO 
>>>>> lawsonprod.PeopleSoftVCR (Voucher, Facility, image) VALUES ('12345', '1', 
>>>>> '${header.CamelFileName}')") )
>>>>>       ;
>>>>> 
>>>>>     }
>>>>> 
>>>>> }
>>>>> 
>>>>> POM.xml (given there's a lot of extras in here not used due to attempts 
>>>>> during development) 
>>>>> 
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <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/maven-v4_0_0.xsd";>
>>>>> 
>>>>>   <modelVersion>4.0.0</modelVersion>
>>>>> 
>>>>>   <groupId>org.ZZZ.camel</groupId>
>>>>>   <artifactId>EDMtoPSoft-java</artifactId>
>>>>>   <packaging>jar</packaging>
>>>>>   <version>1.0-SNAPSHOT</version>
>>>>> 
>>>>>   <name>EDM base64 HL7 documents to PeopleSoft</name>
>>>>> 
>>>>>   <properties>
>>>>>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>>>>     
>>>>> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
>>>>>   </properties>
>>>>> 
>>>>>   <dependencyManagement>
>>>>>     <dependencies>
>>>>>       <!-- Camel BOM -->
>>>>>       <dependency>
>>>>>         <groupId>org.apache.camel</groupId>
>>>>>         <artifactId>camel-parent</artifactId>
>>>>>         <version>2.21.1</version>
>>>>>         <scope>import</scope>
>>>>>         <type>pom</type>
>>>>>       </dependency>
>>>>>     </dependencies>
>>>>>   </dependencyManagement>
>>>>> 
>>>>>   <dependencies>
>>>>> 
>>>>>     <dependency>
>>>>>       <groupId>org.apache.camel</groupId>
>>>>>       <artifactId>camel-core</artifactId>
>>>>>     </dependency>
>>>>> 
>>>>>     <!-- logging -->
>>>>>     <dependency>
>>>>>       <groupId>org.apache.logging.log4j</groupId>
>>>>>       <artifactId>log4j-api</artifactId>
>>>>>       <scope>runtime</scope>
>>>>>     </dependency>
>>>>>     <dependency>
>>>>>       <groupId>org.apache.logging.log4j</groupId>
>>>>>       <artifactId>log4j-core</artifactId>
>>>>>       <scope>runtime</scope>
>>>>>     </dependency>
>>>>>     <dependency>
>>>>>       <groupId>org.apache.logging.log4j</groupId>
>>>>>       <artifactId>log4j-slf4j-impl</artifactId>
>>>>>       <scope>runtime</scope>
>>>>>     </dependency>
>>>>> 
>>>>>     <!-- testing -->
>>>>>     <dependency>
>>>>>       <groupId>org.apache.camel</groupId>
>>>>>       <artifactId>camel-test</artifactId>
>>>>>       <scope>test</scope>
>>>>>     </dependency>
>>>>> 
>>>>>     <dependency>
>>>>>     <groupId>javax.xml.bind</groupId>
>>>>>     <artifactId>jaxb-api</artifactId>
>>>>>     <version>2.2.11</version>
>>>>>     </dependency>
>>>>>     <dependency>
>>>>>     <groupId>javax.activation</groupId>
>>>>>     <artifactId>activation</artifactId>
>>>>>     <version>1.1.1</version>
>>>>>     </dependency>
>>>>>     <dependency>
>>>>>     <groupId>org.apache.camel</groupId>
>>>>>     <artifactId>camel-mllp</artifactId>
>>>>>     <version>2.21.1</version>
>>>>>     </dependency>
>>>>> 
>>>>>     <!-- Project stuff -->
>>>>>     <dependency>
>>>>>     <groupId>org.apache.camel</groupId>
>>>>>     <artifactId>camel-hl7</artifactId>
>>>>>     <version>2.21.1</version>
>>>>>     </dependency>
>>>>> 
>>>>>     <dependency>
>>>>>     <groupId>org.apache.camel</groupId>
>>>>>     <artifactId>camel-netty4</artifactId>
>>>>>     <version>2.21.1</version>
>>>>>     </dependency>
>>>>> 
>>>>>     <dependency>
>>>>>     <groupId>org.apache.camel</groupId>
>>>>>     <artifactId>camel-base64</artifactId>
>>>>>     <version>2.21.1</version>
>>>>>     </dependency>
>>>>> 
>>>>>     <dependency>
>>>>>     <groupId>org.apache.camel</groupId>
>>>>>     <artifactId>camel-sql</artifactId>
>>>>>     <version>2.21.1</version>
>>>>>     </dependency>
>>>>> 
>>>>>     <dependency>
>>>>>     <groupId>org.apache.commons</groupId>
>>>>>     <artifactId>commons-dbcp2</artifactId>
>>>>>     <version>2.5.0</version>
>>>>>     </dependency>
>>>>> 
>>>>>     <dependency>
>>>>>     <groupId>com.microsoft.sqlserver</groupId>
>>>>>     <artifactId>mssql-jdbc</artifactId>
>>>>>     <version>7.0.0.jre10</version>
>>>>>     </dependency>
>>>>> 
>>>>> 
>>>>>   </dependencies>
>>>>> 
>>>>>   <build>
>>>>>     <defaultGoal>install</defaultGoal>
>>>>> 
>>>>>     <plugins>
>>>>>       <plugin>
>>>>>         <groupId>org.apache.maven.plugins</groupId>
>>>>>         <artifactId>maven-compiler-plugin</artifactId>
>>>>>         <version>3.7.0</version>
>>>>>         <configuration>
>>>>>           <source>1.8</source>
>>>>>           <target>1.8</target>
>>>>>         </configuration>
>>>>>       </plugin>
>>>>>       <plugin>
>>>>>         <groupId>org.apache.maven.plugins</groupId>
>>>>>         <artifactId>maven-resources-plugin</artifactId>
>>>>>         <version>3.0.2</version>
>>>>>         <configuration>
>>>>>           <encoding>UTF-8</encoding>
>>>>>         </configuration>
>>>>>       </plugin>
>>>>> 
>>>>>       <!-- Allows the example to be run via 'mvn compile exec:java' -->
>>>>>       <plugin>
>>>>>         <groupId>org.codehaus.mojo</groupId>
>>>>>         <artifactId>exec-maven-plugin</artifactId>
>>>>>         <version>1.6.0</version>
>>>>>         <configuration>
>>>>>           <mainClass>org.ZZZ.camel.MainApp</mainClass>
>>>>>           <includePluginDependencies>false</includePluginDependencies>
>>>>>         </configuration>
>>>>>       </plugin>
>>>>> 
>>>>>             <plugin>
>>>>>                 <artifactId>maven-assembly-plugin</artifactId>
>>>>>                 <configuration>
>>>>>                     <descriptorRefs>
>>>>>                         
>>>>> <descriptorRef>jar-with-dependencies</descriptorRef>
>>>>>                     </descriptorRefs>
>>>>>                     <archive>
>>>>>                         <manifest>
>>>>>                             <mainClass>org.ZZZ.camel.MainApp</mainClass>
>>>>>                         </manifest>
>>>>>                     </archive>
>>>>>                 </configuration>
>>>>>                 <executions>
>>>>>                     <execution>
>>>>> 
>>>>>                         <phase>package</phase> <!-- bind to the packaging 
>>>>> phase -->
>>>>>                         <goals>
>>>>>                             <goal>single</goal>
>>>>>                         </goals>
>>>>>                     </execution>
>>>>>                 </executions>
>>>>>             </plugin>
>>>>> 
>>>>> 
>>>>>             <plugin>
>>>>>                 <groupId>org.apache.felix</groupId>
>>>>>                 <artifactId>maven-bundle-plugin</artifactId>
>>>>>                 <version>2.3.7</version>
>>>>>                 <extensions>true</extensions>
>>>>>                 <configuration>
>>>>>                     <instructions>
>>>>>                         <Bundle-Name>${project.name}</Bundle-Name>
>>>>>                         
>>>>> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
>>>>>                         <Export-Package>
>>>>>                             org.ZZZ.camel
>>>>>                         </Export-Package>
>>>>>                     </instructions>
>>>>>                 </configuration>
>>>>>             </plugin>
>>>>> 
>>>>>     </plugins>
>>>>>   </build>
>>>>> 
>>>>> </project>
>>>>> 

Reply via email to