Re: Known issues with maven-bundle-plugin 4.1.0 and 4.2.0
> Jean-Baptiste Onofré : > Hi Steinar, > by webapp, you mean a web application bundle I guess, right ? Well, my webapps actually consists of several bundles, that are loaded by a karaf feature, usually: 1. A service bundle, defining the services of the business logic, and an application specific database plugin interface 2. A liquibase database schema bundle 3. A database plugin bundle (I usually have one for derby and one for PostgreSQL ans select either at runtime) 4. A business logic bundle providing the service defined in the service bundle 5. A web.security bundle defining the web context using web whiteboard (this is my first failure in karaf.log), and adding a shiro filter to the web whiteboard and the web context 6. A web.api bundle creating REST services for the services provided by the business logic bundle (item #4 above) and plugging a servlet into the web context defined in item #5 using web whiteboard 7. a web.frontend plugging a servlet into the web context defined in item #5 using web whiteboard So basically 3 bundles plugging into the web whiteboard, together with several support bundles (database and business logic). Examples of webapps following this pattern: https://github.com/steinarb/authservice https://github.com/steinarb/ukelonn https://github.com/steinarb/handlereg The top level, hand written, feature files pulling the complete webapp in: https://github.com/steinarb/authservice/blob/master/src/main/filtered-resources/feature.xml#L16 https://github.com/steinarb/ukelonn/blob/master/karaf/src/main/filtered-resources/feature.xml#L16 https://github.com/steinarb/handlereg/blob/master/src/main/filtered-resources/feature.xml#L16 > I added karaf-servlet-example in Karaf distribution using > maven-bundle-plugin 4.2.0 with Java 11 (Oracle), and it works fine. > Maybe you can share a simple test case similar to your webapp that I can > test locally. Hm, yes, maybe...? Most of my sample projects use the web whiteboard, but don't define a web context (which is what was failing for me according to the karaf.log), but this project defines both a web context and uses apache shiro: https://github.com/steinarb/authservice-sampleclient I'll see how it works out. Thanks!
Re: Adding Jackson to Karaf startup.properties file to enable JSON logging
I've installed mvn:org.ops4j.pax.logging/pax-logging-log4j2-extra/1.10.2 (through console bundle:install) and it do import com.fasterxml.jackson.databind.ser, but I still get the same error from mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.10.2 Decanter looks like an overkill, especially that it covers what we are going to achieve with docker logs aggregator (fluentd). I would prefer to turn console output into json with JsonLayout... -- Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Re: Adding Jackson to Karaf startup.properties file to enable JSON logging
If you have using 4.2.6, don't forget to install pax-logging-log4j2-extra bundle. Let me double check the imports anyway. Regards JB On 01/07/2019 14:11, lechlukasz wrote: > Hello, > > I've just got similar problem after trying to activate JSON logging for > Karaf 4.2.6, with configuration that worked perfectly in 4.1.2: > > log4j2.appender.rolling.layout.type = JsonLayout > log4j2.appender.rolling.layout.compact = true > log4j2.appender.rolling.layout.eventEol = true > > I'm getting error: > > 13:46:16.143 [CM Configuration Updater (Update: pid=org.ops4j.pax.logging)] > ERROR org.apache.felix.configadmin - [org.osgi.service.log.LogService, > org.knopflerfish.service.log.LogService, > org.ops4j.pax.logging.PaxLoggingService, org.osgi.service.cm.ManagedService, > id=10, bundle=7/mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.10.2]: > Unexpected problem updating configuration org.ops4j.pax.logging > java.lang.NoClassDefFoundError: > com/fasterxml/jackson/databind/ser/FilterProvider > > I've started Karaf 4.1.2 and compared imports. The problem is that > org.ops4j.pax.logging.pax-logging-log4j2 in version from older karaf imports > com.fasterxml.jackson.* packages, while the newer version don't. > > How can I exactly add dynamic imports to the bundle packaged with karaf? > > Best regards, > Lukasz Lech > > > > jbonofre wrote >> Hi >> >> You don't have to add logback-core as pax-logging-logback bundle already >> embed it. >> >> Secondly it seems jackson is not imported correctly. The root cause is: >> >> Caused by: java.lang.ClassNotFoundException: >>> com.fasterxml.jackson.databind.ObjectMapper not found by >>> org.ops4j.pax.logging.pax-logging-logback >> >> You can try a dynamic import on pax-logging-logback. > > > > > > -- > Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html > -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com
Re: Adding Jackson to Karaf startup.properties file to enable JSON logging
Hello, I've just got similar problem after trying to activate JSON logging for Karaf 4.2.6, with configuration that worked perfectly in 4.1.2: log4j2.appender.rolling.layout.type = JsonLayout log4j2.appender.rolling.layout.compact = true log4j2.appender.rolling.layout.eventEol = true I'm getting error: 13:46:16.143 [CM Configuration Updater (Update: pid=org.ops4j.pax.logging)] ERROR org.apache.felix.configadmin - [org.osgi.service.log.LogService, org.knopflerfish.service.log.LogService, org.ops4j.pax.logging.PaxLoggingService, org.osgi.service.cm.ManagedService, id=10, bundle=7/mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.10.2]: Unexpected problem updating configuration org.ops4j.pax.logging java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/FilterProvider I've started Karaf 4.1.2 and compared imports. The problem is that org.ops4j.pax.logging.pax-logging-log4j2 in version from older karaf imports com.fasterxml.jackson.* packages, while the newer version don't. How can I exactly add dynamic imports to the bundle packaged with karaf? Best regards, Lukasz Lech jbonofre wrote > Hi > > You don't have to add logback-core as pax-logging-logback bundle already > embed it. > > Secondly it seems jackson is not imported correctly. The root cause is: > > Caused by: java.lang.ClassNotFoundException: >> com.fasterxml.jackson.databind.ObjectMapper not found by >> org.ops4j.pax.logging.pax-logging-logback > > You can try a dynamic import on pax-logging-logback. -- Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html