Re: Programmatically restart bundle and/or component?
Hi Steinar A few years ago I implemented a servlet filter to handle CORS. The filter was a DS component and it accepted a configuration via activate. Everytime the config was changed, it would restart and update the filter. You can also have the DS component implement the filter interface and an auxiliary service interface with a method to force a reload of the config without restarting. I guess it depends on how you supply the configuration to the filter. Regards, João Assunção On Fri, Mar 15, 2024 at 4:38 PM Steinar Bang wrote: > I have this bundle: > https://github.com/steinarb/oldalbum/tree/master/oldalbum.web.security > > which contains two DS/SCR components: > > 1. A component implementing ServletContextHelper used to define the > servlet context > > https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumServletContextHelper.java > > 2. A component implementing a Shiro servlet Filter > > https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumShiroFilter.java#L35 > > I would like to reload the shiro servlet filter programmatically when > its configuration changes. > > What's the best way of doing that? > > Reload the entire bundle? > > Reload just the filter component? > > Make the filter reinitialize itself without reloading? > > Has anyone done anything similar? > > Suggestions? Ideas? All are welcome! > > Thanks! > > > - Steinar > >
Re: Performance Degrade with apache karaf 4.3.10 and Java 17
Hi Chandan, I think the JVM will choose the G1 GC by default if the machine has more than one CPU. Not sure it will be beneficial to use it if the JVM is limited to 1 CPU. Have you tried profiling your application using jprofiler or something similar ? VisualVM can also help. Try comparing the two environments and look for differences in CPU and memory behaviors. If it is a memory issue or you see a lot of GC activity, attempt to fine-tune the JVM memory settings. Regards, João On Tue, Mar 12, 2024 at 7:22 AM Chandan Singh < mailbox.chandansi...@gmail.com> wrote: > Hi All , > > We upgraded from Karaf 4.3.7 (Java 11) to Karaf 4.3.10 ( Java 17 ) . but > we are noticing some degradation in performance during load testing . > These were the setting we have kept in wrapper in Java 11 > > wrapper.java.additional.12=-XX:+UseConcMarkSweepGC > wrapper.java.additional.13=-XX:NewRatio=2 > wrapper.java.additional.14=-Xmx20480M > wrapper.java.additional.15=-Xms5120M > > which now as *UseConcMarkSweepGC has been removed in Java 17 . We > modified it below but we still don't see any improvements . * > > wrapper.java.additional.12=-XX:+UseG1GC > wrapper.java.additional.13=-XX:NewRatio=2 > wrapper.java.additional.14=- Xmx20480M > wrapper.java.additional.15=-Xms5120M > > Any recommendations on the same ? > > > regards > Chandan >
Re: Persist bundle status in karaf
Hello Jose. Have you checked declarative services ? I suspect your use case is probably more easily achievable using a declarative service component. The component can be configured to start/stop (activate/deactivate) based on the presence of a configuration. Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Mon, Jun 12, 2023 at 5:01 PM jose.garnica.lomeli < jose.garnica.lom...@protonmail.com> wrote: > Hello everyone, > > Currently I have some bundles in my karaf solution starting by default as > resolved, in just in specific scenarios when we need active them we execute > the command bundle:start but we want a find a option to persisit > that configuration, to avoid re-start the bundle manually when the karaf > instance is restarted. > > > Maybe we can use a property file in the CFG file to save the status of > bundle(active or resolved) but I am not sure if this the best approach or > karaf provide a way to do it? > > > > Sent with Proton Mail <https://proton.me/> secure email. >
Re: Karaf & OSGi bundle imports best practices
What I do in these cases is to use a wildcard in the import-package statement. For example I have the following in my bnd.bnd in one of the bundles where I use javax.xml. > Import-Package: \ > javax.xml.bind*;version="[2.0,3)", \ > javax.xml.soap;version="[1.4,2)", \ > * > Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, Feb 9, 2023 at 2:58 PM Ephemeris Lappis wrote: > Hello. > > I'm not sure my question is actually related to Karaf, but I'm sure > Karaf users have some answers... > > In a bundle (blueprint) that uses camel-jaxb to process XML files, the > manifest that is generated only sets imports for some jaxb package > detected in the code (javax.xml.bind.annotation). It seems to be > right. > > Import-Package: info.xx.y.com.caterpillar.buddy;version="[0.0, > 1)",info.xx.y.com.facturation.facfou017.esb.enums,info.xx > .y.com.facturation.facfou017.esb.ficWTRV001,info.xx.y.com > .facturation.facturationentitefournisseur.facfou017.esb.dto,java.io,j > ava.lang,java.lang.invoke,java.math,java.time.format,java.time.tempor > al,java.util,javax.jms;version="[2.0,3)",javax.sql,javax.xml.bind.ann > otation;version="[2.3,3)",org.apache.camel;version="[3.20,4)",org.apa > che.camel.spi;version="[3.20,4)",org.apache.camel.spring.spi;version= > "[3.20,4)",org.apache.commons.lang3.builder;version="[3.12,4)",org.os > gi.service.blueprint;version="[1.0.0,2.0.0)",org.springframework.tran > saction > > The maven dependencies for the project are : > > info.xx.y.com.facturation:facfou017-esb:bundle:2.2.0-SNAPSHOT > +- info.xx.y.com > .caterpillar:caterpillar-testing:jar:0.0.1-SNAPSHOT:test > | +- org.liquibase:liquibase-core:jar:3.9.0:test > | | \- javax.xml.bind:jaxb-api:jar:2.3.0:test > +- org.apache.camel:camel-core:jar:3.20.2:provided > | +- org.apache.camel:camel-xml-jaxb:jar:3.20.2:provided > | | \- com.sun.xml.bind:jaxb-impl:jar:2.3.3:provided > +- org.apache.camel:camel-jaxb:jar:3.20.2:provided > | \- com.sun.xml.bind:jaxb-core:jar:2.3.0:provided > > So unit tests pass with no issue since the JAXP API is provided by the > liquibase that is used for testing. > > But at runtime, the class javax.xml.bind.JAXBException that is caught > in a Camel route is not found. It seems to be logical, since the > package javax.xml.bind is not imported. > > I added a dynamic import on this package, and now it works. > > So, what is the best way to get all the needed imports ? Is the > dynamic import the only way to add missing packages ? How can we > detect early missing imports that maven-bundle-plugin doesn't take > into account ? > > Thanks for your help. > > Regards. >
Re: How can one use a third party feature as a startup feature.
Hello JB After your reply I rechecked my pom and found the reason the feature was not being picked up as a startupFeature. I still had an entry for "pax-jdbc-postgresql" in my bootFeatures. As soon as I removed it, the postgresql driver and org.osgi.service.jdbc bundles were added to startup.properties. For this to work I previously changed the scope of org.apache.karaf.features/enterprise from runtime to compile. Thank you Regards João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Tue, Nov 22, 2022 at 8:58 PM Jean-Baptiste Onofré wrote: > Hi > > how did you define the feature ? via dependency (with which scope) or > via maven config ? > > Regards > JB > > On Tue, Nov 22, 2022 at 6:16 PM João Assunção > wrote: > > > > Hello all, > > > > I created a custom persistence manager for ConfigAdmin that stores > config properties in a SQL database. > > I'm using a custom karaf distro and apparently for my bunde to work it > needs to be listed as a startup bundle, at least when starting karaf for > the first time. > > Because my bundle requires JDBC, I need to include the JDBC driver and > "org.osgi.service.jdbc". > > ... > > > > > mvn:org.osgi/org.osgi.service.jdbc/1.0.0 > > mvn:org.postgresql/postgresql/42.2.8 > > > > mvn:com.joaoassuncao.osgi-utils/configadmin-sql-persistence/1.0.2-SNAPSHOT > > > > .. > > > > I wanted to avoid the direct use of bundles and use startupFeatures > instead. Unfortunately, I only managed to make it work when the startup > feature is only of those "core" ones, for example, the eventadmin one. > > If I specify pax-jdbc-postgresql as a startup feature its bundles are > not included. I tried to include pax-jdbc-features as a startup repository > but this didn't do it. > > > > Any ideas ? > > > > Thank you in advance. > > Best regards, > > > > João Assunção > > > > >
How can one use a third party feature as a startup feature.
Hello all, I created a custom persistence manager for ConfigAdmin that stores config properties in a SQL database. I'm using a custom karaf distro and apparently for my bunde to work it needs to be listed as a startup bundle, at least when starting karaf for the first time. Because my bundle requires JDBC, I need to include the JDBC driver and "org.osgi.service.jdbc". ... mvn:org.osgi/org.osgi.service.jdbc/1.0.0 mvn:org.postgresql/postgresql/42.2.8 mvn:com.joaoassuncao.osgi-utils/configadmin-sql-persistence/1.0.2-SNAPSHOT .. I wanted to avoid the direct use of bundles and use startupFeatures instead. Unfortunately, I only managed to make it work when the startup feature is only of those "core" ones, for example, the eventadmin one. If I specify pax-jdbc-postgresql as a startup feature its bundles are not included. I tried to include pax-jdbc-features as a startup repository but this didn't do it. Any ideas ? Thank you in advance. Best regards, João Assunção
Re: aries-jax-rs-whiteboard
ll integrity > // protect the claims > jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256); > > try { > return jws.getCompactSerialization(); > } > catch (JoseException ex) { > throw new AuthenticationException("Token creation failed", ex); > } > } > > public SubjectDetails validateToken(String token) throws > AuthenticationException { > > try { > JwtClaims jwtClaims = jwtConsumer.processToClaims(token); > String subjectName = jwtClaims.getStringClaimValue(CLAIM_NAME); > List permissions = > jwtClaims.getStringListClaimValue(CLAIM_PERMISSIONS); > Set permissionsSet = > Permission.fromList(permissions); > permissionsSet.add(Permission.AUTHENTICATED); // Implicit > permission > return new SubjectDetails(jwtClaims.getSubject(), subjectName, > permissionsSet); > } > catch (InvalidJwtException ex) { > logException("InvalidJwtException", ex); > throw new AuthenticationException(ex.getMessage()); > > } > catch (MalformedClaimException ex) { > logException("MalformedClaimException", ex); > throw new AuthenticationException(ex.getMessage()); > } > > } > > protected static void logException(String msg, Exception ex) { > > LOGGER.debug(msg, ex); > } > } > João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Mon, Jun 27, 2022 at 9:33 AM Matthias Leinweber < m.leinwe...@datatactics.de> wrote: > Hello, > > I am using karaf 4.3.7 and yes I saw the examples in karaf. The version > used is 1.0.6 which is pretty old. I tried to update to 1.0.10 but i dont > see what is going wrong. There is the Application, Servlet, and Whiteboard. > But the servlet is not accessible. > With version 2.0.1 is cxf-core required. That would also be fine. > Unfortunately it does not work without a url prefix which would require a > change on the client side. > > @ João thank you very much for your help. Do you also have a repo link to > a working example; where does the JWTService come from? > > Thank > br, > Matthias > > Am Do., 23. Juni 2022 um 11:02 Uhr schrieb João Assunção < > joao.assun...@exploitsys.com>: > >> Hello Matthias, >> >> Regarding authentication I normally use a ContainerRequestFilter. >> Follows an example of a filter where authentication is done using a JWT >> token. >> It uses JwtService that is responsible for creating and validating >> tokens. It uses jose4j. >> >> >> @Secured >>> @Provider >>> @Priority(Priorities.AUTHENTICATION) >>> @Component(scope = ServiceScope.PROTOTYPE, // >>> service = { ContainerRequestFilter.class }, // >>> property = { >>> JaxrsWhiteboardConstants.JAX_RS_EXTENSION + "=" + true, >>> // >>> JaxrsWhiteboardConstants.JAX_RS_NAME + "=" + >>> "TokenAuthenticationFilter", // >>> Constants.JAX_RS_APPLICATION_SELECT, // >>> }) >>> public class TokenAuthenticationFilter implements ContainerRequestFilter >>> { >>> >>> private static final Logger LOGGER = >>> LoggerFactory.getLogger(TokenAuthenticationFilter.class); >>> >>> private static final String AUTHENTICATION_SCHEME = "Bearer"; >>> >>> private static final String AUTHENTICATION_SCHEME_PREFIX = >>> AUTHENTICATION_SCHEME + " "; >>> >>> @Reference(cardinality = ReferenceCardinality.MANDATORY) >>> JwtService jwtService; >>> >>> @Context >>> private ResourceInfo resourceInfo; >>> >>> @Override >>> public void filter(ContainerRequestContext requestContext) throws >>> IOException { >>> >>> // Get the Authorization header from the request >>> String authorizationHeader = >>> requestContext.getHeaderString(HttpHeaders.AUTHORIZATION); >>> LOGGER.debug("authorizationHeader {}", authorizationHeader); >>> // Validate the Authorization header >>> if (!isTokenBasedAuthentication(authorizationHeader)) { >>> LOGGER.info("Missing auth token. Aborting"); >>> abortWithUnauthorized(requestContext); >>>
Re: aries-jax-rs-whiteboard
ic Permission getPermissionForResource(ResourceInfo resourceInfo) { > > Permission permission = > extractPermission(resourceInfo.getResourceMethod()); > if (permission != null) { > return permission; > } > permission = extractPermission(resourceInfo.getResourceClass()); > return permission; > > } > > // Extract Permission from the annotated element > static Permission extractPermission(AnnotatedElement annotatedElement) > { > > if (annotatedElement == null) { > return null; > } > Secured secured = annotatedElement.getAnnotation(Secured.class); > return secured == null ? null : secured.value(); > } > > private static class InternalSecurityContext implements > SecurityContext { > > private final boolean secure; > > private final SubjectDetails subjectDetails; > > InternalSecurityContext(SubjectDetails subjectDetails, boolean > secure) { > > this.subjectDetails = subjectDetails; > this.secure = secure; > } > > @Override > public Principal getUserPrincipal() { > > return subjectDetails; > } > > @Override > public boolean isUserInRole(String role) { > > // We are not using role base authorization > return true; > } > > @Override > public boolean isSecure() { > > return secure; > } > > @Override > public String getAuthenticationScheme() { > > return AUTHENTICATION_SCHEME; > } > > } > > /** > * For test purposes > * > * @param jwtService > * @return > */ > public static TokenAuthenticationFilter createTestInstance(JwtService > jwtService) { > > TokenAuthenticationFilter filter = new TokenAuthenticationFilter(); > filter.jwtService = jwtService; > return filter; > } > } > The Secured annotation is used to mark the methods that need to be protected and the required permission. @NameBinding > @Retention(RetentionPolicy.RUNTIME) > @Target({ ElementType.TYPE, ElementType.METHOD }) > public @interface Secured { > > Permission value() default Permission.AUTHENTICATED; > } > João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Wed, Jun 22, 2022 at 8:54 PM Matthias Leinweber < m.leinwe...@datatactics.de> wrote: > Hello Karaf user, > > i try to get aries-jax-rs-whiteboard in a version > 1.0.6 running without > success. 2.0.1 with installed cxf is working fine. But in 1.0.7-1.0.10. > http:list does not show a servlet and my jaxrs whiteboard resources are not > working. > > Any hints which component needs to be installed? Reading BNDrun + > Components DSL is pretty confusing. > > Btw, does anyone have a good example for authentication? Shiro seems to be > a bit overkill. > > br, > Matthias >
Re: How do I load configuration within a shell command?
Why not have the components implement the required operations as a service, or expose those values in some service operation, and then make the shell command use that service ? João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Fri, May 13, 2022 at 2:27 PM Paul Spencer wrote: > JB, > The command needs to use values stored in pid.cfg files, like instance > specific CustomerName, just like other components. > > Paul Spencer > > > On May 13, 2022, at 1:46 AM, Jean-Baptiste Onofré > wrote: > > > > Hi Paul, > > > > Not sure I understand exactly the request, but you can do: > > > > config:edit pid > > config:property-list ... > > config:cancel | config:commit > > > > Regards > > JB > > > > On Thu, May 12, 2022 at 6:38 PM Paul Spencer > wrote: > >> > >> Karaf 4.3.6 > >> I am looking to load configuration into a shell command, but I do not > see where to set the configuration PID nor do I see where the configuration > is passed or injected into the Action class. > >> > >> > >> In a component, the configuration loaded by @Activate is defined by > @Component and the configurationPid attribute. What are the equivalents for > shell commands, class that implement > org.apache.karaf.shell.api.action.Action? > >> > >> Paul Spencer > >
Re: Updated mitigation for Log4JShell in Karaf 4.2.x and 4.3.x since setting log4j2.formatMsgNoLookups is a insufficient mitigation measure
I think the correct versions of pax logging would be 1.11.13. And the "patching" can be made with two updates: bundle:update org.ops4j.pax.logging.pax-logging-api bundle:update org.ops4j.pax.logging.pax-logging-log4j2 Regards, João Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Tue, Jan 4, 2022 at 10:49 AM Paul McCulloch wrote: > You can uninstall the affected pax logging bundles & install versions > where the issue is resolved: > > bundle:uninstall org.ops4j.pax.logging.pax-logging-log4j2 > bundle:uninstall org.ops4j.pax.logging.pax-logging-api > bundle:install -l 8 -s mvn:org.ops4j.pax.logging/pax-logging-api/1.11.11 > bundle:install -l 8 -s mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.11.11 > > However the affected version may get reinstalled (though won't be wired as > far as I can tell) when other features are installed.To avoid this, and to > ensure that a 'clean' doesn't undo the upgrade I found the following to > work (in addition to upgrading the affected bundles). > > * replace the affected JARs in the /system repo with empty JARs (so that > they won't be downloaded from a central maven repo) > * add the new logging JARs to the /system repo > * Modify etc/startup.properties to use the new versions of pax logging > (only affects 'clean') > * Create etc/blacklisted.properties with content > > pax-logging-api;type=bundle;url=mvn:org.ops4j.pax.logging/pax-logging-api/1.9.1 > > pax-logging-log4j2;type=bundle;url=mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.9.1 > To prevent any attempt to load the old bundles by features which > explicitly request them > > Paul > > > On Thu, 23 Dec 2021 at 18:40, JB Onofré wrote: > >> It makes sense. As it’s for a short period. >> >> Regards >> JB >> >> > Le 23 déc. 2021 à 19:19, Paul Spencer a >> écrit : >> > >> > JB, >> > Karaf upgrades will be done, just not during the holiday breaks when >> compliance resources are scarce. Mitigating the issue by setting >> log4j2.formatMsgNoLookups and removing the JndiLoookup.class will allow the >> current environment to run while upgrades are be run through each >> customer's compliance and deployment processes. >> > >> > Thank you and the Karaf team for rapidly releasing updated versions of >> Karaf to address the CVE. The updated Karaf will be will incorporated into >> our products and pushed through the release and deployment process as >> quickly as possible. >> > >> > Paul Spencer >> > >> >> On Dec 23, 2021, at 12:42 PM, Jean-Baptiste Onofre >> wrote: >> >> >> >> It would mitigate only the JNDI part, not the other CVE (about the >> lookup). >> >> >> >> Anyway, it’s a good workaround. >> >> >> >> I don’t understand why you don’t want to upgrade to a new version. >> It’s exactly the purpose of the new releases to address CVE. >> >> Else, why we would do new releases if you are stuck with old versions. >> Log4j did couple of new releases to address the CVE issue, so it’s worth to >> update. >> >> >> >> Regards >> >> JB >> >> >> Le 23 déc. 2021 à 18:37, Paul Spencer >> a écrit : >> >>> >> >>> JB, >> >>> Aymen Furter suggested the following: >> >>> >> >>> $ cd karaf-directory >> >>> $ zip -q -d $(find . | grep pax-logging-log4j2 | grep jar) >> org/apache/logging/log4j/core/lookup/JndiLookup.class >> >>> $ zip -q -d $(grep -rlnw . -e "pax-logging-log4j2" | grep >> "data/cache/bundle" | grep jar) >> org/apache/logging/log4j/core/lookup/JndiLookup.class >> >>> >> >>> >> >>> This looks like a reasonable short term workaround that is relatively >> easy to implement. Relative to the Karaf and its services, do you see any >> potential problems with the workaround? >> >>> >> >>> >> >>> Paul Spencer >> >>> >> On Dec 23, 2021, at 12:17 PM, JB Onofré wrote: >> >> Then create your own custom distro upgrading pax logging. >> >> > Le 23 déc. 2021 à 17:23, Paul Spencer >> a écrit : >> > >> > JB, >> > As stated earlier, upgrading Karaf is not an option in the short >> term. >> > >> > Paul Spencer >> > >> > >> >> On Dec 23, 2021, at 11:21 AM, JB Onofré wrote: >> >> >> >> Upgrade to Karaf 4.2.13. >> >> >> Le 23 déc. 2021 à 17:02, Paul Spencer < >> paulspen...@mindspring.com> a écrit : >> >>> >> >>> In light of the updated mitigation for the Log4JShell published >> by Log4J[1], specifically "zip -q -d log4j-core-*.jar >> org/apache/logging/log4j/core/lookup/JndiLookup.class", the insufficient >> mitigation measure of setting system property log4j2.formatMsgNoLookups, >> and the presents of JndiLookup.class in the pax-logging-log4j2 jar. What is >> the suggested mitigation for Karaf 4.2.x and Karaf 4.3.x when upgrading >> Karaf is not an option in the short term? >> >>> >> >>> *** >> >>> * Example from Karaf 4.2.9 >> >>> >> >>> [user@localhost karaf]$ zip -sf >>
Re:
Hello Serge, An alternative to bundle scanning is to have an auxiliary service to provide information of what services are expected to be available. I see two approaches. * One auxiliary service per addon service with the responsibility of informing the platform of.the expected presence of the addon service. The platform would consume these auxiliary services to get some metadata that it could use to validate the presence of the addon service. * Have an auxiliary service per product variant where the mandatory requirements would be defined and have the platform depend on this auxiliary service. For example the platform would depend on a ProductSpec service. For Product A you could have an implementation of ProductSpec that would have AddonX and AddonY as mandatory. For Product B the implementation of ProductSpec would require AddonX and AddonZ. Depending on the product you would provide the appropriate ProductSpec, either via a separate bundle or via configuration admin. With this the platform would only activate if a ProductSpec requirements are fulfilled. You can also check OSGi Requirements and Capabilities to see if the framework provides anything that suits your needs. Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, Nov 4, 2021 at 9:13 AM Serge Démoulin wrote: > Hi > > We are developing a platform based on bundles > Our products are based on this platform. > product = platform bundles + product specific bundles > > A product can change the behaviour of the platform by implementing > singleton OSGi services > > > We would like make these service optional but it's not easy > Therefore if the platform doesn't find such a service there too > possibilities > - the product doesn't implement this service. The platform behaviour stay > unchanged, alright > - the product intends to implement the service in a bundle but the bundle > that implement this service is broken. In this case the product has not the > right behaviour > > The complex solution that we implement is > Such service is seen as mandatory by the platform and the platform has a > default implementation of the service in a bundle . > The build of the product removes this bundle and bring its own bundle > > This build is error-prone and expensive to realize. > > Do have an idea how we should have optional service but detect if the > product intends to implement the service (without integration tests in the > product that test the correct behaviour) ? > > An idea for instance > If the service are declare with @Component > Scan every MANIFEST.MF to find pretty exactly which services are intended > to be implemented > > Best regards > > Serge >
Re: How to use configuration placeholders in karaf configs
I guess I found the culprit. FeatureConfigInstaller uses TypedProperties to load the properties from the feature config element. Apparently TypedProperties performs variable interpolation and replaces my placeholders. I still don't understand why sometimes they are replaced and other times they don't João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, May 20, 2021 at 4:47 PM João Assunção wrote: > Hello JB > > Yes I'm using Karaf 4.3.0 > > I tried with override="true", specifying the placeholder value in > custom.properties, and with -D. The behavior is the same. > For the same feature, some cfg files keep the placeholder while others > have the placeholder replaced by an empty string. > Another weird behavior is that this doesn't occur in my machine but > occurs in two other machines. All them are Linux machines running openjdk > but mine is a bit slower. > > I will try to use the element instead of > > > > João Assunção > > Email: joao.assun...@exploitsys.com > Mobile: +351 916968984 > Phone: +351 211933149 > Web: www.exploitsys.com > > > > > On Thu, May 20, 2021 at 3:54 PM Jean-Baptiste Onofre > wrote: > >> Hi, >> >> If you want to always take config content from the features, you can user >> overwrite="true" flag. >> >> You can override with -D (see http://blog.nanthrax.net/?p=1038). >> >> I guess you are using Karaf 4.3.x right ? >> >> Regards >> JB >> >> Le 20 mai 2021 à 16:33, João Assunção a >> écrit : >> >> Hello all, >> >> I'm trying to use placeholders in configurations but I noticed some weird >> behavior. Sometimes the placeholder is replaced by an empty string, in >> other situations by the value of the property and in others not replaced at >> all. >> >> One of my features contains the following configurations: >> ... >> > name="com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider" >> append="false"> >> storageDirectory=${tzc.data}/photos >> >> > name="pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider" >> append="false"> >> rrdDefFile = etc/tzc_metrics.xml >> rrdRepository = ${tzc.data}/rrd >> reportingInterval = 60 >> >> .. >> >> When the feature is installed, with tzc.data set to "myData", sometimes i >> get the following cfg files: >> *== com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider.cfg ==* >> storageDirectory=${tzc.data}/photos >> org.apache.karaf.features.configKey = >> com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider >> >> *== >> pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider.cfg ==* >> rrdDefFile = etc/tzc_metrics.xml >> rrdRepository = myData/rrd >> reportingInterval = 60 >> org.apache.karaf.features.configKey = >> pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider >> >> I tried specifying the variable name in config.properties and using the >> -D flag >> >> Ideally I would like the placeholder to be replaced by the actual value >> only when the configuration is passed to the service. >> >> What am I doing wrong ? >> >> Thank you in advance. >> >> Best regards, >> João Assunção >> >> Email: joao.assun...@exploitsys.com >> Mobile: +351 916968984 >> Phone: +351 211933149 >> Web: www.exploitsys.com >> >> >> >>
Re: How to use configuration placeholders in karaf configs
Hello JB Yes I'm using Karaf 4.3.0 I tried with override="true", specifying the placeholder value in custom.properties, and with -D. The behavior is the same. For the same feature, some cfg files keep the placeholder while others have the placeholder replaced by an empty string. Another weird behavior is that this doesn't occur in my machine but occurs in two other machines. All them are Linux machines running openjdk but mine is a bit slower. I will try to use the element instead of João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, May 20, 2021 at 3:54 PM Jean-Baptiste Onofre wrote: > Hi, > > If you want to always take config content from the features, you can user > overwrite="true" flag. > > You can override with -D (see http://blog.nanthrax.net/?p=1038). > > I guess you are using Karaf 4.3.x right ? > > Regards > JB > > Le 20 mai 2021 à 16:33, João Assunção a > écrit : > > Hello all, > > I'm trying to use placeholders in configurations but I noticed some weird > behavior. Sometimes the placeholder is replaced by an empty string, in > other situations by the value of the property and in others not replaced at > all. > > One of my features contains the following configurations: > ... > name="com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider" > append="false"> > storageDirectory=${tzc.data}/photos > > name="pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider" > append="false"> > rrdDefFile = etc/tzc_metrics.xml > rrdRepository = ${tzc.data}/rrd > reportingInterval = 60 > > .. > > When the feature is installed, with tzc.data set to "myData", sometimes i > get the following cfg files: > *== com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider.cfg ==* > storageDirectory=${tzc.data}/photos > org.apache.karaf.features.configKey = > com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider > > *== > pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider.cfg ==* > rrdDefFile = etc/tzc_metrics.xml > rrdRepository = myData/rrd > reportingInterval = 60 > org.apache.karaf.features.configKey = > pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider > > I tried specifying the variable name in config.properties and using the > -D flag > > Ideally I would like the placeholder to be replaced by the actual value > only when the configuration is passed to the service. > > What am I doing wrong ? > > Thank you in advance. > > Best regards, > João Assunção > > Email: joao.assun...@exploitsys.com > Mobile: +351 916968984 > Phone: +351 211933149 > Web: www.exploitsys.com > > > >
How to use configuration placeholders in karaf configs
Hello all, I'm trying to use placeholders in configurations but I noticed some weird behavior. Sometimes the placeholder is replaced by an empty string, in other situations by the value of the property and in others not replaced at all. One of my features contains the following configurations: ... storageDirectory=${tzc.data}/photos rrdDefFile = etc/tzc_metrics.xml rrdRepository = ${tzc.data}/rrd reportingInterval = 60 .. When the feature is installed, with tzc.data set to "myData", sometimes i get the following cfg files: *== com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider.cfg ==* storageDirectory=${tzc.data}/photos org.apache.karaf.features.configKey = com.atobe.ort.photo.repository.PhotoRepositoryServiceProvider *== pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider.cfg ==* rrdDefFile = etc/tzc_metrics.xml rrdRepository = myData/rrd reportingInterval = 60 org.apache.karaf.features.configKey = pt.brisa.service.metrics.rrd.internal.RRDPersistenceServiceProvider I tried specifying the variable name in config.properties and using the -D flag Ideally I would like the placeholder to be replaced by the actual value only when the configuration is passed to the service. What am I doing wrong ? Thank you in advance. Best regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Re: Karaf 4.2.10 - NullPointerException during xml parsing
Hi Brock, I tried your jar but it failed due to the layout of the jar (the MANIFEST was not the first entry in the jar or something like that). I created a bundle with our code and when I tried with karaf 4.3 it passed. I then tried with 4.2.7 and I experienced the same NPE. Apparently the behavior when the errorHandler is set to null is different between implementations of the XML libs supplied in these two versions of karaf. In your code setting the error handler to builder.setErrorHandler(new org.xml.sax.helpers.DefaultHandler()); seems to do the trick. I noticed your manifest is importing a bunch of packages not required for the code in question. Regards João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Tue, Mar 2, 2021 at 3:33 AM brock samson wrote: > hi, JB. did you get a chance to run my bundle? > > -- > *From:* brock samson > *Sent:* Wednesday, February 24, 2021, 11:18 PM > *To:* user@karaf.apache.org > *Subject:* Re: Karaf 4.2.10 - NullPointerException during xml parsing > > hi, JB. > > thank you for looking at this. The attached zip (rename its extension from > .txt to .zip) contains both the bundle (rename its extension from .txt to > .jar) and its feature file. the bundle should be placed in the */bundles* dir, > and you know what to do with the feature file =) > here are some points regarding the bundle: > 1) the bundle executes automatically during Karaf startup to make it > easier for you. > 2) The bundle contains both the schema and the xml, so you dont have to > really do anything to the bundle itself in order for it to just run > 3) The bundle contains *props.properties* where you can specify external > locations to both schema and xml file if you choose to do so for any > reason. The provided files will be ignored in such case. > 4) I have also provided the source .java alongside the binary just in case. > > again, really appreciate you taking the time to look at it. thanks!!! > > Brock Samson > > -- > *From:* Jean-Baptiste Onofre > *Sent:* Tuesday, February 23, 2021 11:56 AM > *To:* user@karaf.apache.org > *Subject:* Re: Karaf 4.2.10 - NullPointerException during xml parsing > > Hi Brock, > > Maybe you have xerces installed as bundle in your distribution ? > > It sounds like a version mismatch. > > Can you share the bundles installed ? > > Thanks, > Regards > JB > > Le 23 févr. 2021 à 16:55, brock samson a > écrit : > > Hello, > > I am using Karaf 4.2.10 and attempting to perform a rather simple xml > parsing: > > *Caused by: java.lang.NullPointerException * > *at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown > Source) ~[!/:?] * > *at > com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137) > ~[?:1.8.0_102] * > *at > com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) > ~[?:1.8.0_102] * > *at > com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) > ~[?:1.8.0_102] * > *at > com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) > ~[?:1.8.0_102] * > *at > com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900) > ~[?:1.8.0_102] * > *at > com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740) > ~[?:1.8.0_102] * > *at > com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570) > ~[?:1.8.0_102] * > *at > org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.startElement(Unknown > Source) ~[!/:?] * > *at > org.apache.xerces.jaxp.JAXPValidatorComponent.startElement(Unknown Source) > ~[!/:?] * > *at > org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown > Source) ~[!/:?] * > *at > org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown > Source) ~[!/:?] * > *at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown > Source) ~[!/:?] * > *at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown > Source) ~[!/:?] * > *at > org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[!/:?] * > *at > org.apache.xerces.parsers.XML11Configuration.par
Re: [Karaf] How to prevent configurations created via web console to be persisted as JSON
Hi JB, No need to apologize! I'm quite grateful for your dedication. I created KARAF-6924 <https://issues.apache.org/jira/browse/KARAF-6924>. If I have time during the weekend I will try to fix it. Best regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, Nov 26, 2020 at 11:36 AM Jean-Baptiste Onofre wrote: > Hi, > > My bad. I will fix that. > > In the meantime, as workaround, you can disable this in > etc/startup.properties by removing cm.json and configurator bundles. > > Do you mind to create a Jira ? I will fix that for 4.3.1. > > Sorry again. > > Regards > JB > > Le 26 nov. 2020 à 11:15, João Assunção a > écrit : > > Hello all, > > With the introduction in Karaf 4.3.0 of configuration files in JSON, now > when I create a new configuration using the web console, a json file is > created instead of a cfg file. > I assume the reason is the use of typed properties in the web console > config admin plugin, but in this case the configuration only uses primitive > types. Is it possible to prevent this behavior ? > Thank you. > > Best regards > João Assunção > > Email: joao.assun...@exploitsys.com > Mobile: +351 916968984 > Phone: +351 211933149 > Web: www.exploitsys.com > > > >
[Karaf] How to prevent configurations created via web console to be persisted as JSON
Hello all, With the introduction in Karaf 4.3.0 of configuration files in JSON, now when I create a new configuration using the web console, a json file is created instead of a cfg file. I assume the reason is the use of typed properties in the web console config admin plugin, but in this case the configuration only uses primitive types. Is it possible to prevent this behavior ? Thank you. Best regards João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Re: Enabling multipart support on Aries JAX-RS 1.0.10
Hello Alex, I used Multipart with Aries JAX-RS and I'm almost sure I didn't need to mess with the configuration. I annotated the class with @MultipartConfig and placed a @Consumes(MediaType.MULIPART_FOR_DATA). @Path("/firmware") @Component(service = FirmwareService.class, // immediate = true, // scope = ServiceScope.SINGLETON, property = { JaxrsWhiteboardConstants.JAX_RS_RESOURCE + "=true", JaxrsWhiteboardConstants.JAX_RS_APPLICATION_SELECT + "=(" + JaxrsWhiteboardConstants.JAX_RS_NAME + "=myApp)" }) @MultipartConfig public class FirmwareService { @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFirmware(@Context HttpServletRequest request) { try { doUploadFirmware(request); Hope this helps João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, Nov 12, 2020 at 5:25 PM Alex Soto wrote: > With Karaf 4.3.0, using Aries JAX-RS 1.0.10, how can I enable multi part > support? > > I am adding configuration file > “org.apache.aries.jax.rs.whiteboard.default.cfg” to the “etc” directory > with property: > > osgi.http.whiteboard.servlet.multipart.enabled=true > > But I am still getting error: > > java.lang.IllegalStateException: No multipart config for servlet > > When getting parts from HttpServletRequest. > Any help will be appreciated. > > Best regards, > Alex soto > > > > >
Re: "scr --help" returns nothing even though scr command exist.
You have two types of commands in Karaf shell: Karaf commands and gogo commands. Karaf commands provide more bells and whistles than gogo commands, --help being one of them. I think scr: are gogo commands. Best regards, João Assunção On Fri, 17 Jul 2020, 16:38 Paul Spencer, wrote: > Karaf 4.2.0 and 4.3.0-SNAPSHOT > > There are several commands with the scope of "scr" but they are not > displayed by "scr --help". The commands are displayed by command completer > >karaf@root()> scr --help >karaf@root()> > >karaf@root()> scr: (Tab pressed to invoke the command completer) >scr:configscr:disable scr:enablescr:info scr:list > > Help on a scr command like scr:info produces the following error > > karaf@root()> scr:info --help > Error executing command: No component description matching "--help". > karaf@root()> > > *** > * From karaf.log > *** > 11:33:03.610 ERROR [Karaf ssh console user karaf] Exception caught while > executing command > java.lang.IllegalArgumentException: No component description matching > "--help". > at > org.apache.felix.scr.impl.ComponentCommands.info(ComponentCommands.java:179) > ~[?:?] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > ~[?:1.8.0_172] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > ~[?:1.8.0_172] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[?:1.8.0_172] > at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_172] > at > org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?] > at > org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) > ~[?:?] > at > org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) > ~[?:?] > at > org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) > ~[?:?] > at > org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) > ~[?:?] > at > org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?] > at > org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) > ~[?:?] > at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) > ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?] > at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?] > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > ~[?:1.8.0_172] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > ~[?:1.8.0_172] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > ~[?:1.8.0_172] > at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172] > > > Is this a bug? > > Should I create a Jira? > > Paul Spencer > > >
Re: Question about @Reference Karaf Command annotation
Paul, you are right. I think there is a bug in the implementation of SingleServiceTracker used to bind service references in commands. The filter is used for the listener but is ignored when retrieving the serviceReference. For example: If the command starts and the services are available, it will use the first service matching the class and ignore the filter. If the command starts and no service is available, the listener will be called when one service matches the filter. When one matches, SingleServiceTracker.findMatchingReference will be called and the filter is ignored. João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Thu, Jul 16, 2020 at 1:42 AM Paul Spencer wrote: > Martin, > Parenthesis in the @Reference, > org.apache.karaf.shell.api.action.lifecycle.Reference, for the Command did > not change the results, this the wrong service was returned. Parenthesis > are required for the > @Reference,org.osgi.service.component.annotations.Reference, in the > @Component. > > Details below. > > *** > * From command that uses the RedColor service > * Parenthesis did not return the correct ColorService. > *** > import org.apache.karaf.shell.api.action.Action; > import org.apache.karaf.shell.api.action.Command; > import org.apache.karaf.shell.api.action.lifecycle.Reference; > import org.apache.karaf.shell.api.action.lifecycle.Service; > > import com.example.service.ColorService; > > @Service > @Command(scope = "color", name = "get-red", description = "Get Red > Service") > public class DisplayRedServiceCommand implements Action { > > @Reference(filter = "(color=red)") > private ColorService colorService; > > *** > * Output from Command that get a RedColor service > *** > karaf@root()> color:get-red > Color = BLUE > > *** > * Component the defines the RedColor service > *** > import org.osgi.service.component.annotations.Activate; > import org.osgi.service.component.annotations.Component; > import org.osgi.service.component.annotations.Deactivate; > import org.osgi.service.component.annotations.Modified; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > import com.example.service.ColorService; > > @Component(immediate = true, property = "color=red") > public class RedColorService implements ColorService { > private final Logger log = LoggerFactory.getLogger(getClass()); > > *** > * Component that uses the RedColor Service > *** > import org.osgi.service.component.annotations.Activate; > import org.osgi.service.component.annotations.Component; > import org.osgi.service.component.annotations.Deactivate; > import org.osgi.service.component.annotations.Modified; > import org.osgi.service.component.annotations.Reference; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > import com.example.service.ColorService; > import com.example.service.GenericColorService; > > @Component(immediate = true, property = "color=all") > public class AllColorService implements GenericColorService { > private final Logger log = LoggerFactory.getLogger(getClass()); > > @Reference(target = "(color=red)") > private ColorService redColorService; > > @Reference(target = "(color=green)") > private ColorService greenColorService; > @Reference(target = "(color=blue)") > private ColorService blueColorService; > > @Override > public String getColor() { > StringBuffer colors = new StringBuffer(); > colors.append(redColorService.getColor()); > colors.append(", "); > colors.append(greenColorService.getColor()); > colors.append(", "); > colors.append(blueColorService.getColor()); > return colors.toString(); > } > > *** > * Command that get a two color service > *** > import org.apache.karaf.shell.api.action.Action; > import org.apache.karaf.shell.api.action.Command; > import org.apache.karaf.shell.api.action.lifecycle.Reference; > import org.apache.karaf.shell.api.action.lifecycle.Service; > > import com.example.secondService.TwoColorService; > > @Service > @Command(scope = "yellow", name = "yellow", description = "Get Yellow > Service") > public class DisplayYellowServiceCommand implements Action { > > @Reference > private TwoColorService colorService; > > @Override > public Object execute() throws Exception { >
Re: Question about @Reference Karaf Command annotation
Hello all, Have you tried to use an LDAP filter expression? Instead of *color=red* try *(color=red). *(I haven't tried this myself) João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Mon, Jul 13, 2020 at 6:33 PM Paul Spencerx wrote: > JB, > What is the status of your checking? > > @Reference for commands is not working for me either. I have included > related code and output from Karaf below. > > *** > * Testing commands > *** > karaf@root()> color --help > SUBSHELL > color > > COMMANDS > color:get-any Get any Service > color:get-blue Get Blue Service > color:get-green Get Green Service > color:get-red Get Red Service > karaf@root()> color:get-red > Color = BLUE > karaf@root()> color:get-red > > > Color = BLUE > karaf@root()> color:get-red > > > Color = BLUE > karaf@root()> color:get-any > Color = BLUE > karaf@root()> color:get-green > Color = BLUE > karaf@root()> > > *** > * Available Color Services > *** > karaf@root()> services -p 165 > > Karaf Service sandbox (165) provides: > - > color = blue > component.id = 9 > component.name = com.example.service.internal.BlueColorService > objectClass = [com.example.service.ColorService] > service.bundleid = 165 > service.id = 193 > service.scope = bundle > > color = green > component.id = 10 > component.name = com.example.service.internal.GreenColorService > objectClass = [com.example.service.ColorService] > service.bundleid = 165 > service.id = 194 > service.scope = bundle > > color = red > component.id = 11 > component.name = com.example.service.internal.RedColorService > objectClass = [com.example.service.ColorService] > service.bundleid = 165 > service.id = 195 > service.scope = bundle > karaf@root()> > > *** > * Example command source code > *** > package com.example.command.internal; > > import org.apache.karaf.shell.api.action.Action; > import org.apache.karaf.shell.api.action.Command; > import org.apache.karaf.shell.api.action.lifecycle.Reference; > import org.apache.karaf.shell.api.action.lifecycle.Service; > > import com.example.service.ColorService; > > @Service > @Command(scope = "color", name = "get-red", description = "Get Red > Service") > public class DisplayRedServiceCommand implements Action { > > @Reference(filter = "color=red") > private ColorService colorService; > > @Override > public Object execute() throws Exception { > System.out.println("Color = " + colorService.getColor()); > return null; > } > > } > > *** > * Example Service source code > *** > package com.example.service.internal; > > import org.osgi.service.component.annotations.Component; > > import com.example.service.ColorService; > > @Component(immediate = true, property = "color=red") > public class RedColorService implements ColorService { > > @Override > public String getColor() { > return "RED"; > } > > } > > > Paul Spencer > > > > On Mar 12, 2020, at 9:41 AM, Alex Soto wrote: > > > > Just to clarify, when I say it does not work, I mean that the injected > service is not the correct one matching the filter expression. > > > > Best regards, > > Alex soto > > > > > > > > > >> On Mar 12, 2020, at 9:24 AM, Jean-Baptiste Onofre > wrote: > >> > >> Hi, > >> > >> Let me check, but AFAIR, I have a test about that and it seems to work. > >> > >> I will create a Jira to double check. > >> > >> Regards > >> JB > >> > >>> Le 12 mars 2020 à 14:23, Alex Soto a écrit : > >>> > >>> I see, but it is not working for me… > >>> > >>> The PR does not update > org.apache.karaf.shell.impl.action.command.ManagerImpl#instantiate, > shouldn’t this method be updated also to inject the appropriate service > when the command is instantiated? (See code fragment I pasted earlier) > >>> > >>> > >>> Best regards, > >>> Alex soto > >>> > >>> > >>> > >>> > >>>> On Mar 12, 2020, at 9:07 AM, Jean-Baptiste Onofre > wrote: > >>>> > >>>> Hi Alex, > >>>> > >>>> You can find the change I did about that
Re: Factory configurations bounded to felix.fileinstall bundle deactivate DS/SCR components
Hi again, It is indeed the same issue described by Amichai. As a workaround, I reverted org.apache.felix.fileinstall to 3.6.4. To achieve that I used the featuresProcessing mechanism to replace the original bundle. As a side note. I don't know who was the person or persons responsible for the featuresProcessing feature, but many, many thanks. This is a great feature. For anyone that faces the same issue, this is what I have done. * Specified the featuresProcessing parameter in karaf-maven-plugin configuration: ${project.basedir}/features-processing.xml The value is an XML file with the following contents > http://karaf.apache.org/xmlns/features-processing/v1.0.0; xmlns:f=" > http://karaf.apache.org/xmlns/features/v1.6.0;> > > > originalUri="mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.6" > replacement="mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4" > mode="maven" /> > > > > Thank you, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Fri, Jul 10, 2020 at 5:30 AM Jean-Baptiste Onofre wrote: > Hi, > > It’s not directly a Karaf issue: we have a Jira at Felix FileInstall. I > will fix that and release a new Felix FileInstall version. > > Regards > JB > > Le 9 juil. 2020 à 21:55, João Assunção a > écrit : > > Hello all, > > I use the config element in feature.xml to create configurations for my DS > components. Some of these components are factories. > When I install the feature, the configurations are created, the components > are activated but then they are deactivated automatically. > In the logs, I noticed that configurations are created bounded to null, > but then ConfigAdmin will change the binding to felix.fileinstall. When > this happens, the associated component is deactivated. This seems to happen > only for factories and only if I use the feature:install command. If I > change the feature to boot, this issue doesn't happen. > > My factory configurations are specified like this: > > ... > > > I'm running a custom distro based on Karaf 4.2.9 > > Did anyone experience something similar? > Thank you, > > Best regards, > João > > Email: joao.assun...@exploitsys.com > Mobile: +351 916968984 > Phone: +351 211933149 > Web: www.exploitsys.com > > > >
Factory configurations bounded to felix.fileinstall bundle deactivate DS/SCR components
Hello all, I use the config element in feature.xml to create configurations for my DS components. Some of these components are factories. When I install the feature, the configurations are created, the components are activated but then they are deactivated automatically. In the logs, I noticed that configurations are created bounded to null, but then ConfigAdmin will change the binding to felix.fileinstall. When this happens, the associated component is deactivated. This seems to happen only for factories and only if I use the feature:install command. If I change the feature to boot, this issue doesn't happen. My factory configurations are specified like this: ... I'm running a custom distro based on Karaf 4.2.9 Did anyone experience something similar? Thank you, Best regards, João Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Re: Karaf 4.2.7 and PaxLogging/Knopflerfish
I had the same issue. Adding an exclusion to the framework dependency fixed it for me. org.apache.karaf.features framework kar org.knopflerfish.kf6 log-API João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Fri, Oct 4, 2019 at 9:03 AM J. Brebec wrote: > Do you remember the name of the property or where I should look ? I didn't > see anything on this suject in the release note of pax logging. > > Thanks > > On 2019/10/03 18:01:24, Benjamin Graf wrote: > > If I remember right there is a new option to be set since pax-logging > 1.11. > > > > Might not be set yet in Karaf 4.2.7 > > > > Regards > > Benjamin > > > > Am 3. Oktober 2019 13:59:01 MESZ schrieb "J. Brebec" < > jeremie.bre...@gmail.com>: > > >Thanks. > > > > > >It's probably related to the upgrade to pax-logging too, but when I > > >launch Karaf 4.2.7 (on windows), there is a System.println visibile in > > >the console : > > > > > >org.ops4j.pax.url.wrap > > >[org.ops4j.pax.url.commons.handler.HandlerActivator] DEBUG : Handler > > >for protocols [wrap] started > > > > > > > > >On 2019/10/03 09:10:43, jbonofre wrote: > > >> Let me take a look. It's probably a side effect of pax-logging 1.11 > > >update. > > >> > > >> I keep you posted. > > >> > > >> Regards > > >> JB > > >> > > >> > > >> > > >> -- > > >> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html > > >> > > > > -- > > Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet. >
Custom distro: Matched URI can't use version ranges
Hello all, I'm using a custom distro where one of the features uses version ranges. During assembly the following warning occurs: [WARNING] Matched URI can't use version ranges: mvn:org.apache.karaf.features/standard/[4,5)/xml/features As a side effect the distro will not only include features from karaf 4.2.7 but also from 4.2.6. Isn't clear why it includes 4.2.6. Apparently the feature that is causing this issue is aries-jax-rs where features.xml includes this line: mvn:org.apache.karaf.features/standard/[4,5)/xml/features Another question. During assembly the plugin attempts to download org.knopflerfish.kf6:log-API:jar:5.0.0. Because this artifact is in one repository not mirrored by my organization's nexus, I added an exclusion to org.apache.karaf.features:framework dependency to make the assembly work. I didn't find this bundle in the official karaf distro, so I guess is safe to exclude it, right ? Thank you Best regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
How can I change the server port for a JAX-RS whiteboard application?
Hello all, I'm running JAX-RS whiteboard in Karaf and I need to change the server port for one of the applications that are running. Karaf is running other applications that should be kept available in the default port. I'm trying to avoid the use of a reverse proxy for this purpose. I created a new ServerConnector in jetty.xml and using Pax Web HttpContextMapping I was able to map static resources and some test servlets to the new server connector. Unfortunately, I was unable to make this work for whiteboard applications. When applying pax web extender httpContext.id property to Application the corresponding Whiteboard Servlet is kept undeployed. Any tips? Thanks in advance, Regards, João Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Re: New OSGi R7 Logging in Karaf
@Paul, what is the issue with using SLF4J? SLF4J code in every bundle? Usually, the only SLF4J code I have is: > private static final Logger LOGGER = LoggerFactory.getLogger(Acme.class); The LoggerFactory provided by Karaf (Pax Logging) will take care of the rest. For the Log service to be injected, as shown in your example, all the classes requiring a logger will need to be DS components. You probably don't want/need that. During unit test, you will also need to "inject"/set the logger. My suggestion is to stick with SLF4J. Your code will be independent of the logging library/framework running under the hood, and probably most of the libraries you are using are also using SLF4J. Best regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Wed, May 1, 2019 at 1:27 PM Jean-Baptiste Onofré wrote: > By the way, I will blog and send an update on the mailing list about R7 > in Karaf, I will add a section about the logging. > > Regards > JB > > On 01/05/2019 12:56, Paul Fraser wrote: > > Hi, > > > > B J Hargrave has developed an Slf4j/OSGi bundle which routes all slf4j > > log events to the new R7 osgi log service. > > > > https://www.youtube.com/watch?v=DJF0aETiNec=youtu.be about 24 > > mins in. > > > > 19min 30s into video he shows how the new log service is used () > > > > === > > > > @Reference(service=LoggerFactory.class) > > > > private Logger logger; > > > > and then as usual in code > > > > logger.info("Hello new bundle"); > > > > = > > > > I would like to be able to use this new logging asusage in code > > requires only this @Reference entry and no need for the slf4j code > > usually required in every bundle. > > > > Being very new to Karaf, any guidance available as to how to set up the > > logging config to achieve this end would be most appreciated. > > > > I am running Karaf 4.3-SNAPSHOT. > > > > Paul Fraser > > > > > > > > > > > > -- > Jean-Baptiste Onofré > jbono...@apache.org > http://blog.nanthrax.net > Talend - http://www.talend.com >
Re: gogo console commands
Hi Scott, Isn't the Converter service a recent introduction to the OSGi framework? I have the idea the Converter was introduced in OSGi core 7 (release a few weeks ago) and Karaf 4.2.0 is still using OSGi Core 5. Maybe someone else can confirm this. Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Fri, May 11, 2018 at 6:23 AM, Scott Lewis <sle...@composent.com> wrote: > I've created some custom gogo console commands, and they work fine on > the gogo console in felix. > > When I run them on Karaf 4.2.0, however, the command handlers themselves > are executed , but I also use a > org.apache.felix.service.command.Converter so that I can return complex > types (and Lists of complex types) and have the gogo runtime call into > my Converter.format impl for formatting the instances of the complex > return types. > > Using a debugger, I can see my Converter service format method called > by the felix gogo console, but the Converter.format method is never > called in Karaf console, and no output is produced (either than my table > header line written out as String with no conversion). > > Has anyone added gogo commands to Karaf that use the Converter services > to convert complex types to output strings?  Is there something else > that needs to be configured in Karaf runtime to allow this? > > Thanksinadvance, > > Scott > >
Re: Some tipps and tricks for writing pax exam OSGi tests
Very nice Christian. Thank you for the effort you put into those examples. I already managed to learn something new and add some new things to my tool belt. Keep up with the good work. Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Tue, Apr 17, 2018 at 7:51 AM, Christian Schneider < ch...@die-schneider.net> wrote: > I have just finished an example and docs of some tips and tricks I learned > for writing OSGi tests using pax exam. > > Some highlights: > > - Mock tests for DS components using Mockito > - Debug pax exam based tests like plain java code (edit, save, debug) > - Full support for hamcrest matchers > - Use Awaitility for polling asynchronous external systems > - Create test bundles with bnd and DS components on the fly using > TinyBundles > - Use logback in pax exam > > See > https://github.com/cschneider/osgi-testing-example > > Cheers > Christian > > -- > -- > Christian Schneider > http://www.liquid-reality.de > > Computer Scientist > http://www.adobe.com > >
Is it possible to change the URI format of bundles ?
Hello all, I'm integrating a 3rd party library where there is some code that uses the codeSource location to find the location on disk of the jar itself. The way it is done is flawed and only works if the URI maps to a file URI. This means it will not work when deployed in Karaf where the jar URI is something like jar:bundle://263.5:0/!/. The jar location is not an obligatory condition for the library to work and is more an additional path to look for native libraries. Unfortunately, the developers didn't take the precautions to handle a potential NPE while converting from a URI to an absolute path. Since I don't have the code for the library and the supplier is not willing to make changes, I'm looking up for a workaround for this issue. Is it possible to change the URI format used in Karaf for the bundles, or some classloader trickery do the job? Thanks in advance. Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Re: Performance degradation due to zombie log:tail commands
Hello JB, I haven't tried with Karaf 4.1.4. I was planning to wait for 4.1.5 due to KARAF-5384 <https://issues.apache.org/jira/browse/KARAF-5384>. Yes. By client I meant the SSH client. Thank you. Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Fri, Feb 9, 2018 at 10:56 AM, Jean-Baptiste Onofré <j...@nanthrax.net> wrote: > By the way, when you say "client", you mean SSH client (like Karaf > bin/client) ? > > Regards > JB > > On 02/09/2018 11:16 AM, João Assunção wrote: > > Hello all, > > > > I'm experiencing a considerable performance degradation as a result of > zombie > > log:tail commands. By zombie, I mean cases where the client session > > terminates abruptly or due to timeout. > > The performance degradation is caused by logging as a result of the > appenders > > trying to write to a terminal stream that is closed. In this situation, > for > > every character written to the appender, PrintStream will > call ensureOpen and > > thrown an IOException resulting in a considerable performance penalty. > > I'm running Karaf 4.1.3 > > > > Since the logging is provided by Pax Logging but the terminal is the > realm of > > Karaf I'm not sure where I should open an issue. > > Thanks, > > > > Regards, > > > > João Assunção > > > > Email: joao.assun...@exploitsys.com <mailto:joao.assun...@exploitsys.com > > > > Mobile: +351 916968984 > > Phone: +351 211933149 > > Web: www.exploitsys.com <http://www.exploitsys.com> > > > > > > -- > Jean-Baptiste Onofré > jbono...@apache.org > http://blog.nanthrax.net > Talend - http://www.talend.com >
Performance degradation due to zombie log:tail commands
Hello all, I'm experiencing a considerable performance degradation as a result of zombie log:tail commands. By zombie, I mean cases where the client session terminates abruptly or due to timeout. The performance degradation is caused by logging as a result of the appenders trying to write to a terminal stream that is closed. In this situation, for every character written to the appender, PrintStream will call ensureOpen and thrown an IOException resulting in a considerable performance penalty. I'm running Karaf 4.1.3 Since the logging is provided by Pax Logging but the terminal is the realm of Karaf I'm not sure where I should open an issue. Thanks, Regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Re: "org.apache.felix.eventadmin.IgnoreTopic" ignored for log events
Hello Roberto, A few months ago I came across the same issue. I think it is a bug in the EventAdmin implementation ( https://issues.apache.org/jira/browse/FELIX-5738). Unfortunately, I didn't find an workwaround. João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Tue, Jan 16, 2018 at 3:44 PM, robe...@iooota.com <robe...@iooota.com> wrote: > Context: Apache Karaf 4.1.3 > > Hi, > I'm trying to force the EventAdmin to do not propagate any event dealing > with the logging system, but whatever value I try with the > "org.apache.felix.eventadmin.IgnoreTopic" parameter gets ignored. > > I've done some debugging and this is what I've noticed: > - the check is performed at org.apache.felix.eventadmin. > impl.handler.EventAdminImpl.postEvent(org.osgi.service.event.Event) line: > 178, where "checkTopic(...)" is invoked > - checkTopic() applies a set of matchers (derived from the ".cfg" file) to > the topic of the event considered > - the matcher is implemented by org.apache.felix.eventadmin.impl.handler. > EventHandlerTracker$SubPackageMatcher.match(java.lang.String) line: 377 > this way > > @Override > public boolean match(final String className) > { > final int pos = className.lastIndexOf('.'); > return pos > -1 && className.substring(0, pos + > 1).startsWith(m_packageName); > } > > "classname" is passed as "org/osgi/service/log/LogEntry/LOG_WARNING" (the > event topic) and "m:packageName" is "org/osgi/service/log/." (derived from > "org/osgi/service/log/*" in the .cfg file). > > Whatever value I set in the .cfg file pos will always be -1 and > there's nothing I can do about it, since I can't choose the logging events > topic string. Thus, the result will be always "false" and no event will be > skipped. > > What am I missing?... > > Thanks in advance, > > > Roberto > >
Re: Karaf 4.1.3 with Aries JPA missing requirement JavaJPA
I use Hibernate as the persistence engine and the following features: * jdbc * pax-jdbc-h2 * pax-jdbc-postgresql * jpa * hibernate In other projects I used eclipselink and they both work great. I noticed the missing requirement osgi.contract=JavaJPA. I don't use that in my JPA bundles, and after some investigation I noticed it was introduced recently in the snapshot version of aries JPA. Try to use the examples from aries.jpa version 2.6.1 João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Tue, Nov 21, 2017 at 4:24 PM, Jean-Baptiste Onofré <j...@nanthrax.net> wrote: > Let me take a look'm. I was swamped on meetings today. > > Regards > JB > On Nov 21, 2017, at 17:23, Alex Soto <alex.s...@envieta.com> wrote: >> >> Thank you Francois, I tried EclipseLink, but it still doesn’t work. I am >> doing all this interactively on a fresh Karaf installation. In my case >> since I do not have an actual database server, so I am using H2. I >> installed the following features: >> >> feature:install jdbc >> feature:install jndi >> feature:install jpa >> feature:install transaction >> feature:install eclipselink >> feature:install pax-jdbc >> feature:install pax-jdbc-config >> feature:install pax-jdbc-h2 >> feature:install pax-jdbc-pool-dbcp2 >> >> *list* >> >> START LEVEL 100 , List Threshold: 50 >> ID │ State │ Lvl │ Version │ Name >> ─ >> 28 │ Active│ 80 │ 4.1.3 │ Apache Karaf :: OSGi >> Services :: Event >> 53 │ Active│ 80 │ 1.9.2.1 │ Apache ServiceMix :: >> Bundles :: jasypt >> 54 │ Active│ 80 │ 1.5.0 │ OPS4J Base - Service >> Provider Access >> 55 │ Active│ 80 │ 1.1.0 │ OPS4J Pax JDBC Generic >> Driver Extender >> 56 │ Active│ 80 │ 1.1.0 │ OPS4J Pax JDBC Config >> 57 │ Active│ 80 │ 1.1.0 │ OPS4J Pax JDBC Pooling >> Support Base >> 58 │ Active│ 80 │ 1.0.0.201505202023 │ >> org.osgi:org.osgi.service.jdbc >> 59 │ Active│ 80 │ 4.1.3 │ Apache Karaf :: JDBC :: >> Core >> 67 │ Active│ 80 │ 3.0.0 │ Expression Language 3.0 >> API >> 68 │ Active│ 80 │ 1.2.0 │ CDI APIs >> 69 │ Active│ 80 │ 1.2 │ javax.interceptor API >> 70 │ Active│ 80 │ 1.2 │ javax.transaction API >> 71 │ Active│ 80 │ 2.6.1 │ Apache Aries JPA >> Container API >> 72 │ Active│ 80 │ 2.6.1 │ Apache Aries JPA >> blueprint >> 73 │ Active│ 80 │ 2.6.1 │ Apache Aries JPA >> container >> 74 │ Active│ 80 │ 2.6.1 │ Apache Aries JPA support >> 77 │ Active│ 80 │ 1.6.0 │ Commons Pool >> 78 │ Active│ 80 │ 1.0.2 │ Apache Felix >> Coordinator Service >> 79 │ Active│ 80 │ 1.1.1 │ geronimo-jms_1.1_spec >> 81 │ Active│ 80 │ 1.2 │ >> geronimo-servlet_2.5_spec >> 83 │ Active│ 80 │ 1.7.0.6 │ Apache ServiceMix :: >> Bundles :: ant >> 84 │ Active│ 80 │ 1.4.0.3 │ Apache ServiceMix :: >> Bundles :: commons-dbcp >> 85 │ Active│ 80 │ 1.0.0.2 │ Apache ServiceMix :: >> Bundles :: javax.inject >> 88 │ Active│ 80 │ 1.1.1 │ Apache Aries >> Transaction Blueprint >> 89 │ Active│ 80 │ 2.1.0 │ Apache Aries >> Transaction Blueprint >> 90 │ Active│ 80 │ 1.3.3 │ Apache Aries >> Transaction Manager >> 91 │ Active│ 80 │ 2.1.0.v201304241213 │ Java Persistence API 2.1 >> 92 │ Active│ 80 │ 2.6.1 │ Apache Aries JPA >> Container adapter for EclipseLink >> 93 │ Active│ 80 │ 3.2.0.v201302191141 │ EclipseLink ANTLR >> 94 │ Active│ 80 │ 5.0.1.v201405080102 │ EclipseLink ASM >> 95 │ Active│ 80 │ 2.6.4.v20160829-44060b6 │ EclipseLink Core >> 96 │ Active│ 80 │ 2.6.4.v20160829-44060b6 │ EclipseLink JPA >> 97 │ Active│ 80 │ 2.6.4.v20160829-44060b6 │ EclipseLink Hermes >> Parser >> 98 │ Active│ 80 │ 1.3.172 │ H2 Database Engine >> 99 │ Active│ 80 │ 2.1.1 │ Apache Commons DBCP >> 100 │ Active│ 80 │ 2.4.2 │ Apache Commons Pool >> 101 │ Active│ 80 │ 3.2.4.1
Re: Why is org.apache.aries.blueprint.core.compatibility installed for some some features
I will open an issue. I had already implemented the workaround sugested and is working great. My question was more due to curiosity why a feature not using blueprint would trigger the installation of that bundle. Thank you. João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Wed, Nov 8, 2017 at 4:48 PM, Guillaume Nodet <gno...@apache.org> wrote: > THis looks like a regression caused by KARAF-4932. > Could you please raise a JIRA for this issue ? > > A workaround could be to modify the generation of you custom assembly so > that the blueprint compatibility bundle is installed by default. At least, > it would avoid the unwanted refresh of all blueprint apps. > > 2017-11-08 17:16 GMT+01:00 João Assunção <joao.assun...@exploitsys.com>: > >> Of course >> >> The feature I'm trying to install: >> >> karaf@root()> feature:info paybox-io-modbus >> Feature paybox-io-modbus 0.1.0.SNAPSHOT >> Description: >> Modbus I/O implementation >> Feature has no configuration >> Feature has no configuration files >> Feature has no dependencies. >> Feature contains followed bundles: >> mvn:pt.brisa.common/common-service-core/1.3.0 >> mvn:pt.brisa.paybox/io-api/0.1.0-SNAPSHOT >> mvn:pt.brisa.paybox/io-modbus/0.1.0-SNAPSHOT >> mvn:pt.brisa.paybox/io-commands/0.1.0-SNAPSHOT >> Feature has no conditionals. >> >> In attachment the output of feature:install >> >> Thank you. >> >> João Assunção >> >> Email: joao.assun...@exploitsys.com >> Mobile: +351 916968984 <+351%20916%20968%20984> >> Phone: +351 211933149 <+351%2021%20193%203149> >> Web: www.exploitsys.com >> >> >> >> On Wed, Nov 8, 2017 at 2:39 PM, Guillaume Nodet <gno...@apache.org> >> wrote: >> >>> Can you use feature:install --verbose --all-wiring and send us the >>> output ? >>> >>> 2017-11-08 11:03 GMT+01:00 João Assunção <joao.assun...@exploitsys.com>: >>> >>>> Hello all, >>>> >>>> In Karaf 4.1.3 when I do a feature:install one of my features >>>> the org.apache.aries.blueprint.core.compatibility bundle gets >>>> installed causing a refresh of all bundles and a Karaf shutdown. >>>> >>>> None of the bundles in the feature uses blueprint and the more exotic >>>> thing is that one of the bundles uses a Contional-Package instruction. >>>> >>>> What are possible reasons for this blueprint compatibility bundle to >>>> get installed ? >>>> >>>> Thanks. >>>> >>>> João Assunção >>>> >>>> Email: joao.assun...@exploitsys.com >>>> Mobile: +351 916968984 <+351%20916%20968%20984> >>>> Phone: +351 211933149 <+351%2021%20193%203149> >>>> Web: www.exploitsys.com >>>> >>>> >>>> >>> >>> >>> -- >>> >>> Guillaume Nodet >>> >>> >> > > > -- > > Guillaume Nodet > >
Re: Why is org.apache.aries.blueprint.core.compatibility installed for some some features
Of course The feature I'm trying to install: karaf@root()> feature:info paybox-io-modbus Feature paybox-io-modbus 0.1.0.SNAPSHOT Description: Modbus I/O implementation Feature has no configuration Feature has no configuration files Feature has no dependencies. Feature contains followed bundles: mvn:pt.brisa.common/common-service-core/1.3.0 mvn:pt.brisa.paybox/io-api/0.1.0-SNAPSHOT mvn:pt.brisa.paybox/io-modbus/0.1.0-SNAPSHOT mvn:pt.brisa.paybox/io-commands/0.1.0-SNAPSHOT Feature has no conditionals. In attachment the output of feature:install Thank you. João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Wed, Nov 8, 2017 at 2:39 PM, Guillaume Nodet <gno...@apache.org> wrote: > Can you use feature:install --verbose --all-wiring and send us the output > ? > > 2017-11-08 11:03 GMT+01:00 João Assunção <joao.assun...@exploitsys.com>: > >> Hello all, >> >> In Karaf 4.1.3 when I do a feature:install one of my features >> the org.apache.aries.blueprint.core.compatibility bundle gets installed >> causing a refresh of all bundles and a Karaf shutdown. >> >> None of the bundles in the feature uses blueprint and the more exotic >> thing is that one of the bundles uses a Contional-Package instruction. >> >> What are possible reasons for this blueprint compatibility bundle to get >> installed ? >> >> Thanks. >> >> João Assunção >> >> Email: joao.assun...@exploitsys.com >> Mobile: +351 916968984 <+351%20916%20968%20984> >> Phone: +351 211933149 <+351%2021%20193%203149> >> Web: www.exploitsys.com >> >> >> > > > -- > > Guillaume Nodet > > Adding features: paybox-io-modbus/[0.1.0.SNAPSHOT,0.1.0.SNAPSHOT] Wiring: root#cxf-bindings-soap-3.1.10 / 0.0.0 cxf-bindings-soap / 3.1.10 root#cxf-http-jetty_fix-3.1.10 / 0.0.0 cxf-http-jetty_fix / 3.1.10 root#paybox-io-modbus-0.1.0.SNAPSHOT / 0.0.0 paybox-io-modbus / 0.1.0.SNAPSHOT root#http-4.1.3 / 0.0.0 http / 4.1.3 com.sun.jna / 4.4.0 root#621e1d5c-bb18-4d10-ac42-5dcad3b832eb-0.0.0 / 0.0.0 root#log-4.1.3 / 0.0.0 log / 4.1.3 root#pax-http-jetty-6.0.7 / 0.0.0 pax-http-jetty / 6.0.7 root#aries-rsa-discovery-zookeeper-server-1.10.0 / 0.0.0 aries-rsa-discovery-zookeeper-server / 1.10.0 root#hibernate-5.2.8.Final / 0.0.0 hibernate / 5.2.8.Final root#ssh-4.1.3 / 0.0.0 ssh / 4.1.3 root#transaction-api-1.2.0 / 0.0.0 transaction-api / 1.2.0 org.eclipse.jdt.core.compiler.batch / 3.10.0.v20140604-1726 root / 0.0.0 root#pax-http-whiteboard-6.0.7 / 0.0.0 pax-http-whiteboard / 6.0.7 root#cxf-databinding-jaxb-3.1.10 / 0.0.0 cxf-databinding-jaxb / 3.1.10 javassist / 3.20.0.GA root#hibernate-orm-5.2.8.Final / 0.0.0 org.fusesource.hawtbuf.hawtbuf / 1.11.0 root#aries-rsa-provider-fastbin-1.10.0 / 0.0.0 root#shell-4.1.3 / 0.0.0 shell / 4.1.3 root#transaction-manager-geronimo-1.3.3 / 0.0.0 transaction-manager-geronimo / 1.3.3 net.bytebuddy.byte-buddy / 1.6.6 root / 0.0.0 org.apache.felix.framework / 5.6.8 root#framework-4.1.3 / 0.0.0 org.apache.servicemix.bundles.javax-inject / 1.0.0.2 root / 0.0.0 root#aries-rsa-provider-fastbin-1.10.0 / 0.0.0 aries-rsa-provider-fastbin / 1.10.0 root#cxf-http-3.1.10 / 0.0.0 cxf-http / 3.1.10 root#pax-jdbc-1.1.0 / 0.0.0 pax-jdbc / 1.1.0 root#shell-compat-4.1.3 / 0.0.0 shell-compat / 4.1.3 root#jdbc-4.1.3 / 0.0.0 jdbc / 4.1.3 root#pax-http-6.0.7 / 0.0.0 pax-http / 6.0.7 javax.el-api / 3.0.0 root / 0.0.0 javax.servlet-api / 3.1.0 root / 0.0.0 org.jboss.jandex / 2.0.3.Final root#hibernate-orm-5.2.8.Final / 0.0.0 root#cxf-jaxws-3.1.10 / 0.0.0 cxf-jaxws / 3.1.10 root#jaas-boot / 0.0.0 jaas-boot / 0.0.0 root#pax-jdbc-postgresql-1.1.0 / 0.0.0 pax-jdbc-postgresql / 1.1.0 root#aries-proxy-4.1.3 / 0.0.0 aries-proxy / 4.1.3 root#package-4.1.3 / 0.0.0 package / 4.1.3 jaas-boot / 0.0.0 root#jaas-boot / 0.0.0 root#framework-4.1.3 / 0.0.0 framework / 4.1.3 root#diagnostic-4.1.3 / 0.0.0 diagnostic / 4.1.3 root#pax-jdbc-config-1.1.0 / 0.0.0 pax-jdbc-config / 1.1.0 root#cxf-core-3.1.10 / 0.0.0 cxf-core / 3.1.10 org.ops4j.base.spi / 1.5.0 root / 0.0.0 root#aries-rsa-discovery-zookeeper-1.10.0 / 0.0.0 aries-rsa-discovery-zookeeper / 1.10.0 javax.interceptor-api / 1.2.0 root / 0.0.0 root#hibernate-orm-5.2.8.Final / 0.0.0 hibernate-orm / 5.2.8.Final root#p
Why is org.apache.aries.blueprint.core.compatibility installed for some some features
Hello all, In Karaf 4.1.3 when I do a feature:install one of my features the org.apache.aries.blueprint.core.compatibility bundle gets installed causing a refresh of all bundles and a Karaf shutdown. None of the bundles in the feature uses blueprint and the more exotic thing is that one of the bundles uses a Contional-Package instruction. What are possible reasons for this blueprint compatibility bundle to get installed ? Thanks. João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Duplicate configurations when using features with configurations
Hello all, I'm using config elements inside karaf features and when installed I noticed that two configurations are created for each config element. One is created with a key org.apache.karaf.features.configKey and the other with a key felix.fileinstall.filename. An example of a configuration element: deviceId=reader_LEVEL1 portName=COM1 Can anyone point me out what I'm doing wrong, and if possible a way to prevent the creation of the cfg file in ${KARAF_HOME}/etc Thank you. Best regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com
Re: Building karaf offline version with Karaf Cave
Hi Mariusz, Down I include a possible configuration for the karaf-maven-plugin that should do what you want. It might need some fiddling to work, and you will need to add the name of all the camel features that you want to include. I normally use maven-assembly-plugin to zip the resulting repository. org.apache.karaf.tooling karaf-maven-plugin features-add-to-repo generate-resources features-add-to-repository true mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features false true camel camel-ahc camel-ahc-ws target/local-repo org.apache.maven.plugins maven-assembly-plugin bin install single src/assemble/bin.xml João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Wed, Aug 23, 2017 at 11:56 AM, Mariusz Koprowski < mariusz.koprow...@hexagonmining.com> wrote: > Hi João > > Well I’m searching for option to add to repo all features that are in > repositories that I have provided e.g.: > > I have Camel repo defined. It contains around 200 features. I would like > repo to have them all not only the one that I need on boot. So user can add > them if needed without internet. > > > > > > Best regards > > *--* > > *Mariusz Koprowski* > Enterprise Solutions Engineering Lead > > *T: *+48 42 253 48 28 <+48%2042%20253%2048%2028> > > *E:* mariusz.koprow...@hexagonmining.com > > Hexagon Mining > Wolczanska 128/134 > 90-441, Lodz, Poland > www.hexagonmining.com | WebEx > <https://hexagongeosystems.webex.com/mw3100/mywebex/cmr/cmr.do?siteurl=hexagongeosystems=meet=KOPM=hexagongeosystems> > | > Skype > > > > *From:* João Assunção [mailto:joao.assun...@exploitsys.com] > *Sent:* Monday, August 21, 2017 6:49 PM > *To:* user@karaf.apache.org > *Subject:* Re: Building karaf offline version with Karaf Cave > > > > Hi Mariusz, > > > > I've been using karaf-maven-plugin, with the goal features-add-to-repository, > to > generate a maven like repository with the set of features to make available > offline. > > I then change org.ops4j.pax.url.mvn.localRepository in > org.ops4j.pax.url.mvn.cfg to point to the directory containing the > repository produced by the plugin. > > In the past this worked quite well, and I ended with a repository just > with the dependencies specified in the plugin configuration. With the 4.x > version, for some reason I'm still trying to figure out, I end with a > repository with all the features, even standard ones. > > > > Best regards, > > > João Assunção > > > > Email: joao.assun...@exploitsys.com > > Mobile: +351 916968984 <+351%20916%20968%20984> > > Phone: +351 211933149 <+351%2021%20193%203149> > > Web: www.exploitsys.com > > > > > > > > On Mon, Aug 21, 2017 at 11:25 AM, Mariusz Koprowski <Mariusz.Koprowski@ > hexagonmining.com> wrote: > > Hi All > > I have a such situation. I need install karaf without internet connection. > > I know that I could use Karaf Cave as a repo… but the question is how to > populate it with all needed things. > > > > E.g. AS a standard, the installation that I need to do, comes with Karaf > Standard + Camel Core. But in time I will need to add some of the Camel > features (I don’t know which one now). So I would like to have all Camel > features and it’s dependencies in Cave. > > How can I generate a repo with all Camel features ? is there any automatic > way to do that ? > > > > I’m using Karaf 4.0.8 > > > > Best regards > > *--* > > *Mariusz Koprowski* > > > > >
Re: Building karaf offline version with Karaf Cave
Hi Mariusz, I've been using karaf-maven-plugin, with the goal features-add-to-repository, to generate a maven like repository with the set of features to make available offline. I then change org.ops4j.pax.url.mvn.localRepository in org.ops4j.pax.url.mvn.cfg to point to the directory containing the repository produced by the plugin. In the past this worked quite well, and I ended with a repository just with the dependencies specified in the plugin configuration. With the 4.x version, for some reason I'm still trying to figure out, I end with a repository with all the features, even standard ones. Best regards, João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Mon, Aug 21, 2017 at 11:25 AM, Mariusz Koprowski < mariusz.koprow...@hexagonmining.com> wrote: > Hi All > > I have a such situation. I need install karaf without internet connection. > > I know that I could use Karaf Cave as a repo… but the question is how to > populate it with all needed things. > > > > E.g. AS a standard, the installation that I need to do, comes with Karaf > Standard + Camel Core. But in time I will need to add some of the Camel > features (I don’t know which one now). So I would like to have all Camel > features and it’s dependencies in Cave. > > How can I generate a repo with all Camel features ? is there any automatic > way to do that ? > > > > I’m using Karaf 4.0.8 > > > > Best regards > > *--* > > *Mariusz Koprowski* > > >