Skip to content

Instantly share code, notes, and snippets.

View gist:29e76a8c87711641449cc06741edd855
Apache Karaf (4.3.3)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
karaf@root()> feature:repo-add mvn:no.priv.bang.demos/frontend-karaf-demo/LATEST/xml/features
Adding feature url mvn:no.priv.bang.demos/frontend-karaf-demo/LATEST/xml/features
karaf@root()> feature:install frontend-karaf-demo
org.apache.karaf.features.internal.util.MultiException: Error:
@steinarb
steinarb / docker_pull
Created Jun 20, 2021
Pulling a fresh apache/karaf:4.3.2 from dockerhub and running it
View docker_pull
sb@lorenzo:~/workspaces/ws02/sonar-collector/docker$ docker image pull apache/karaf:4.3.2
4.3.2: Pulling from apache/karaf
5d3b2c2d21bb: Already exists
3fc2062ea667: Already exists
75adf526d75b: Already exists
9518218b2233: Already exists
ae866a7f5386: Already exists
3626b117c712: Already exists
7cdd6fc7792a: Already exists
Digest: sha256:b5dd90b954029295e7fea62e56e8b767e02bc2ab274e3d0036fef7f2da29f682
@steinarb
steinarb / Dockerfile
Created Jun 20, 2021
Dockerfile for sonar-collector built on top of karaf 4.3.0 official image
View Dockerfile
FROM apache/karaf:4.3.0
ENV ORG_APACHE_KARAF_FEATURES_FEATURESREPOSITORIES='${featuresRepositories},mvn:no.priv.bang.sonar.sonar-collector/sonar-collector-webhook/LATEST/xml/features'
ENV ORG_APACHE_KARAF_FEATURES_FEATURESBOOT='${featuresBoot},${env:JDBC_DRIVER_FEATURE:-postgresql},sonar-collector-webhook-with-postgresql'
COPY org.ops4j.datasource-sonar-collector.cfg /opt/apache-karaf/etc
@steinarb
steinarb / docker_logs
Created Jun 20, 2021
Output of "docker logs" for sonar-collector image
View docker_logs
sb@lorenzo:~/workspaces/ws03$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d04b260600d8 steinarb/sonar-collector:latest "karaf run" 14 minutes ago Up 14 minutes 0.0.0.0:8101->8101/tcp, 1099/tcp, 44444/tcp, 0.0.0.0:8181->8181/tcp laughing_leavitt
sb@lorenzo:~/workspaces/ws03$ docker logs d04b260600d8
karaf: Ignoring predefined value for KARAF_HOME
Jun 20, 2021 3:40:27 PM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles
Jun 20, 2021 3:40:27 PM org.apache.karaf.main.Main launch
INFO: All initial bundles installed and set to start
Jun 20, 2021 3:40:27 PM org.apache.karaf.main.lock.SimpleFileLock lock
@steinarb
steinarb / build.log
Created Jun 20, 2021
Docker build error when trying to copy .cfg file into karaf etc/
View build.log
sb@lorenzo:~/workspaces/ws02/sonar-collector/docker$ mvn clean install
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] -------------< no.priv.bang.sonar.sonar-collector:docker >--------------
[INFO] Building sonar-collector docker image 1.5.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
@steinarb
steinarb / Dockerfile
Created Jun 20, 2021
Dockerfile for creating sonar-collector docker image on top of karaf 4.3.2
View Dockerfile
FROM apache/karaf:4.3.2
ENV ORG_APACHE_KARAF_FEATURES_FEATURESREPOSITORIES='${featuresRepositories},mvn:no.priv.bang.sonar.sonar-collector/sonar-collector-webhook/LATEST/xml/features'
ENV ORG_APACHE_KARAF_FEATURES_FEATURESBOOT='${featuresBoot},${env:JDBC_DRIVER_FEATURE:-postgresql},sonar-collector-webhook-with-postgresql'
COPY org.ops4j.datasource-sonar-collector.cfg /opt/apache-karaf/etc
@steinarb
steinarb / karaf.log
Created May 20, 2021
Error after suppressing import of org.osgi.service.http.context
View karaf.log
2021-05-20T18:35:51,478 | ERROR | FelixDispatchQueue | Framework | 173 - org.ops4j.pax.web.pax-web-extender-whiteboard - 7.3.16 | FrameworkEvent ERROR
org.ops4j.lang.NullArgumentException: ServletContextHelper is null.
at org.ops4j.lang.NullArgumentException.validateNotNull(NullArgumentException.java:74) ~[?:?]
at org.ops4j.pax.web.extender.whiteboard.internal.element.ServletContextHelperElement.<init>(ServletContextHelperElement.java:42) ~[?:?]
at org.ops4j.pax.web.extender.whiteboard.internal.tracker.ServletContextHelperTracker.addingService(ServletContextHelperTracker.java:168) ~[?:?]
at org.ops4j.pax.web.extender.whiteboard.internal.tracker.ServletContextHelperTracker.addingService(ServletContextHelperTracker.java:49) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943) ~[osgi.core-7.0.0.jar:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871) ~[osgi.core-7.0.0.jar:?]
at org.osgi.util.tracker.
@steinarb
steinarb / pax_exam_test_output
Created May 19, 2021
Output from failing ukelonn pax exam test
View pax_exam_test_output
[INFO] -----------------< no.priv.bang.ukelonn:ukelonn.tests >-----------------
[INFO] Building ukelonn.tests 1.0.0-SNAPSHOT [13/17]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ ukelonn.tests ---
[INFO] Deleting /home/sb/workspaces/ws03/ukelonn/ukelonn.tests/target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-no-duplicate-versions) @ ukelonn.tests ---
[INFO]
[INFO] --- depends-maven-plugin:1.4.0:generate-depends-file (generate-depends-file) @ ukelonn.tests ---
@steinarb
steinarb / pom.xml
Created May 17, 2021
maven-bundle-plugin config from the effective-pom of handlereg.web.frontend
View pom.xml
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.2</version>
<executions>
<execution>
<id>bundle</id>
<goals>
<goal>bundle</goal>
</goals>
View no.priv.bang.handlereg.web.frontend.HandleregServlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="no.priv.bang.handlereg.web.frontend.HandleregServlet" immediate="true">
<property name="osgi.http.whiteboard.context.select" type="String" value="(osgi.http.whiteboard.context.name=handlereg"/>
<property name="osgi.http.whiteboard.servlet.name" type="String" value="handlereg"/>
<property name="osgi.http.whiteboard.servlet.pattern" type="String">/*</property>
<service>
<provide interface="javax.servlet.Servlet"/>
</service>
<reference name="LogService" interface="org.osgi.service.log.LogService" bind="setLogService"/>
<implementation class="no.priv.bang.handlereg.web.frontend.HandleregServlet"/>