Category Archives: apache-karaf

HA karaf cellar cluster

I have three karaf nodes in one cellar group on my machine. First node (lb_node) is used as load_balancer and other two nodes (1_node and 2_node) are used as service nodes (with deployed features). Both nodes have /service address available. I've installed cellar-http-balancer feature on cluster. Also, I have installed locally sample feature both on 1_node and 2_node.
Problem is that, when I start 1_node and 2_node their services are not properly registered in lb_node. http-list output from lb_node:

    ID  | Servlet                    | Servlet-Name    | State       | Alias               | Url
    103 | CellarBalancerProxyServlet | ServletModel-10 | Failed      | /features           | [/features/*]
    103 | CellarBalancerProxyServlet | ServletModel-11 | Failed      | /jolokia            | [/jolokia/*]
    103 | CellarBalancerProxyServlet | ServletModel-12 | Failed      | /gogo               | [/gogo/*]
    103 | CellarBalancerProxyServlet | ServletModel-9  | Failed      | /instance           | [/instance/*]
    103 | CellarBalancerProxyServlet | ServletModel-13 | Failed      | /services           | [/services/*]
    103 | CellarBalancerProxyServlet | ServletModel-8  | Deployed    | /jolokia            | [/jolokia/*]
    103 | CellarBalancerProxyServlet | ServletModel-14 | Failed      | /system/console/res | [/system/console/res/*]
    103 | CellarBalancerProxyServlet | ServletModel-15 | Failed      | /system/console     | [/system/console/*]
    103 | CellarBalancerProxyServlet | ServletModel-3  | Deployed    | /gogo               | [/gogo/*]
    103 | CellarBalancerProxyServlet | ServletModel-2  | Deployed    | /instance           | [/instance/*]
    103 | CellarBalancerProxyServlet | ServletModel-7  | Deployed    | /features           | [/features/*]
    103 | CellarBalancerProxyServlet | ServletModel-6  | Deployed    | /services           | [/services/*]
    103 | CellarBalancerProxyServlet | ServletModel-5  | Deployed    | /system/console     | [/system/console/*]
    103 | CellarBalancerProxyServlet | ServletModel-4  | Deployed    | /system/console/res | [/system/console/res/*]

As you can see only one node registered address. When I enter lb_node url in browser to check if feature from other nodes works, it does. But when I shutdown registered node, then lb_node won't act as proxy anymore. It throws java.net.ConnectException: Connection refused

In tutorial https://karaf.apache.org/manual/cellar/latest-4/#_http_balancer there is case for only one node with service and one balancer, this is not my case.

Is there any way to achieve active/active cluster with http load balancing using karaf and cellar?

Karaf DB2 Connectvity

Im using karaf 4 server , trying to access db2 stored procedure using BasicDataSource . I have wrapped db2jcc and db2jcc_license_cu jars as bundle and installed in karaf. In my bundle I enabled dynamic imports and so DB2 driver is recognized , but the database connection is failing since its not able to recognize the license jar. How Do I make the bundle pick up the db2jcc_license_cu jar?

Apache Felix File Install example in karaf

Is there any example of how to configure/install Apache Felix File? On the official website, it mentions that you need to configure properties, etc. But nowhere have they mentioned where you need to put those configuration properties - how to set it up, etc.

I have deployed a org.apache.felix.fileinstall-3.5.0.jar file in karaf and I have the felix framework installed. Now I don't know where should I put those configuration properties so that the file install will read it.

Can anyone guide me on this?

Camel Websocket Component Fails to Install into Karaf

I'm using Apache Karaf 4.0.4 with Java Oracle 8 and trying to install the camel-websocket component. I've tried installing both versions 2.16.0 and 2.16.2 and both installs hang. If I run:

sudo wget -O /opt/apache-karaf-4.0.4/deploy/camel-websocket-2.16.2.jar http://central.maven.org/maven2/org/apache/camel/camel-websocket/2.16.2/camel-websocket-2.16.2.jar

To manually install via Karaf's hot deploy then I get the following:

[email protected]()> ERROR: Bundle org.apache.camel.camel-websocket [94] Error starting file:/opt/apache-karaf-4.0.4/deploy/camel-websocket-2.16.2.jar (org.osgi.framework.BundleException: Unable to resolve org.apache.camel.camel-websocket [94](R 94.0): missing requirement [org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0))) Unresolved requirements: [[org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))]) org.osgi.framework.BundleException: Unable to resolve org.apache.camel.camel-websocket [94](R 94.0): missing requirement [org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0))) Unresolved requirements: [[org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))] at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111) at org.apache.felix.framework.Felix.startBundle(Felix.java:2117) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) at java.lang.Thread.run(Thread.java:745)

Has anyone run into this issue? Any workarounds? How can I install javax.servlet manually? Thanks!

Camel Websocket Component Fails to Install into Karaf

I'm using Apache Karaf 4.0.4 with Java Oracle 8 and trying to install the camel-websocket component. I've tried installing both versions 2.16.0 and 2.16.2 via:

feature:install camel-websocket

... and Karaf hangs and never returns.

As a work around I tried to run:

sudo wget -O /opt/apache-karaf-4.0.4/deploy/camel-websocket-2.16.2.jar http://central.maven.org/maven2/org/apache/camel/camel-websocket/2.16.2/camel-websocket-2.16.2.jar

To manually install via Karaf's hot deploy then I get the following:

[email protected]()> ERROR: Bundle org.apache.camel.camel-websocket [94] Error starting file:/opt/apache-karaf-4.0.4/deploy/camel-websocket-2.16.2.jar (org.osgi.framework.BundleException: Unable to resolve org.apache.camel.camel-websocket [94](R 94.0): missing requirement [org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0))) Unresolved requirements: [[org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))]) org.osgi.framework.BundleException: Unable to resolve org.apache.camel.camel-websocket [94](R 94.0): missing requirement [org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0))) Unresolved requirements: [[org.apache.camel.camel-websocket [94](R 94.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))] at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111) at org.apache.felix.framework.Felix.startBundle(Felix.java:2117) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) at java.lang.Thread.run(Thread.java:745)

I did find that when I turned on debugging in Karaf (i.e. log:set DEBUG) I saw the following error:

2016-03-10 14:54:08,127 | INFO | nsole user karaf | FeaturesServiceImpl | 9 - org.apache.karaf.features.core - 4.0.4 | Adding features: camel-websocket/[2.16.2,2.16.2] 2016-03-10 14:54:08,131 | DEBUG | pool-25-thread-1 | configadmin | 7 - org.apache.felix.configadmin - 1.8.8 | getProperties() 2016-03-10 14:54:08,148 | DEBUG | pool-25-thread-1 | Overrides | 9 - org.apache.karaf.features.core - 4.0.4 | Unable to load overrides bundles list java.io.FileNotFoundException: /opt/apache-karaf-4.0.4/etc/overrides.properties (No such file or directory) at java.io.FileInputStream.open0(Native Method)[:1.8.0_73] at java.io.FileInputStream.open(FileInputStream.java:195)[:1.8.0_73

Has anyone run into this issue? Any workarounds? How can I install javax.servlet manually? Thanks!

Apache Karaf 3rd party jar without bundle

I got a 3rd party jar which I am using for Blowfish decryption in a bundle that I need to deploy on apache karaf.

So now I also need karaf to know this jar but every solution I find is about creating a whole bundle for that jar which is pretty much for a simple library imo.

What I already did is installing that jar in my local maven repository and adding the dependency but this also doesn't work (at least on karaf).

Is there any other way to get 3rd party jars on apache karaf to work?

exeucting osgi bundle in apache-karaf runtime in eclipse IDE throws null pointer exception

I am trying to create a simple OSGI bundle using eclipse-Mars and apache karaf. I've downloaded EIK plugin from this link and integrated EIK plugin by following the steps in the link. I have created a osgi bundle using this link. While trying to set target platform in plugin development it is not showing apache-karaf but by creating target platform from EIK showing compilation errors in osgi project.

Environment:
    OS: Windows 7 64 bit 
    Eclipse-Mars
    JDK-1.7.u75

Issues

    1. I tried to map the latest apache karaf-4.0.x but it is not resolving when i tried to use apache-karaf-2.2.x it got resolved. Is there any dependency for karaf with eclipse.
    2. The project got executed successfully when i set my runtime as Equinox as default runtime. Is there any dependency for executing apache-karaf as runtime? 
    3. I got the below exception in eclipse for apache-karaf as runtime.
    4. Is there any dependency between eclipse, apache-karaf version?

An internal error occurred during: "Launching Karaf-Test".
java.lang.NullPointerException

Can anybody suggest me some links or please tell me what is going wrong in my setup.

Soap request using apache camel blueprint on apache karaf fails

I'm trying to send a soap request with camel blueprint and by now I got this blueprint.xml

<?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
   http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

<bean id="serviceBean" class="osgiBlueprintSoap.Service"/>

<cxfEndpoint id="serviceEndpoint" 
    address="{http://some.url/services/}SomeService"
    wsdlUrl="{http://some.url/services/}SomeService?wsdl"
    serviceName="{http://some.url/services/}SomeService"
    portName="{http://some.url/services/}SomeServiceSoapPort">
    <properties>
        <entry key="dataFormat" value="MESSAGE"/>
    </properties>
</cxfEndpoint>  

<camelContext xmlns="http://camel.apache.org/schema/blueprint">
  <route id="timerToLog">
    <from uri="timer:foo?period=5000"/>
    <to uri="cxf:serviceBean:serviceEndpoint"/>
    <to uri="file:C:/output?fileName=db.txt"/>
  </route>
</camelContext>

The class Service is just an empty class right now.

After deploying it on karaf I get this error

org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'cxfEndpoint'. One of '{"http://www.osgi.org/xmlns/blueprint/v1.0.0":service, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference-list, "http://www.osgi.org/xmlns/blueprint/v1.0.0":bean, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference, WC[##other:"http://www.osgi.org/xmlns/blueprint/v1.0.0"]}" is expected.

Can anyone tell me what is wrong with that xml and what I can do to be able to send this request?