You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by jgfrm <fr...@gordijn.org> on 2021/09/24 08:06:46 UTC
Karaf 5
Hi,
I have two questions about Karaf 5:
- is the presentation by Onofre at ApacheConf online somewhere?
- is it possible to explore Karaf 5 (or: what is there right now)? I am in
particular interested in the Spring Boot functionality, as I have a Spring
Boot application that I want to port to Karaf to support dynamic loading of
components. I have found the github repo of Onofre, but it is unclear to me
how e.g. to start Karaf.
Best,
-- Jaap
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
Hi JB,
Thank you very much.
I look forward to dig in to it.
Best,
-- Jaap
|-----Oorspronkelijk bericht-----
|Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|Verzonden: donderdag 30 september 2021 18:08
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Hi Jaap,
|
|let me rebase and polish a bit and I will push a first round (probably tomorrow
|night or during the weekend). I will keep you posted.
|
|Regards
|JB
|
|On 30/09/2021 14:40, jgfrm wrote:
|> Hi JB,
|>
|> That sounds interesting!
|> Is it possible to share what you developed?
|>
|> Best,
|>
|> -- Jaap
|>
|> |-----Oorspronkelijk bericht-----
|> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |Verzonden: donderdag 30 september 2021 11:34
|> |Aan: user@karaf.apache.org
|> |Onderwerp: Re: Karaf 5
|> |
|> |Hi Jaap,
|> |
|> |so, yes, we are talking about the same thing ;)
|> |
|> |There are actually two parts:
|> |
|> |- registering Spring bean in the K5 service registry and use it in
|> |another apps running in K5
|> |- registering "generic" services (like the json-config-loader,
|> |extractor, etc) that provide shared resources (like HTTP handler)
|> |
|> |Regards
|> |JB
|> |
|> |On 29/09/2021 23:30, jgfrm wrote:
|> |> Perhaps.
|> |>
|> |> I want to be able to use a bean in other Spring module.
|> |>
|> |> What is also an issue it that two (or more) modules obviously
|> |> result in two
|> |sockets to be opened, in my case both 8400.
|> |> A solution could be to open a different socket per module, e.g.
|> |> negotiated
|> |with a module for that purpose that also routes traffic for a
|> |particular endpoint to the socket of the module handling that endpoint.
|> |>
|> |> In https://github.com/hank-cp/sbp (based on pf4j) they have a
|> |> different
|> |strategy; there they have one socket for REST calls, and specific
|> |endpoints are forwarded to the appropriate plugin.
|> |>
|> |> Best,
|> |>
|> |> -- Jaap
|> |>
|> |>
|> |> |-----Oorspronkelijk bericht-----
|> |> |Van: JB Onofré <jb...@nanthrax.net>
|> |> |Verzonden: woensdag 29 september 2021 22:17
|> |> |Aan: user@karaf.apache.org
|> |> |Onderwerp: Re: Karaf 5
|> |> |
|> |> |I started a service bridge allowing to implicit push some spring
|> |> |bean to the k5 registry and so that can be used from other modules
|> |> |running in k5. It’s a local branch for now but I can push it on main.
|> |> |
|> |> |Is it what you are looking for ?
|> |> |
|> |> |Regards
|> |> |JB
|> |> |
|> |> |> Le 29 sept. 2021 à 21:43, jgfrm <fr...@gordijn.org> a écrit :
|> |> |>
|> |> |> Is there already something working for exporting functionality
|> |> |> of a Spring
|> |> |modules to other modules?
|> |> |>
|> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |> |Verzonden: woensdag 29 september 2021 17:26
|> |> |> |Aan: user@karaf.apache.org
|> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |
|> |> |> |Thanks for the update.
|> |> |> |
|> |> |> |I'm happy to say you are the first one to "use/launch" Karaf 5
|> |> |> |;)
|> |> |> |
|> |> |> |About the TomcatURLStreamHandlerFactory is known "issue":
|> |> |> |
|> |> |> |https://github.com/jbonofre/karaf5/blob/main/services/spring-bo
|> |> |> |ot-
|> |> |> |application-
|> |> |> |manager/src/main/java/org/apache/karaf/springboot/SpringBootApp
|> |> |> |lic
|> |> |> |ati
|> |> |> |on
|> |> |> |ManagerService.java#L110
|> |> |> |
|> |> |> |I have to improve this ;)
|> |> |> |
|> |> |> |Regards
|> |> |> |JB
|> |> |> |
|> |> |> |On 29/09/2021 17:19, jgfrm wrote:
|> |> |> |> The following works:
|> |> |> |>
|> |> |> |> Karaf.json:
|> |> |> |> ====
|> |> |> |> {
|> |> |> |> "applications": [
|> |> |> |> {
|> |> |> |> "name": "e3web",
|> |> |> |> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
|> |> |> |> "type": "spring-boot",
|> |> |> |> "properties": {
|> |> |> |> "enableHttp": true,
|> |> |> |> "enablePrometheus": true
|> |> |> |> }
|> |> |> |> }
|> |> |> |> ]
|> |> |> |> }
|> |> |> |> ====
|> |> |> |>
|> |> |> |> Add to Spring boot application:
|> |> |> |> ====
|> |> |> |> @SpringBootApplication
|> |> |> |> @ComponentScan
|> |> |> |> public class E3webApplication {
|> |> |> |>
|> |> |> |> ...
|> |> |> |> public static void main(String[] args) {
|> |> |> |> TomcatURLStreamHandlerFactory.disable(); // see
|> |> |> |https://github.com/spring-projects/spring-boot/issues/21535
|> |> |> |> SpringApplication.run(E3webApplication.class, args);
|> |> |> |> }
|> |> |> |> ====
|> |> |> |>
|> |> |> |> Start with
|> |> |> |> java --add-modules jdk.security.jgss -cp
|> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3w
|> |> |> |> eb-
|> |> |> |> tes
|> |> |> |> t-1
|> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-ma
|> |> |> |> nag er/ tar
|> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> |> |> -Dkaraf.config=src/main/resources/karaf.json
|> |> |> |> org.apache.karaf.boot.Main
|> |> |> |>
|> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |Van: JB Onofré <jb...@nanthrax.net>
|> |> |> |> |Verzonden: dinsdag 28 september 2021 06:34
|> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |
|> |> |> |> |Hi
|> |> |> |> |
|> |> |> |> |No it’s not this because k5 don’t use OSGi for the spring
|> |> |> |> |boot launcher. I still think it’s a missing add modules as Jvm arg.
|> |> |> |> |I will check
|> |> |> |today.
|> |> |> |> |
|> |> |> |> |Regards
|> |> |> |> |JB
|> |> |> |> |
|> |> |> |> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |> |>
|> |> |> |> |> While Googling, I came across on of your blogs
|> |> |> |> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-ka
|> |> |> |> |raf
|> |> |> |> |-
|> |> |> |> |431.html) that one of the changes in Karaf was to export the
|> |> |> |> |java.*
|> |> |> |packages.
|> |> |> |> |Could that be the cause?
|> |> |> |> |>
|> |> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |> |> |> |Verzonden: zondag 26 september 2021 18:02
|> |> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |> |
|> |> |> |> |> |Hi
|> |> |> |> |> |
|> |> |> |> |> |No sure, it’s only class loader issue. I remember this
|> |> |> |> |> |issue in pure spring boot with JDK11.
|> |> |> |> |> |
|> |> |> |> |> |Let me check.
|> |> |> |> |> |
|> |> |> |> |> |Regards
|> |> |> |> |> |JB
|> |> |> |> |> |
|> |> |> |> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |> |> |>
|> |> |> |> |> |> Hi JB,
|> |> |> |> |> |>
|> |> |> |> |> |> Fully understand that it is still work in progress.
|> |> |> |> |> |>
|> |> |> |> |> |> Regarding the .NoClassDefFoundError:
|> |> |> |> |> |> org/ietf/jgss/GSSException --add-modules
|> |> |> |> |> |> java.security.jgss does
|> |> |not solve it?
|> |> |> |> |> |> Is it a class loader problem?
|> |> |> |> |> |>
|> |> |> |> |> |> Best,
|> |> |> |> |> |>
|> |> |> |> |> |> -- Jaap
|> |> |> |> |> |>
|> |> |> |> |> |>
|> |> |> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |> |> |> |> |Verzonden: zondag 26 september 2021 14:20
|> |> |> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |> |> |
|> |> |> |> |> |> |Hi Jaap,
|> |> |> |> |> |> |
|> |> |> |> |> |> |First, maybe I was not clean in my presentation: Karaf
|> |> |> |> |> |> |5 is still under development and so, everything is not yet
|ready.
|> |> |> |> |> |> |As said, I will “move” the code to Apache Karaf repo
|> |> |> |> |> |> |as soon as I consider I have something clean and running.
|> |> |> |> |> |> |
|> |> |> |> |> |> |Anyway, about your email, I will check. Today my focus
|> |> |> |> |> |> |is on the OsgiApplicationManager to be Karaf 4 compliant.
|> |> |> |> |> |> |I also have to improve the Karaf Config service.
|> |> |> |> |> |> |
|> |> |> |> |> |> |By the way, you don’t need your own Main, just use the
|> |> |> |> |> |> |repackage with regular provided Main (you can take a
|> |> |> |> |> |> |look on the K4 assembly repackage as an example). I
|> |> |> |> |> |> |will create a gradle/maven plugin with
|> |> |> |> |> |repackage.
|> |> |> |> |> |> |
|> |> |> |> |> |> |Regarding your issue, as you are running with JDK11, I
|> |> |> |> |> |> |guess you have to add -- add-modules
|> |> |> |> |> |> |java.security.jgss to avoid the
|> |> |> |> |> |NoClassDefFoundException.
|> |> |> |> |> |> |
|> |> |> |> |> |> |Thanks anyway for your feedback, much appreciated.
|> |> |> |> |> |> |
|> |> |> |> |> |> |Regards
|> |> |> |> |> |> |JB
|> |> |> |> |> |> |
|> |> |> |> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> Hi Jean-Baptiste,
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> I managed to start (well not completely) my spring
|application.
|> |> |> |> |> |> |> However, while starting up, I get an exception:
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> 11:43:03.148 [main] ERROR
|> |> |> |> |> |> |> o.s.boot.SpringApplication:837 - Application run
|> |> |> |> |> |> |> failed
|> |> |> |> |> |> |>
|org.springframework.context.ApplicationContextException:
|> |> |> |> |> |> |> Unable to start web server; nested exception is
|> |> |> |> |java.lang.NoClassDefFoundError:
|> |> |> |> |> |> |> org/ietf/jgss/GSSException
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> Any ideas?
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> Also, I had to make modifications in
|> |> |> |> |> |> |SpringBootApplicationManagerService/start:
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> try {
|> |> |> |> |> |> |>
|> |> |Thread.currentThread().setContextClassLoader(classLoader);
|> |> |> |> |> |> |> // disable tomcat stream handler
|> |> |> |> |> |> |> /* There is no
|> |> |> |> |> |> |> TomcatURLStreamHandlerFactory in my spring
|> |> |> |jar
|> |> |> |> |> |> |> final Method tomcat =
|> |> |> |> |> |> |classLoader.loadClass("org.apache.catalina.webresource
|> |> |> |> |> |> |s.T omc atU RLS tre am
|> |> |> |> |> |> |HandlerFactory").getMethod("disable");
|> |> |> |> |> |> |> if (!tomcat.isBridge()) {
|> |> |> |> |> |> |> tomcat.setAccessible(true);
|> |> |> |> |> |> |> }
|> |> |> |> |> |> |> tomcat.invoke(null, null);
|> |> |> |> |> |> |> */
|> |> |> |> |> |> |> // invoke spring boot main
|> |> |> |> |> |> |> final Method main =
|> |> |> |> |> |>
|> |> |>
|> |||classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
|> |> |> |> |> |> |getM
|> |> |> |> |> |> |ethod("main", String[].class);
|> |> |> |> |> |> |> main.setAccessible(true);
|> |> |> |> |> |> |> log.info("Call JarLauncher");
|> |> |> |> |> |> |> if (properties.get("args") != null) {
|> |> |> |> |> |> |> log.info("Call JarLauncher with args");
|> |> |> |> |> |> |> main.invoke(null, new Object[]{
|> |> |> |> |> |> |> properties.get("args")
|> |});
|> |> |> |> |> |> |> } else {
|> |> |> |> |> |> |> log.info("Call JarLauncher without args");
|> |> |> |> |> |> |> main.invoke(null, new Object[]{new
|> |> |> |> |> |> |> String[0]}); // the original invoke
|> |> |> |> |> |> |did not work for me
|> |> |> |> |> |> |> }
|> |> |> |> |> |> |> } finally {
|> |> |> |> |> |> |>
|Thread.currentThread().setContextClassLoader(original);
|> |> |> |> |> |> |> }
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> Further details:
|> |> |> |> |> |> |> - openjdk version "11.0.12" 2021-07-20
|> |> |> |> |> |> |> - invocation:
|> |> |> |> |> |> |> java -cp
|> |> |> |> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:t
|> |> |> |> |> |> |> arg
|> |> |> |> |> |> |> et/
|> |> |> |> |> |> |> e3w
|> |> |> |> |> |> |> eb-
|> |> |> |> |> |> |> tes
|> |> |> |> |> |> |> t-1
|> |> |> |> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-appli
|> |> |> |> |> |> |> cat
|> |> |> |> |> |> |> ion
|> |> |> |> |> |> |> -ma
|> |> |> |> |> |> |> nag er/ tar
|> |> |> |> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> |> |> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> Main.java:
|> |> |> |> |> |> |> ###
|> |> |> |> |> |> |> public class Main {
|> |> |> |> |> |> |> public static void main(String[] args){
|> |> |> |> |> |> |> System.out.println("Starting Karaf");
|> |> |> |> |> |> |> Karaf karaf = Karaf.builder().build();
|> |> |> |> |> |> |> karaf.start();
|> |> |> |> |> |> |> }
|> |> |> |> |> |> |> }
|> |> |> |> |> |> |> ###
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> Best,
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> -- Jaap
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |> |> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
|> |> |> |> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |> |Hi Jaap,
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |> |The presentation is available here:
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |>
|> |> |> |> |> |>
|> |> |> |> |>
|> |> |> |>
|> |> |>
|> |>
|>
||||||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zE
|d
|> |a
|> |> |h
|> |> |> |K
|> |> |> |> |h
|> |> |> |> |> |c
|> |> |> |> |> |> |S
|> |> |> |> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |> |Karaf 5 WIP is available here:
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |> |https://github.com/jbonofre/karaf5
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |> |I'm available on Slack or by email if you wanna
|> |> |> |> |> |> |> |chat about
|> |> |Karaf5.
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |> |Regards
|> |> |> |> |> |> |> |JB
|> |> |> |> |> |> |> |
|> |> |> |> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
|> |> |> |> |> |> |> |> Hi,
|> |> |> |> |> |> |> |>
|> |> |> |> |> |> |> |> I have two questions about Karaf 5:
|> |> |> |> |> |> |> |> - is the presentation by Onofre at ApacheConf
|> |> |> |> |> |> |> |> online
|> |> |> |somewhere?
|> |> |> |> |> |> |> |> - is it possible to explore Karaf 5 (or: what is
|> |> |> |> |> |> |> |> there right
|> |now)?
|> |> |> |> |> |> |> |> I am in particular interested in the Spring Boot
|> |> |> |> |> |> |> |> functionality, as I have a Spring Boot
|> |> |> |> |> |> |> |> application that I want to port to Karaf to
|> |> |> |> |> |> |> |> support dynamic loading of components. I have
|> |> |> |> |> |> |> |> found the github repo of Onofre, but it is
|> |> |> |> |unclear to me how e.g. to start Karaf.
|> |> |> |> |> |> |> |>
|> |> |> |> |> |> |> |> Best,
|> |> |> |> |> |> |> |>
|> |> |> |> |> |> |> |> -- Jaap
|> |> |> |> |> |> |> |>
|> |> |> |> |> |> |>
|> |> |> |> |> |>
|> |> |> |> |> |>
|> |> |> |> |>
|> |> |> |> |>
|> |> |> |>
|> |> |> |>
|> |> |>
|> |>
|> |>
|>
Re: Karaf 5
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jaap,
let me rebase and polish a bit and I will push a first round (probably
tomorrow night or during the weekend). I will keep you posted.
Regards
JB
On 30/09/2021 14:40, jgfrm wrote:
> Hi JB,
>
> That sounds interesting!
> Is it possible to share what you developed?
>
> Best,
>
> -- Jaap
>
> |-----Oorspronkelijk bericht-----
> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |Verzonden: donderdag 30 september 2021 11:34
> |Aan: user@karaf.apache.org
> |Onderwerp: Re: Karaf 5
> |
> |Hi Jaap,
> |
> |so, yes, we are talking about the same thing ;)
> |
> |There are actually two parts:
> |
> |- registering Spring bean in the K5 service registry and use it in another apps
> |running in K5
> |- registering "generic" services (like the json-config-loader, extractor, etc) that
> |provide shared resources (like HTTP handler)
> |
> |Regards
> |JB
> |
> |On 29/09/2021 23:30, jgfrm wrote:
> |> Perhaps.
> |>
> |> I want to be able to use a bean in other Spring module.
> |>
> |> What is also an issue it that two (or more) modules obviously result in two
> |sockets to be opened, in my case both 8400.
> |> A solution could be to open a different socket per module, e.g. negotiated
> |with a module for that purpose that also routes traffic for a particular
> |endpoint to the socket of the module handling that endpoint.
> |>
> |> In https://github.com/hank-cp/sbp (based on pf4j) they have a different
> |strategy; there they have one socket for REST calls, and specific endpoints are
> |forwarded to the appropriate plugin.
> |>
> |> Best,
> |>
> |> -- Jaap
> |>
> |>
> |> |-----Oorspronkelijk bericht-----
> |> |Van: JB Onofré <jb...@nanthrax.net>
> |> |Verzonden: woensdag 29 september 2021 22:17
> |> |Aan: user@karaf.apache.org
> |> |Onderwerp: Re: Karaf 5
> |> |
> |> |I started a service bridge allowing to implicit push some spring bean
> |> |to the k5 registry and so that can be used from other modules running
> |> |in k5. It’s a local branch for now but I can push it on main.
> |> |
> |> |Is it what you are looking for ?
> |> |
> |> |Regards
> |> |JB
> |> |
> |> |> Le 29 sept. 2021 à 21:43, jgfrm <fr...@gordijn.org> a écrit :
> |> |>
> |> |> Is there already something working for exporting functionality of
> |> |> a Spring
> |> |modules to other modules?
> |> |>
> |> |> |-----Oorspronkelijk bericht-----
> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |> |Verzonden: woensdag 29 september 2021 17:26
> |> |> |Aan: user@karaf.apache.org
> |> |> |Onderwerp: Re: Karaf 5
> |> |> |
> |> |> |Thanks for the update.
> |> |> |
> |> |> |I'm happy to say you are the first one to "use/launch" Karaf 5 ;)
> |> |> |
> |> |> |About the TomcatURLStreamHandlerFactory is known "issue":
> |> |> |
> |> |> |https://github.com/jbonofre/karaf5/blob/main/services/spring-boot-
> |> |> |application-
> |> |> |manager/src/main/java/org/apache/karaf/springboot/SpringBootApplic
> |> |> |ati
> |> |> |on
> |> |> |ManagerService.java#L110
> |> |> |
> |> |> |I have to improve this ;)
> |> |> |
> |> |> |Regards
> |> |> |JB
> |> |> |
> |> |> |On 29/09/2021 17:19, jgfrm wrote:
> |> |> |> The following works:
> |> |> |>
> |> |> |> Karaf.json:
> |> |> |> ====
> |> |> |> {
> |> |> |> "applications": [
> |> |> |> {
> |> |> |> "name": "e3web",
> |> |> |> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
> |> |> |> "type": "spring-boot",
> |> |> |> "properties": {
> |> |> |> "enableHttp": true,
> |> |> |> "enablePrometheus": true
> |> |> |> }
> |> |> |> }
> |> |> |> ]
> |> |> |> }
> |> |> |> ====
> |> |> |>
> |> |> |> Add to Spring boot application:
> |> |> |> ====
> |> |> |> @SpringBootApplication
> |> |> |> @ComponentScan
> |> |> |> public class E3webApplication {
> |> |> |>
> |> |> |> ...
> |> |> |> public static void main(String[] args) {
> |> |> |> TomcatURLStreamHandlerFactory.disable(); // see
> |> |> |https://github.com/spring-projects/spring-boot/issues/21535
> |> |> |> SpringApplication.run(E3webApplication.class, args);
> |> |> |> }
> |> |> |> ====
> |> |> |>
> |> |> |> Start with
> |> |> |> java --add-modules jdk.security.jgss -cp
> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-
> |> |> |> tes
> |> |> |> t-1
> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manag
> |> |> |> er/ tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> |> |> -Dkaraf.config=src/main/resources/karaf.json
> |> |> |> org.apache.karaf.boot.Main
> |> |> |>
> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |Van: JB Onofré <jb...@nanthrax.net>
> |> |> |> |Verzonden: dinsdag 28 september 2021 06:34
> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |
> |> |> |> |Hi
> |> |> |> |
> |> |> |> |No it’s not this because k5 don’t use OSGi for the spring boot
> |> |> |> |launcher. I still think it’s a missing add modules as Jvm arg.
> |> |> |> |I will check
> |> |> |today.
> |> |> |> |
> |> |> |> |Regards
> |> |> |> |JB
> |> |> |> |
> |> |> |> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |> |>
> |> |> |> |> While Googling, I came across on of your blogs
> |> |> |> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf
> |> |> |> |-
> |> |> |> |431.html) that one of the changes in Karaf was to export the
> |> |> |> |java.*
> |> |> |packages.
> |> |> |> |Could that be the cause?
> |> |> |> |>
> |> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |> |> |> |Verzonden: zondag 26 september 2021 18:02
> |> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |> |
> |> |> |> |> |Hi
> |> |> |> |> |
> |> |> |> |> |No sure, it’s only class loader issue. I remember this issue
> |> |> |> |> |in pure spring boot with JDK11.
> |> |> |> |> |
> |> |> |> |> |Let me check.
> |> |> |> |> |
> |> |> |> |> |Regards
> |> |> |> |> |JB
> |> |> |> |> |
> |> |> |> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |> |> |>
> |> |> |> |> |> Hi JB,
> |> |> |> |> |>
> |> |> |> |> |> Fully understand that it is still work in progress.
> |> |> |> |> |>
> |> |> |> |> |> Regarding the .NoClassDefFoundError:
> |> |> |> |> |> org/ietf/jgss/GSSException --add-modules
> |> |> |> |> |> java.security.jgss does
> |> |not solve it?
> |> |> |> |> |> Is it a class loader problem?
> |> |> |> |> |>
> |> |> |> |> |> Best,
> |> |> |> |> |>
> |> |> |> |> |> -- Jaap
> |> |> |> |> |>
> |> |> |> |> |>
> |> |> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |> |> |> |> |Verzonden: zondag 26 september 2021 14:20
> |> |> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |> |> |
> |> |> |> |> |> |Hi Jaap,
> |> |> |> |> |> |
> |> |> |> |> |> |First, maybe I was not clean in my presentation: Karaf 5
> |> |> |> |> |> |is still under development and so, everything is not yet ready.
> |> |> |> |> |> |As said, I will “move” the code to Apache Karaf repo as
> |> |> |> |> |> |soon as I consider I have something clean and running.
> |> |> |> |> |> |
> |> |> |> |> |> |Anyway, about your email, I will check. Today my focus is
> |> |> |> |> |> |on the OsgiApplicationManager to be Karaf 4 compliant.
> |> |> |> |> |> |I also have to improve the Karaf Config service.
> |> |> |> |> |> |
> |> |> |> |> |> |By the way, you don’t need your own Main, just use the
> |> |> |> |> |> |repackage with regular provided Main (you can take a look
> |> |> |> |> |> |on the K4 assembly repackage as an example). I will
> |> |> |> |> |> |create a gradle/maven plugin with
> |> |> |> |> |repackage.
> |> |> |> |> |> |
> |> |> |> |> |> |Regarding your issue, as you are running with JDK11, I
> |> |> |> |> |> |guess you have to add -- add-modules java.security.jgss
> |> |> |> |> |> |to avoid the
> |> |> |> |> |NoClassDefFoundException.
> |> |> |> |> |> |
> |> |> |> |> |> |Thanks anyway for your feedback, much appreciated.
> |> |> |> |> |> |
> |> |> |> |> |> |Regards
> |> |> |> |> |> |JB
> |> |> |> |> |> |
> |> |> |> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |> |> |> |>
> |> |> |> |> |> |> Hi Jean-Baptiste,
> |> |> |> |> |> |>
> |> |> |> |> |> |> I managed to start (well not completely) my spring application.
> |> |> |> |> |> |> However, while starting up, I get an exception:
> |> |> |> |> |> |>
> |> |> |> |> |> |> 11:43:03.148 [main] ERROR
> |> |> |> |> |> |> o.s.boot.SpringApplication:837 - Application run failed
> |> |> |> |> |> |> org.springframework.context.ApplicationContextException:
> |> |> |> |> |> |> Unable to start web server; nested exception is
> |> |> |> |java.lang.NoClassDefFoundError:
> |> |> |> |> |> |> org/ietf/jgss/GSSException
> |> |> |> |> |> |>
> |> |> |> |> |> |> Any ideas?
> |> |> |> |> |> |>
> |> |> |> |> |> |> Also, I had to make modifications in
> |> |> |> |> |> |SpringBootApplicationManagerService/start:
> |> |> |> |> |> |>
> |> |> |> |> |> |> try {
> |> |> |> |> |> |>
> |> |Thread.currentThread().setContextClassLoader(classLoader);
> |> |> |> |> |> |> // disable tomcat stream handler
> |> |> |> |> |> |> /* There is no TomcatURLStreamHandlerFactory
> |> |> |> |> |> |> in my spring
> |> |> |jar
> |> |> |> |> |> |> final Method tomcat =
> |> |> |> |> |> |classLoader.loadClass("org.apache.catalina.webresources.T
> |> |> |> |> |> |omc atU RLS tre am HandlerFactory").getMethod("disable");
> |> |> |> |> |> |> if (!tomcat.isBridge()) {
> |> |> |> |> |> |> tomcat.setAccessible(true);
> |> |> |> |> |> |> }
> |> |> |> |> |> |> tomcat.invoke(null, null);
> |> |> |> |> |> |> */
> |> |> |> |> |> |> // invoke spring boot main
> |> |> |> |> |> |> final Method main =
> |> |> |> |> |>
> |> |>
> |||classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
> |> |> |> |> |> |getM
> |> |> |> |> |> |ethod("main", String[].class);
> |> |> |> |> |> |> main.setAccessible(true);
> |> |> |> |> |> |> log.info("Call JarLauncher");
> |> |> |> |> |> |> if (properties.get("args") != null) {
> |> |> |> |> |> |> log.info("Call JarLauncher with args");
> |> |> |> |> |> |> main.invoke(null, new Object[]{ properties.get("args")
> |});
> |> |> |> |> |> |> } else {
> |> |> |> |> |> |> log.info("Call JarLauncher without args");
> |> |> |> |> |> |> main.invoke(null, new Object[]{new
> |> |> |> |> |> |> String[0]}); // the original invoke
> |> |> |> |> |> |did not work for me
> |> |> |> |> |> |> }
> |> |> |> |> |> |> } finally {
> |> |> |> |> |> |> Thread.currentThread().setContextClassLoader(original);
> |> |> |> |> |> |> }
> |> |> |> |> |> |>
> |> |> |> |> |> |> Further details:
> |> |> |> |> |> |> - openjdk version "11.0.12" 2021-07-20
> |> |> |> |> |> |> - invocation:
> |> |> |> |> |> |> java -cp
> |> |> |> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:targ
> |> |> |> |> |> |> et/
> |> |> |> |> |> |> e3w
> |> |> |> |> |> |> eb-
> |> |> |> |> |> |> tes
> |> |> |> |> |> |> t-1
> |> |> |> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-applicat
> |> |> |> |> |> |> ion
> |> |> |> |> |> |> -ma
> |> |> |> |> |> |> nag er/ tar
> |> |> |> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> |> |> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
> |> |> |> |> |> |>
> |> |> |> |> |> |> Main.java:
> |> |> |> |> |> |> ###
> |> |> |> |> |> |> public class Main {
> |> |> |> |> |> |> public static void main(String[] args){
> |> |> |> |> |> |> System.out.println("Starting Karaf");
> |> |> |> |> |> |> Karaf karaf = Karaf.builder().build();
> |> |> |> |> |> |> karaf.start();
> |> |> |> |> |> |> }
> |> |> |> |> |> |> }
> |> |> |> |> |> |> ###
> |> |> |> |> |> |>
> |> |> |> |> |> |> Best,
> |> |> |> |> |> |>
> |> |> |> |> |> |> -- Jaap
> |> |> |> |> |> |>
> |> |> |> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |> |> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
> |> |> |> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |> |> |> |
> |> |> |> |> |> |> |Hi Jaap,
> |> |> |> |> |> |> |
> |> |> |> |> |> |> |The presentation is available here:
> |> |> |> |> |> |> |
> |> |> |> |> |> |>
> |> |> |> |> |>
> |> |> |> |>
> |> |> |>
> |> |>
> |>
> |||||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEd
> |a
> |> |h
> |> |> |K
> |> |> |> |h
> |> |> |> |> |c
> |> |> |> |> |> |S
> |> |> |> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
> |> |> |> |> |> |> |
> |> |> |> |> |> |> |Karaf 5 WIP is available here:
> |> |> |> |> |> |> |
> |> |> |> |> |> |> |https://github.com/jbonofre/karaf5
> |> |> |> |> |> |> |
> |> |> |> |> |> |> |I'm available on Slack or by email if you wanna chat
> |> |> |> |> |> |> |about
> |> |Karaf5.
> |> |> |> |> |> |> |
> |> |> |> |> |> |> |Regards
> |> |> |> |> |> |> |JB
> |> |> |> |> |> |> |
> |> |> |> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
> |> |> |> |> |> |> |> Hi,
> |> |> |> |> |> |> |>
> |> |> |> |> |> |> |> I have two questions about Karaf 5:
> |> |> |> |> |> |> |> - is the presentation by Onofre at ApacheConf online
> |> |> |somewhere?
> |> |> |> |> |> |> |> - is it possible to explore Karaf 5 (or: what is there right
> |now)?
> |> |> |> |> |> |> |> I am in particular interested in the Spring Boot
> |> |> |> |> |> |> |> functionality, as I have a Spring Boot application
> |> |> |> |> |> |> |> that I want to port to Karaf to support dynamic
> |> |> |> |> |> |> |> loading of components. I have found the github repo
> |> |> |> |> |> |> |> of Onofre, but it is
> |> |> |> |unclear to me how e.g. to start Karaf.
> |> |> |> |> |> |> |>
> |> |> |> |> |> |> |> Best,
> |> |> |> |> |> |> |>
> |> |> |> |> |> |> |> -- Jaap
> |> |> |> |> |> |> |>
> |> |> |> |> |> |>
> |> |> |> |> |>
> |> |> |> |> |>
> |> |> |> |>
> |> |> |> |>
> |> |> |>
> |> |> |>
> |> |>
> |>
> |>
>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
Hi JB,
That sounds interesting!
Is it possible to share what you developed?
Best,
-- Jaap
|-----Oorspronkelijk bericht-----
|Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|Verzonden: donderdag 30 september 2021 11:34
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Hi Jaap,
|
|so, yes, we are talking about the same thing ;)
|
|There are actually two parts:
|
|- registering Spring bean in the K5 service registry and use it in another apps
|running in K5
|- registering "generic" services (like the json-config-loader, extractor, etc) that
|provide shared resources (like HTTP handler)
|
|Regards
|JB
|
|On 29/09/2021 23:30, jgfrm wrote:
|> Perhaps.
|>
|> I want to be able to use a bean in other Spring module.
|>
|> What is also an issue it that two (or more) modules obviously result in two
|sockets to be opened, in my case both 8400.
|> A solution could be to open a different socket per module, e.g. negotiated
|with a module for that purpose that also routes traffic for a particular
|endpoint to the socket of the module handling that endpoint.
|>
|> In https://github.com/hank-cp/sbp (based on pf4j) they have a different
|strategy; there they have one socket for REST calls, and specific endpoints are
|forwarded to the appropriate plugin.
|>
|> Best,
|>
|> -- Jaap
|>
|>
|> |-----Oorspronkelijk bericht-----
|> |Van: JB Onofré <jb...@nanthrax.net>
|> |Verzonden: woensdag 29 september 2021 22:17
|> |Aan: user@karaf.apache.org
|> |Onderwerp: Re: Karaf 5
|> |
|> |I started a service bridge allowing to implicit push some spring bean
|> |to the k5 registry and so that can be used from other modules running
|> |in k5. It’s a local branch for now but I can push it on main.
|> |
|> |Is it what you are looking for ?
|> |
|> |Regards
|> |JB
|> |
|> |> Le 29 sept. 2021 à 21:43, jgfrm <fr...@gordijn.org> a écrit :
|> |>
|> |> Is there already something working for exporting functionality of
|> |> a Spring
|> |modules to other modules?
|> |>
|> |> |-----Oorspronkelijk bericht-----
|> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |Verzonden: woensdag 29 september 2021 17:26
|> |> |Aan: user@karaf.apache.org
|> |> |Onderwerp: Re: Karaf 5
|> |> |
|> |> |Thanks for the update.
|> |> |
|> |> |I'm happy to say you are the first one to "use/launch" Karaf 5 ;)
|> |> |
|> |> |About the TomcatURLStreamHandlerFactory is known "issue":
|> |> |
|> |> |https://github.com/jbonofre/karaf5/blob/main/services/spring-boot-
|> |> |application-
|> |> |manager/src/main/java/org/apache/karaf/springboot/SpringBootApplic
|> |> |ati
|> |> |on
|> |> |ManagerService.java#L110
|> |> |
|> |> |I have to improve this ;)
|> |> |
|> |> |Regards
|> |> |JB
|> |> |
|> |> |On 29/09/2021 17:19, jgfrm wrote:
|> |> |> The following works:
|> |> |>
|> |> |> Karaf.json:
|> |> |> ====
|> |> |> {
|> |> |> "applications": [
|> |> |> {
|> |> |> "name": "e3web",
|> |> |> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
|> |> |> "type": "spring-boot",
|> |> |> "properties": {
|> |> |> "enableHttp": true,
|> |> |> "enablePrometheus": true
|> |> |> }
|> |> |> }
|> |> |> ]
|> |> |> }
|> |> |> ====
|> |> |>
|> |> |> Add to Spring boot application:
|> |> |> ====
|> |> |> @SpringBootApplication
|> |> |> @ComponentScan
|> |> |> public class E3webApplication {
|> |> |>
|> |> |> ...
|> |> |> public static void main(String[] args) {
|> |> |> TomcatURLStreamHandlerFactory.disable(); // see
|> |> |https://github.com/spring-projects/spring-boot/issues/21535
|> |> |> SpringApplication.run(E3webApplication.class, args);
|> |> |> }
|> |> |> ====
|> |> |>
|> |> |> Start with
|> |> |> java --add-modules jdk.security.jgss -cp
|> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-
|> |> |> tes
|> |> |> t-1
|> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manag
|> |> |> er/ tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> |> -Dkaraf.config=src/main/resources/karaf.json
|> |> |> org.apache.karaf.boot.Main
|> |> |>
|> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |Van: JB Onofré <jb...@nanthrax.net>
|> |> |> |Verzonden: dinsdag 28 september 2021 06:34
|> |> |> |Aan: user@karaf.apache.org
|> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |
|> |> |> |Hi
|> |> |> |
|> |> |> |No it’s not this because k5 don’t use OSGi for the spring boot
|> |> |> |launcher. I still think it’s a missing add modules as Jvm arg.
|> |> |> |I will check
|> |> |today.
|> |> |> |
|> |> |> |Regards
|> |> |> |JB
|> |> |> |
|> |> |> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |>
|> |> |> |> While Googling, I came across on of your blogs
|> |> |> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf
|> |> |> |-
|> |> |> |431.html) that one of the changes in Karaf was to export the
|> |> |> |java.*
|> |> |packages.
|> |> |> |Could that be the cause?
|> |> |> |>
|> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |> |> |Verzonden: zondag 26 september 2021 18:02
|> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |
|> |> |> |> |Hi
|> |> |> |> |
|> |> |> |> |No sure, it’s only class loader issue. I remember this issue
|> |> |> |> |in pure spring boot with JDK11.
|> |> |> |> |
|> |> |> |> |Let me check.
|> |> |> |> |
|> |> |> |> |Regards
|> |> |> |> |JB
|> |> |> |> |
|> |> |> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |> |>
|> |> |> |> |> Hi JB,
|> |> |> |> |>
|> |> |> |> |> Fully understand that it is still work in progress.
|> |> |> |> |>
|> |> |> |> |> Regarding the .NoClassDefFoundError:
|> |> |> |> |> org/ietf/jgss/GSSException --add-modules
|> |> |> |> |> java.security.jgss does
|> |not solve it?
|> |> |> |> |> Is it a class loader problem?
|> |> |> |> |>
|> |> |> |> |> Best,
|> |> |> |> |>
|> |> |> |> |> -- Jaap
|> |> |> |> |>
|> |> |> |> |>
|> |> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |> |> |> |Verzonden: zondag 26 september 2021 14:20
|> |> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |> |
|> |> |> |> |> |Hi Jaap,
|> |> |> |> |> |
|> |> |> |> |> |First, maybe I was not clean in my presentation: Karaf 5
|> |> |> |> |> |is still under development and so, everything is not yet ready.
|> |> |> |> |> |As said, I will “move” the code to Apache Karaf repo as
|> |> |> |> |> |soon as I consider I have something clean and running.
|> |> |> |> |> |
|> |> |> |> |> |Anyway, about your email, I will check. Today my focus is
|> |> |> |> |> |on the OsgiApplicationManager to be Karaf 4 compliant.
|> |> |> |> |> |I also have to improve the Karaf Config service.
|> |> |> |> |> |
|> |> |> |> |> |By the way, you don’t need your own Main, just use the
|> |> |> |> |> |repackage with regular provided Main (you can take a look
|> |> |> |> |> |on the K4 assembly repackage as an example). I will
|> |> |> |> |> |create a gradle/maven plugin with
|> |> |> |> |repackage.
|> |> |> |> |> |
|> |> |> |> |> |Regarding your issue, as you are running with JDK11, I
|> |> |> |> |> |guess you have to add -- add-modules java.security.jgss
|> |> |> |> |> |to avoid the
|> |> |> |> |NoClassDefFoundException.
|> |> |> |> |> |
|> |> |> |> |> |Thanks anyway for your feedback, much appreciated.
|> |> |> |> |> |
|> |> |> |> |> |Regards
|> |> |> |> |> |JB
|> |> |> |> |> |
|> |> |> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |> |> |>
|> |> |> |> |> |> Hi Jean-Baptiste,
|> |> |> |> |> |>
|> |> |> |> |> |> I managed to start (well not completely) my spring application.
|> |> |> |> |> |> However, while starting up, I get an exception:
|> |> |> |> |> |>
|> |> |> |> |> |> 11:43:03.148 [main] ERROR
|> |> |> |> |> |> o.s.boot.SpringApplication:837 - Application run failed
|> |> |> |> |> |> org.springframework.context.ApplicationContextException:
|> |> |> |> |> |> Unable to start web server; nested exception is
|> |> |> |java.lang.NoClassDefFoundError:
|> |> |> |> |> |> org/ietf/jgss/GSSException
|> |> |> |> |> |>
|> |> |> |> |> |> Any ideas?
|> |> |> |> |> |>
|> |> |> |> |> |> Also, I had to make modifications in
|> |> |> |> |> |SpringBootApplicationManagerService/start:
|> |> |> |> |> |>
|> |> |> |> |> |> try {
|> |> |> |> |> |>
|> |Thread.currentThread().setContextClassLoader(classLoader);
|> |> |> |> |> |> // disable tomcat stream handler
|> |> |> |> |> |> /* There is no TomcatURLStreamHandlerFactory
|> |> |> |> |> |> in my spring
|> |> |jar
|> |> |> |> |> |> final Method tomcat =
|> |> |> |> |> |classLoader.loadClass("org.apache.catalina.webresources.T
|> |> |> |> |> |omc atU RLS tre am HandlerFactory").getMethod("disable");
|> |> |> |> |> |> if (!tomcat.isBridge()) {
|> |> |> |> |> |> tomcat.setAccessible(true);
|> |> |> |> |> |> }
|> |> |> |> |> |> tomcat.invoke(null, null);
|> |> |> |> |> |> */
|> |> |> |> |> |> // invoke spring boot main
|> |> |> |> |> |> final Method main =
|> |> |> |> |>
|> |>
|||classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
|> |> |> |> |> |getM
|> |> |> |> |> |ethod("main", String[].class);
|> |> |> |> |> |> main.setAccessible(true);
|> |> |> |> |> |> log.info("Call JarLauncher");
|> |> |> |> |> |> if (properties.get("args") != null) {
|> |> |> |> |> |> log.info("Call JarLauncher with args");
|> |> |> |> |> |> main.invoke(null, new Object[]{ properties.get("args")
|});
|> |> |> |> |> |> } else {
|> |> |> |> |> |> log.info("Call JarLauncher without args");
|> |> |> |> |> |> main.invoke(null, new Object[]{new
|> |> |> |> |> |> String[0]}); // the original invoke
|> |> |> |> |> |did not work for me
|> |> |> |> |> |> }
|> |> |> |> |> |> } finally {
|> |> |> |> |> |> Thread.currentThread().setContextClassLoader(original);
|> |> |> |> |> |> }
|> |> |> |> |> |>
|> |> |> |> |> |> Further details:
|> |> |> |> |> |> - openjdk version "11.0.12" 2021-07-20
|> |> |> |> |> |> - invocation:
|> |> |> |> |> |> java -cp
|> |> |> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:targ
|> |> |> |> |> |> et/
|> |> |> |> |> |> e3w
|> |> |> |> |> |> eb-
|> |> |> |> |> |> tes
|> |> |> |> |> |> t-1
|> |> |> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-applicat
|> |> |> |> |> |> ion
|> |> |> |> |> |> -ma
|> |> |> |> |> |> nag er/ tar
|> |> |> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> |> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
|> |> |> |> |> |>
|> |> |> |> |> |> Main.java:
|> |> |> |> |> |> ###
|> |> |> |> |> |> public class Main {
|> |> |> |> |> |> public static void main(String[] args){
|> |> |> |> |> |> System.out.println("Starting Karaf");
|> |> |> |> |> |> Karaf karaf = Karaf.builder().build();
|> |> |> |> |> |> karaf.start();
|> |> |> |> |> |> }
|> |> |> |> |> |> }
|> |> |> |> |> |> ###
|> |> |> |> |> |>
|> |> |> |> |> |> Best,
|> |> |> |> |> |>
|> |> |> |> |> |> -- Jaap
|> |> |> |> |> |>
|> |> |> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
|> |> |> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |> |> |
|> |> |> |> |> |> |Hi Jaap,
|> |> |> |> |> |> |
|> |> |> |> |> |> |The presentation is available here:
|> |> |> |> |> |> |
|> |> |> |> |> |>
|> |> |> |> |>
|> |> |> |>
|> |> |>
|> |>
|>
|||||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEd
|a
|> |h
|> |> |K
|> |> |> |h
|> |> |> |> |c
|> |> |> |> |> |S
|> |> |> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
|> |> |> |> |> |> |
|> |> |> |> |> |> |Karaf 5 WIP is available here:
|> |> |> |> |> |> |
|> |> |> |> |> |> |https://github.com/jbonofre/karaf5
|> |> |> |> |> |> |
|> |> |> |> |> |> |I'm available on Slack or by email if you wanna chat
|> |> |> |> |> |> |about
|> |Karaf5.
|> |> |> |> |> |> |
|> |> |> |> |> |> |Regards
|> |> |> |> |> |> |JB
|> |> |> |> |> |> |
|> |> |> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
|> |> |> |> |> |> |> Hi,
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> I have two questions about Karaf 5:
|> |> |> |> |> |> |> - is the presentation by Onofre at ApacheConf online
|> |> |somewhere?
|> |> |> |> |> |> |> - is it possible to explore Karaf 5 (or: what is there right
|now)?
|> |> |> |> |> |> |> I am in particular interested in the Spring Boot
|> |> |> |> |> |> |> functionality, as I have a Spring Boot application
|> |> |> |> |> |> |> that I want to port to Karaf to support dynamic
|> |> |> |> |> |> |> loading of components. I have found the github repo
|> |> |> |> |> |> |> of Onofre, but it is
|> |> |> |unclear to me how e.g. to start Karaf.
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> Best,
|> |> |> |> |> |> |>
|> |> |> |> |> |> |> -- Jaap
|> |> |> |> |> |> |>
|> |> |> |> |> |>
|> |> |> |> |>
|> |> |> |> |>
|> |> |> |>
|> |> |> |>
|> |> |>
|> |> |>
|> |>
|>
|>
Re: Karaf 5
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jaap,
so, yes, we are talking about the same thing ;)
There are actually two parts:
- registering Spring bean in the K5 service registry and use it in
another apps running in K5
- registering "generic" services (like the json-config-loader,
extractor, etc) that provide shared resources (like HTTP handler)
Regards
JB
On 29/09/2021 23:30, jgfrm wrote:
> Perhaps.
>
> I want to be able to use a bean in other Spring module.
>
> What is also an issue it that two (or more) modules obviously result in two sockets to be opened, in my case both 8400.
> A solution could be to open a different socket per module, e.g. negotiated with a module for that purpose that also routes traffic for a particular endpoint to the socket of the module handling that endpoint.
>
> In https://github.com/hank-cp/sbp (based on pf4j) they have a different strategy; there they have one socket for REST calls, and specific endpoints are forwarded to the appropriate plugin.
>
> Best,
>
> -- Jaap
>
>
> |-----Oorspronkelijk bericht-----
> |Van: JB Onofré <jb...@nanthrax.net>
> |Verzonden: woensdag 29 september 2021 22:17
> |Aan: user@karaf.apache.org
> |Onderwerp: Re: Karaf 5
> |
> |I started a service bridge allowing to implicit push some spring bean to the k5
> |registry and so that can be used from other modules running in k5. It’s a local
> |branch for now but I can push it on main.
> |
> |Is it what you are looking for ?
> |
> |Regards
> |JB
> |
> |> Le 29 sept. 2021 à 21:43, jgfrm <fr...@gordijn.org> a écrit :
> |>
> |> Is there already something working for exporting functionality of a Spring
> |modules to other modules?
> |>
> |> |-----Oorspronkelijk bericht-----
> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |Verzonden: woensdag 29 september 2021 17:26
> |> |Aan: user@karaf.apache.org
> |> |Onderwerp: Re: Karaf 5
> |> |
> |> |Thanks for the update.
> |> |
> |> |I'm happy to say you are the first one to "use/launch" Karaf 5 ;)
> |> |
> |> |About the TomcatURLStreamHandlerFactory is known "issue":
> |> |
> |> |https://github.com/jbonofre/karaf5/blob/main/services/spring-boot-
> |> |application-
> |> |manager/src/main/java/org/apache/karaf/springboot/SpringBootApplicati
> |> |on
> |> |ManagerService.java#L110
> |> |
> |> |I have to improve this ;)
> |> |
> |> |Regards
> |> |JB
> |> |
> |> |On 29/09/2021 17:19, jgfrm wrote:
> |> |> The following works:
> |> |>
> |> |> Karaf.json:
> |> |> ====
> |> |> {
> |> |> "applications": [
> |> |> {
> |> |> "name": "e3web",
> |> |> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
> |> |> "type": "spring-boot",
> |> |> "properties": {
> |> |> "enableHttp": true,
> |> |> "enablePrometheus": true
> |> |> }
> |> |> }
> |> |> ]
> |> |> }
> |> |> ====
> |> |>
> |> |> Add to Spring boot application:
> |> |> ====
> |> |> @SpringBootApplication
> |> |> @ComponentScan
> |> |> public class E3webApplication {
> |> |>
> |> |> ...
> |> |> public static void main(String[] args) {
> |> |> TomcatURLStreamHandlerFactory.disable(); // see
> |> |https://github.com/spring-projects/spring-boot/issues/21535
> |> |> SpringApplication.run(E3webApplication.class, args);
> |> |> }
> |> |> ====
> |> |>
> |> |> Start with
> |> |> java --add-modules jdk.security.jgss -cp
> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-tes
> |> |> t-1
> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/
> |> |> tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> |> -Dkaraf.config=src/main/resources/karaf.json
> |> |> org.apache.karaf.boot.Main
> |> |>
> |> |> |-----Oorspronkelijk bericht-----
> |> |> |Van: JB Onofré <jb...@nanthrax.net>
> |> |> |Verzonden: dinsdag 28 september 2021 06:34
> |> |> |Aan: user@karaf.apache.org
> |> |> |Onderwerp: Re: Karaf 5
> |> |> |
> |> |> |Hi
> |> |> |
> |> |> |No it’s not this because k5 don’t use OSGi for the spring boot
> |> |> |launcher. I still think it’s a missing add modules as Jvm arg. I
> |> |> |will check
> |> |today.
> |> |> |
> |> |> |Regards
> |> |> |JB
> |> |> |
> |> |> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |>
> |> |> |> While Googling, I came across on of your blogs
> |> |> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-
> |> |> |431.html) that one of the changes in Karaf was to export the
> |> |> |java.*
> |> |packages.
> |> |> |Could that be the cause?
> |> |> |>
> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |> |> |Verzonden: zondag 26 september 2021 18:02
> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |
> |> |> |> |Hi
> |> |> |> |
> |> |> |> |No sure, it’s only class loader issue. I remember this issue in
> |> |> |> |pure spring boot with JDK11.
> |> |> |> |
> |> |> |> |Let me check.
> |> |> |> |
> |> |> |> |Regards
> |> |> |> |JB
> |> |> |> |
> |> |> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |> |>
> |> |> |> |> Hi JB,
> |> |> |> |>
> |> |> |> |> Fully understand that it is still work in progress.
> |> |> |> |>
> |> |> |> |> Regarding the .NoClassDefFoundError:
> |> |> |> |> org/ietf/jgss/GSSException --add-modules java.security.jgss does
> |not solve it?
> |> |> |> |> Is it a class loader problem?
> |> |> |> |>
> |> |> |> |> Best,
> |> |> |> |>
> |> |> |> |> -- Jaap
> |> |> |> |>
> |> |> |> |>
> |> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |> |> |> |Verzonden: zondag 26 september 2021 14:20
> |> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |> |
> |> |> |> |> |Hi Jaap,
> |> |> |> |> |
> |> |> |> |> |First, maybe I was not clean in my presentation: Karaf 5 is
> |> |> |> |> |still under development and so, everything is not yet ready.
> |> |> |> |> |As said, I will “move” the code to Apache Karaf repo as soon
> |> |> |> |> |as I consider I have something clean and running.
> |> |> |> |> |
> |> |> |> |> |Anyway, about your email, I will check. Today my focus is on
> |> |> |> |> |the OsgiApplicationManager to be Karaf 4 compliant.
> |> |> |> |> |I also have to improve the Karaf Config service.
> |> |> |> |> |
> |> |> |> |> |By the way, you don’t need your own Main, just use the
> |> |> |> |> |repackage with regular provided Main (you can take a look on
> |> |> |> |> |the K4 assembly repackage as an example). I will create a
> |> |> |> |> |gradle/maven plugin with
> |> |> |> |repackage.
> |> |> |> |> |
> |> |> |> |> |Regarding your issue, as you are running with JDK11, I guess
> |> |> |> |> |you have to add -- add-modules java.security.jgss to avoid
> |> |> |> |> |the
> |> |> |> |NoClassDefFoundException.
> |> |> |> |> |
> |> |> |> |> |Thanks anyway for your feedback, much appreciated.
> |> |> |> |> |
> |> |> |> |> |Regards
> |> |> |> |> |JB
> |> |> |> |> |
> |> |> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |> |> |>
> |> |> |> |> |> Hi Jean-Baptiste,
> |> |> |> |> |>
> |> |> |> |> |> I managed to start (well not completely) my spring application.
> |> |> |> |> |> However, while starting up, I get an exception:
> |> |> |> |> |>
> |> |> |> |> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
> |> |> |> |> |> Application run failed
> |> |> |> |> |> org.springframework.context.ApplicationContextException:
> |> |> |> |> |> Unable to start web server; nested exception is
> |> |> |java.lang.NoClassDefFoundError:
> |> |> |> |> |> org/ietf/jgss/GSSException
> |> |> |> |> |>
> |> |> |> |> |> Any ideas?
> |> |> |> |> |>
> |> |> |> |> |> Also, I had to make modifications in
> |> |> |> |> |SpringBootApplicationManagerService/start:
> |> |> |> |> |>
> |> |> |> |> |> try {
> |> |> |> |> |>
> |Thread.currentThread().setContextClassLoader(classLoader);
> |> |> |> |> |> // disable tomcat stream handler
> |> |> |> |> |> /* There is no TomcatURLStreamHandlerFactory in
> |> |> |> |> |> my spring
> |> |jar
> |> |> |> |> |> final Method tomcat =
> |> |> |> |> |classLoader.loadClass("org.apache.catalina.webresources.Tomc
> |> |> |> |> |atU RLS tre am HandlerFactory").getMethod("disable");
> |> |> |> |> |> if (!tomcat.isBridge()) {
> |> |> |> |> |> tomcat.setAccessible(true);
> |> |> |> |> |> }
> |> |> |> |> |> tomcat.invoke(null, null);
> |> |> |> |> |> */
> |> |> |> |> |> // invoke spring boot main
> |> |> |> |> |> final Method main =
> |> |> |> |>
> |> ||classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
> |> |> |> |> |getM
> |> |> |> |> |ethod("main", String[].class);
> |> |> |> |> |> main.setAccessible(true);
> |> |> |> |> |> log.info("Call JarLauncher");
> |> |> |> |> |> if (properties.get("args") != null) {
> |> |> |> |> |> log.info("Call JarLauncher with args");
> |> |> |> |> |> main.invoke(null, new Object[]{ properties.get("args") });
> |> |> |> |> |> } else {
> |> |> |> |> |> log.info("Call JarLauncher without args");
> |> |> |> |> |> main.invoke(null, new Object[]{new
> |> |> |> |> |> String[0]}); // the original invoke
> |> |> |> |> |did not work for me
> |> |> |> |> |> }
> |> |> |> |> |> } finally {
> |> |> |> |> |> Thread.currentThread().setContextClassLoader(original);
> |> |> |> |> |> }
> |> |> |> |> |>
> |> |> |> |> |> Further details:
> |> |> |> |> |> - openjdk version "11.0.12" 2021-07-20
> |> |> |> |> |> - invocation:
> |> |> |> |> |> java -cp
> |> |> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/
> |> |> |> |> |> e3w
> |> |> |> |> |> eb-
> |> |> |> |> |> tes
> |> |> |> |> |> t-1
> |> |> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application
> |> |> |> |> |> -ma
> |> |> |> |> |> nag er/ tar
> |> |> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> |> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
> |> |> |> |> |>
> |> |> |> |> |> Main.java:
> |> |> |> |> |> ###
> |> |> |> |> |> public class Main {
> |> |> |> |> |> public static void main(String[] args){
> |> |> |> |> |> System.out.println("Starting Karaf");
> |> |> |> |> |> Karaf karaf = Karaf.builder().build();
> |> |> |> |> |> karaf.start();
> |> |> |> |> |> }
> |> |> |> |> |> }
> |> |> |> |> |> ###
> |> |> |> |> |>
> |> |> |> |> |> Best,
> |> |> |> |> |>
> |> |> |> |> |> -- Jaap
> |> |> |> |> |>
> |> |> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
> |> |> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |> |> |
> |> |> |> |> |> |Hi Jaap,
> |> |> |> |> |> |
> |> |> |> |> |> |The presentation is available here:
> |> |> |> |> |> |
> |> |> |> |> |>
> |> |> |> |>
> |> |> |>
> |> |>
> |>
> ||||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEda
> |h
> |> |K
> |> |> |h
> |> |> |> |c
> |> |> |> |> |S
> |> |> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
> |> |> |> |> |> |
> |> |> |> |> |> |Karaf 5 WIP is available here:
> |> |> |> |> |> |
> |> |> |> |> |> |https://github.com/jbonofre/karaf5
> |> |> |> |> |> |
> |> |> |> |> |> |I'm available on Slack or by email if you wanna chat about
> |Karaf5.
> |> |> |> |> |> |
> |> |> |> |> |> |Regards
> |> |> |> |> |> |JB
> |> |> |> |> |> |
> |> |> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
> |> |> |> |> |> |> Hi,
> |> |> |> |> |> |>
> |> |> |> |> |> |> I have two questions about Karaf 5:
> |> |> |> |> |> |> - is the presentation by Onofre at ApacheConf online
> |> |somewhere?
> |> |> |> |> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
> |> |> |> |> |> |> I am in particular interested in the Spring Boot
> |> |> |> |> |> |> functionality, as I have a Spring Boot application that
> |> |> |> |> |> |> I want to port to Karaf to support dynamic loading of
> |> |> |> |> |> |> components. I have found the github repo of Onofre, but
> |> |> |> |> |> |> it is
> |> |> |unclear to me how e.g. to start Karaf.
> |> |> |> |> |> |>
> |> |> |> |> |> |> Best,
> |> |> |> |> |> |>
> |> |> |> |> |> |> -- Jaap
> |> |> |> |> |> |>
> |> |> |> |> |>
> |> |> |> |>
> |> |> |> |>
> |> |> |>
> |> |> |>
> |> |>
> |> |>
> |>
>
>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
Perhaps.
I want to be able to use a bean in other Spring module.
What is also an issue it that two (or more) modules obviously result in two sockets to be opened, in my case both 8400.
A solution could be to open a different socket per module, e.g. negotiated with a module for that purpose that also routes traffic for a particular endpoint to the socket of the module handling that endpoint.
In https://github.com/hank-cp/sbp (based on pf4j) they have a different strategy; there they have one socket for REST calls, and specific endpoints are forwarded to the appropriate plugin.
Best,
-- Jaap
|-----Oorspronkelijk bericht-----
|Van: JB Onofré <jb...@nanthrax.net>
|Verzonden: woensdag 29 september 2021 22:17
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|I started a service bridge allowing to implicit push some spring bean to the k5
|registry and so that can be used from other modules running in k5. It’s a local
|branch for now but I can push it on main.
|
|Is it what you are looking for ?
|
|Regards
|JB
|
|> Le 29 sept. 2021 à 21:43, jgfrm <fr...@gordijn.org> a écrit :
|>
|> Is there already something working for exporting functionality of a Spring
|modules to other modules?
|>
|> |-----Oorspronkelijk bericht-----
|> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |Verzonden: woensdag 29 september 2021 17:26
|> |Aan: user@karaf.apache.org
|> |Onderwerp: Re: Karaf 5
|> |
|> |Thanks for the update.
|> |
|> |I'm happy to say you are the first one to "use/launch" Karaf 5 ;)
|> |
|> |About the TomcatURLStreamHandlerFactory is known "issue":
|> |
|> |https://github.com/jbonofre/karaf5/blob/main/services/spring-boot-
|> |application-
|> |manager/src/main/java/org/apache/karaf/springboot/SpringBootApplicati
|> |on
|> |ManagerService.java#L110
|> |
|> |I have to improve this ;)
|> |
|> |Regards
|> |JB
|> |
|> |On 29/09/2021 17:19, jgfrm wrote:
|> |> The following works:
|> |>
|> |> Karaf.json:
|> |> ====
|> |> {
|> |> "applications": [
|> |> {
|> |> "name": "e3web",
|> |> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
|> |> "type": "spring-boot",
|> |> "properties": {
|> |> "enableHttp": true,
|> |> "enablePrometheus": true
|> |> }
|> |> }
|> |> ]
|> |> }
|> |> ====
|> |>
|> |> Add to Spring boot application:
|> |> ====
|> |> @SpringBootApplication
|> |> @ComponentScan
|> |> public class E3webApplication {
|> |>
|> |> ...
|> |> public static void main(String[] args) {
|> |> TomcatURLStreamHandlerFactory.disable(); // see
|> |https://github.com/spring-projects/spring-boot/issues/21535
|> |> SpringApplication.run(E3webApplication.class, args);
|> |> }
|> |> ====
|> |>
|> |> Start with
|> |> java --add-modules jdk.security.jgss -cp
|> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-tes
|> |> t-1
|> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/
|> |> tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> -Dkaraf.config=src/main/resources/karaf.json
|> |> org.apache.karaf.boot.Main
|> |>
|> |> |-----Oorspronkelijk bericht-----
|> |> |Van: JB Onofré <jb...@nanthrax.net>
|> |> |Verzonden: dinsdag 28 september 2021 06:34
|> |> |Aan: user@karaf.apache.org
|> |> |Onderwerp: Re: Karaf 5
|> |> |
|> |> |Hi
|> |> |
|> |> |No it’s not this because k5 don’t use OSGi for the spring boot
|> |> |launcher. I still think it’s a missing add modules as Jvm arg. I
|> |> |will check
|> |today.
|> |> |
|> |> |Regards
|> |> |JB
|> |> |
|> |> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
|> |> |>
|> |> |> While Googling, I came across on of your blogs
|> |> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-
|> |> |431.html) that one of the changes in Karaf was to export the
|> |> |java.*
|> |packages.
|> |> |Could that be the cause?
|> |> |>
|> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |> |Verzonden: zondag 26 september 2021 18:02
|> |> |> |Aan: user@karaf.apache.org
|> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |
|> |> |> |Hi
|> |> |> |
|> |> |> |No sure, it’s only class loader issue. I remember this issue in
|> |> |> |pure spring boot with JDK11.
|> |> |> |
|> |> |> |Let me check.
|> |> |> |
|> |> |> |Regards
|> |> |> |JB
|> |> |> |
|> |> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |>
|> |> |> |> Hi JB,
|> |> |> |>
|> |> |> |> Fully understand that it is still work in progress.
|> |> |> |>
|> |> |> |> Regarding the .NoClassDefFoundError:
|> |> |> |> org/ietf/jgss/GSSException --add-modules java.security.jgss does
|not solve it?
|> |> |> |> Is it a class loader problem?
|> |> |> |>
|> |> |> |> Best,
|> |> |> |>
|> |> |> |> -- Jaap
|> |> |> |>
|> |> |> |>
|> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |> |> |Verzonden: zondag 26 september 2021 14:20
|> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |
|> |> |> |> |Hi Jaap,
|> |> |> |> |
|> |> |> |> |First, maybe I was not clean in my presentation: Karaf 5 is
|> |> |> |> |still under development and so, everything is not yet ready.
|> |> |> |> |As said, I will “move” the code to Apache Karaf repo as soon
|> |> |> |> |as I consider I have something clean and running.
|> |> |> |> |
|> |> |> |> |Anyway, about your email, I will check. Today my focus is on
|> |> |> |> |the OsgiApplicationManager to be Karaf 4 compliant.
|> |> |> |> |I also have to improve the Karaf Config service.
|> |> |> |> |
|> |> |> |> |By the way, you don’t need your own Main, just use the
|> |> |> |> |repackage with regular provided Main (you can take a look on
|> |> |> |> |the K4 assembly repackage as an example). I will create a
|> |> |> |> |gradle/maven plugin with
|> |> |> |repackage.
|> |> |> |> |
|> |> |> |> |Regarding your issue, as you are running with JDK11, I guess
|> |> |> |> |you have to add -- add-modules java.security.jgss to avoid
|> |> |> |> |the
|> |> |> |NoClassDefFoundException.
|> |> |> |> |
|> |> |> |> |Thanks anyway for your feedback, much appreciated.
|> |> |> |> |
|> |> |> |> |Regards
|> |> |> |> |JB
|> |> |> |> |
|> |> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |> |>
|> |> |> |> |> Hi Jean-Baptiste,
|> |> |> |> |>
|> |> |> |> |> I managed to start (well not completely) my spring application.
|> |> |> |> |> However, while starting up, I get an exception:
|> |> |> |> |>
|> |> |> |> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
|> |> |> |> |> Application run failed
|> |> |> |> |> org.springframework.context.ApplicationContextException:
|> |> |> |> |> Unable to start web server; nested exception is
|> |> |java.lang.NoClassDefFoundError:
|> |> |> |> |> org/ietf/jgss/GSSException
|> |> |> |> |>
|> |> |> |> |> Any ideas?
|> |> |> |> |>
|> |> |> |> |> Also, I had to make modifications in
|> |> |> |> |SpringBootApplicationManagerService/start:
|> |> |> |> |>
|> |> |> |> |> try {
|> |> |> |> |>
|Thread.currentThread().setContextClassLoader(classLoader);
|> |> |> |> |> // disable tomcat stream handler
|> |> |> |> |> /* There is no TomcatURLStreamHandlerFactory in
|> |> |> |> |> my spring
|> |jar
|> |> |> |> |> final Method tomcat =
|> |> |> |> |classLoader.loadClass("org.apache.catalina.webresources.Tomc
|> |> |> |> |atU RLS tre am HandlerFactory").getMethod("disable");
|> |> |> |> |> if (!tomcat.isBridge()) {
|> |> |> |> |> tomcat.setAccessible(true);
|> |> |> |> |> }
|> |> |> |> |> tomcat.invoke(null, null);
|> |> |> |> |> */
|> |> |> |> |> // invoke spring boot main
|> |> |> |> |> final Method main =
|> |> |> |>
|> ||classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
|> |> |> |> |getM
|> |> |> |> |ethod("main", String[].class);
|> |> |> |> |> main.setAccessible(true);
|> |> |> |> |> log.info("Call JarLauncher");
|> |> |> |> |> if (properties.get("args") != null) {
|> |> |> |> |> log.info("Call JarLauncher with args");
|> |> |> |> |> main.invoke(null, new Object[]{ properties.get("args") });
|> |> |> |> |> } else {
|> |> |> |> |> log.info("Call JarLauncher without args");
|> |> |> |> |> main.invoke(null, new Object[]{new
|> |> |> |> |> String[0]}); // the original invoke
|> |> |> |> |did not work for me
|> |> |> |> |> }
|> |> |> |> |> } finally {
|> |> |> |> |> Thread.currentThread().setContextClassLoader(original);
|> |> |> |> |> }
|> |> |> |> |>
|> |> |> |> |> Further details:
|> |> |> |> |> - openjdk version "11.0.12" 2021-07-20
|> |> |> |> |> - invocation:
|> |> |> |> |> java -cp
|> |> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/
|> |> |> |> |> e3w
|> |> |> |> |> eb-
|> |> |> |> |> tes
|> |> |> |> |> t-1
|> |> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application
|> |> |> |> |> -ma
|> |> |> |> |> nag er/ tar
|> |> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
|> |> |> |> |>
|> |> |> |> |> Main.java:
|> |> |> |> |> ###
|> |> |> |> |> public class Main {
|> |> |> |> |> public static void main(String[] args){
|> |> |> |> |> System.out.println("Starting Karaf");
|> |> |> |> |> Karaf karaf = Karaf.builder().build();
|> |> |> |> |> karaf.start();
|> |> |> |> |> }
|> |> |> |> |> }
|> |> |> |> |> ###
|> |> |> |> |>
|> |> |> |> |> Best,
|> |> |> |> |>
|> |> |> |> |> -- Jaap
|> |> |> |> |>
|> |> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
|> |> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |> |
|> |> |> |> |> |Hi Jaap,
|> |> |> |> |> |
|> |> |> |> |> |The presentation is available here:
|> |> |> |> |> |
|> |> |> |> |>
|> |> |> |>
|> |> |>
|> |>
|>
||||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEda
|h
|> |K
|> |> |h
|> |> |> |c
|> |> |> |> |S
|> |> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
|> |> |> |> |> |
|> |> |> |> |> |Karaf 5 WIP is available here:
|> |> |> |> |> |
|> |> |> |> |> |https://github.com/jbonofre/karaf5
|> |> |> |> |> |
|> |> |> |> |> |I'm available on Slack or by email if you wanna chat about
|Karaf5.
|> |> |> |> |> |
|> |> |> |> |> |Regards
|> |> |> |> |> |JB
|> |> |> |> |> |
|> |> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
|> |> |> |> |> |> Hi,
|> |> |> |> |> |>
|> |> |> |> |> |> I have two questions about Karaf 5:
|> |> |> |> |> |> - is the presentation by Onofre at ApacheConf online
|> |somewhere?
|> |> |> |> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
|> |> |> |> |> |> I am in particular interested in the Spring Boot
|> |> |> |> |> |> functionality, as I have a Spring Boot application that
|> |> |> |> |> |> I want to port to Karaf to support dynamic loading of
|> |> |> |> |> |> components. I have found the github repo of Onofre, but
|> |> |> |> |> |> it is
|> |> |unclear to me how e.g. to start Karaf.
|> |> |> |> |> |>
|> |> |> |> |> |> Best,
|> |> |> |> |> |>
|> |> |> |> |> |> -- Jaap
|> |> |> |> |> |>
|> |> |> |> |>
|> |> |> |>
|> |> |> |>
|> |> |>
|> |> |>
|> |>
|> |>
|>
Re: Karaf 5
Posted by JB Onofré <jb...@nanthrax.net>.
I started a service bridge allowing to implicit push some spring bean to the k5 registry and so that can be used from other modules running in k5. It’s a local branch for now but I can push it on main.
Is it what you are looking for ?
Regards
JB
> Le 29 sept. 2021 à 21:43, jgfrm <fr...@gordijn.org> a écrit :
>
> Is there already something working for exporting functionality of a Spring modules to other modules?
>
> |-----Oorspronkelijk bericht-----
> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |Verzonden: woensdag 29 september 2021 17:26
> |Aan: user@karaf.apache.org
> |Onderwerp: Re: Karaf 5
> |
> |Thanks for the update.
> |
> |I'm happy to say you are the first one to "use/launch" Karaf 5 ;)
> |
> |About the TomcatURLStreamHandlerFactory is known "issue":
> |
> |https://github.com/jbonofre/karaf5/blob/main/services/spring-boot-
> |application-
> |manager/src/main/java/org/apache/karaf/springboot/SpringBootApplication
> |ManagerService.java#L110
> |
> |I have to improve this ;)
> |
> |Regards
> |JB
> |
> |On 29/09/2021 17:19, jgfrm wrote:
> |> The following works:
> |>
> |> Karaf.json:
> |> ====
> |> {
> |> "applications": [
> |> {
> |> "name": "e3web",
> |> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
> |> "type": "spring-boot",
> |> "properties": {
> |> "enableHttp": true,
> |> "enablePrometheus": true
> |> }
> |> }
> |> ]
> |> }
> |> ====
> |>
> |> Add to Spring boot application:
> |> ====
> |> @SpringBootApplication
> |> @ComponentScan
> |> public class E3webApplication {
> |>
> |> ...
> |> public static void main(String[] args) {
> |> TomcatURLStreamHandlerFactory.disable(); // see
> |https://github.com/spring-projects/spring-boot/issues/21535
> |> SpringApplication.run(E3webApplication.class, args);
> |> }
> |> ====
> |>
> |> Start with
> |> java --add-modules jdk.security.jgss -cp
> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1
> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/tar
> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> -Dkaraf.config=src/main/resources/karaf.json
> |> org.apache.karaf.boot.Main
> |>
> |> |-----Oorspronkelijk bericht-----
> |> |Van: JB Onofré <jb...@nanthrax.net>
> |> |Verzonden: dinsdag 28 september 2021 06:34
> |> |Aan: user@karaf.apache.org
> |> |Onderwerp: Re: Karaf 5
> |> |
> |> |Hi
> |> |
> |> |No it’s not this because k5 don’t use OSGi for the spring boot
> |> |launcher. I still think it’s a missing add modules as Jvm arg. I will check
> |today.
> |> |
> |> |Regards
> |> |JB
> |> |
> |> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
> |> |>
> |> |> While Googling, I came across on of your blogs
> |> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-
> |> |431.html) that one of the changes in Karaf was to export the java.*
> |packages.
> |> |Could that be the cause?
> |> |>
> |> |> |-----Oorspronkelijk bericht-----
> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |> |Verzonden: zondag 26 september 2021 18:02
> |> |> |Aan: user@karaf.apache.org
> |> |> |Onderwerp: Re: Karaf 5
> |> |> |
> |> |> |Hi
> |> |> |
> |> |> |No sure, it’s only class loader issue. I remember this issue in
> |> |> |pure spring boot with JDK11.
> |> |> |
> |> |> |Let me check.
> |> |> |
> |> |> |Regards
> |> |> |JB
> |> |> |
> |> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |>
> |> |> |> Hi JB,
> |> |> |>
> |> |> |> Fully understand that it is still work in progress.
> |> |> |>
> |> |> |> Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
> |> |> |> --add-modules java.security.jgss does not solve it?
> |> |> |> Is it a class loader problem?
> |> |> |>
> |> |> |> Best,
> |> |> |>
> |> |> |> -- Jaap
> |> |> |>
> |> |> |>
> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |> |> |Verzonden: zondag 26 september 2021 14:20
> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |
> |> |> |> |Hi Jaap,
> |> |> |> |
> |> |> |> |First, maybe I was not clean in my presentation: Karaf 5 is
> |> |> |> |still under development and so, everything is not yet ready.
> |> |> |> |As said, I will “move” the code to Apache Karaf repo as soon as
> |> |> |> |I consider I have something clean and running.
> |> |> |> |
> |> |> |> |Anyway, about your email, I will check. Today my focus is on
> |> |> |> |the OsgiApplicationManager to be Karaf 4 compliant.
> |> |> |> |I also have to improve the Karaf Config service.
> |> |> |> |
> |> |> |> |By the way, you don’t need your own Main, just use the
> |> |> |> |repackage with regular provided Main (you can take a look on
> |> |> |> |the K4 assembly repackage as an example). I will create a
> |> |> |> |gradle/maven plugin with
> |> |> |repackage.
> |> |> |> |
> |> |> |> |Regarding your issue, as you are running with JDK11, I guess
> |> |> |> |you have to add -- add-modules java.security.jgss to avoid the
> |> |> |NoClassDefFoundException.
> |> |> |> |
> |> |> |> |Thanks anyway for your feedback, much appreciated.
> |> |> |> |
> |> |> |> |Regards
> |> |> |> |JB
> |> |> |> |
> |> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |> |>
> |> |> |> |> Hi Jean-Baptiste,
> |> |> |> |>
> |> |> |> |> I managed to start (well not completely) my spring application.
> |> |> |> |> However, while starting up, I get an exception:
> |> |> |> |>
> |> |> |> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
> |> |> |> |> Application run failed
> |> |> |> |> org.springframework.context.ApplicationContextException:
> |> |> |> |> Unable to start web server; nested exception is
> |> |java.lang.NoClassDefFoundError:
> |> |> |> |> org/ietf/jgss/GSSException
> |> |> |> |>
> |> |> |> |> Any ideas?
> |> |> |> |>
> |> |> |> |> Also, I had to make modifications in
> |> |> |> |SpringBootApplicationManagerService/start:
> |> |> |> |>
> |> |> |> |> try {
> |> |> |> |> Thread.currentThread().setContextClassLoader(classLoader);
> |> |> |> |> // disable tomcat stream handler
> |> |> |> |> /* There is no TomcatURLStreamHandlerFactory in my spring
> |jar
> |> |> |> |> final Method tomcat =
> |> |> |> |classLoader.loadClass("org.apache.catalina.webresources.TomcatU
> |> |> |> |RLS tre am HandlerFactory").getMethod("disable");
> |> |> |> |> if (!tomcat.isBridge()) {
> |> |> |> |> tomcat.setAccessible(true);
> |> |> |> |> }
> |> |> |> |> tomcat.invoke(null, null);
> |> |> |> |> */
> |> |> |> |> // invoke spring boot main
> |> |> |> |> final Method main =
> |> |> |>
> ||classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
> |> |> |> |getM
> |> |> |> |ethod("main", String[].class);
> |> |> |> |> main.setAccessible(true);
> |> |> |> |> log.info("Call JarLauncher");
> |> |> |> |> if (properties.get("args") != null) {
> |> |> |> |> log.info("Call JarLauncher with args");
> |> |> |> |> main.invoke(null, new Object[]{ properties.get("args") });
> |> |> |> |> } else {
> |> |> |> |> log.info("Call JarLauncher without args");
> |> |> |> |> main.invoke(null, new Object[]{new
> |> |> |> |> String[0]}); // the original invoke
> |> |> |> |did not work for me
> |> |> |> |> }
> |> |> |> |> } finally {
> |> |> |> |> Thread.currentThread().setContextClassLoader(original);
> |> |> |> |> }
> |> |> |> |>
> |> |> |> |> Further details:
> |> |> |> |> - openjdk version "11.0.12" 2021-07-20
> |> |> |> |> - invocation:
> |> |> |> |> java -cp
> |> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3w
> |> |> |> |> eb-
> |> |> |> |> tes
> |> |> |> |> t-1
> |> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-ma
> |> |> |> |> nag er/ tar
> |> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
> |> |> |> |>
> |> |> |> |> Main.java:
> |> |> |> |> ###
> |> |> |> |> public class Main {
> |> |> |> |> public static void main(String[] args){
> |> |> |> |> System.out.println("Starting Karaf");
> |> |> |> |> Karaf karaf = Karaf.builder().build();
> |> |> |> |> karaf.start();
> |> |> |> |> }
> |> |> |> |> }
> |> |> |> |> ###
> |> |> |> |>
> |> |> |> |> Best,
> |> |> |> |>
> |> |> |> |> -- Jaap
> |> |> |> |>
> |> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
> |> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |> |
> |> |> |> |> |Hi Jaap,
> |> |> |> |> |
> |> |> |> |> |The presentation is available here:
> |> |> |> |> |
> |> |> |> |>
> |> |> |>
> |> |>
> |>
> |||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdah
> |K
> |> |h
> |> |> |c
> |> |> |> |S
> |> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
> |> |> |> |> |
> |> |> |> |> |Karaf 5 WIP is available here:
> |> |> |> |> |
> |> |> |> |> |https://github.com/jbonofre/karaf5
> |> |> |> |> |
> |> |> |> |> |I'm available on Slack or by email if you wanna chat about Karaf5.
> |> |> |> |> |
> |> |> |> |> |Regards
> |> |> |> |> |JB
> |> |> |> |> |
> |> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
> |> |> |> |> |> Hi,
> |> |> |> |> |>
> |> |> |> |> |> I have two questions about Karaf 5:
> |> |> |> |> |> - is the presentation by Onofre at ApacheConf online
> |somewhere?
> |> |> |> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
> |> |> |> |> |> I am in particular interested in the Spring Boot
> |> |> |> |> |> functionality, as I have a Spring Boot application that I
> |> |> |> |> |> want to port to Karaf to support dynamic loading of
> |> |> |> |> |> components. I have found the github repo of Onofre, but it
> |> |> |> |> |> is
> |> |unclear to me how e.g. to start Karaf.
> |> |> |> |> |>
> |> |> |> |> |> Best,
> |> |> |> |> |>
> |> |> |> |> |> -- Jaap
> |> |> |> |> |>
> |> |> |> |>
> |> |> |>
> |> |> |>
> |> |>
> |> |>
> |>
> |>
>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
Is there already something working for exporting functionality of a Spring modules to other modules?
|-----Oorspronkelijk bericht-----
|Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|Verzonden: woensdag 29 september 2021 17:26
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Thanks for the update.
|
|I'm happy to say you are the first one to "use/launch" Karaf 5 ;)
|
|About the TomcatURLStreamHandlerFactory is known "issue":
|
|https://github.com/jbonofre/karaf5/blob/main/services/spring-boot-
|application-
|manager/src/main/java/org/apache/karaf/springboot/SpringBootApplication
|ManagerService.java#L110
|
|I have to improve this ;)
|
|Regards
|JB
|
|On 29/09/2021 17:19, jgfrm wrote:
|> The following works:
|>
|> Karaf.json:
|> ====
|> {
|> "applications": [
|> {
|> "name": "e3web",
|> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
|> "type": "spring-boot",
|> "properties": {
|> "enableHttp": true,
|> "enablePrometheus": true
|> }
|> }
|> ]
|> }
|> ====
|>
|> Add to Spring boot application:
|> ====
|> @SpringBootApplication
|> @ComponentScan
|> public class E3webApplication {
|>
|> ...
|> public static void main(String[] args) {
|> TomcatURLStreamHandlerFactory.disable(); // see
|https://github.com/spring-projects/spring-boot/issues/21535
|> SpringApplication.run(E3webApplication.class, args);
|> }
|> ====
|>
|> Start with
|> java --add-modules jdk.security.jgss -cp
|> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1
|> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/tar
|> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> -Dkaraf.config=src/main/resources/karaf.json
|> org.apache.karaf.boot.Main
|>
|> |-----Oorspronkelijk bericht-----
|> |Van: JB Onofré <jb...@nanthrax.net>
|> |Verzonden: dinsdag 28 september 2021 06:34
|> |Aan: user@karaf.apache.org
|> |Onderwerp: Re: Karaf 5
|> |
|> |Hi
|> |
|> |No it’s not this because k5 don’t use OSGi for the spring boot
|> |launcher. I still think it’s a missing add modules as Jvm arg. I will check
|today.
|> |
|> |Regards
|> |JB
|> |
|> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
|> |>
|> |> While Googling, I came across on of your blogs
|> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-
|> |431.html) that one of the changes in Karaf was to export the java.*
|packages.
|> |Could that be the cause?
|> |>
|> |> |-----Oorspronkelijk bericht-----
|> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |Verzonden: zondag 26 september 2021 18:02
|> |> |Aan: user@karaf.apache.org
|> |> |Onderwerp: Re: Karaf 5
|> |> |
|> |> |Hi
|> |> |
|> |> |No sure, it’s only class loader issue. I remember this issue in
|> |> |pure spring boot with JDK11.
|> |> |
|> |> |Let me check.
|> |> |
|> |> |Regards
|> |> |JB
|> |> |
|> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
|> |> |>
|> |> |> Hi JB,
|> |> |>
|> |> |> Fully understand that it is still work in progress.
|> |> |>
|> |> |> Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
|> |> |> --add-modules java.security.jgss does not solve it?
|> |> |> Is it a class loader problem?
|> |> |>
|> |> |> Best,
|> |> |>
|> |> |> -- Jaap
|> |> |>
|> |> |>
|> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |> |Verzonden: zondag 26 september 2021 14:20
|> |> |> |Aan: user@karaf.apache.org
|> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |
|> |> |> |Hi Jaap,
|> |> |> |
|> |> |> |First, maybe I was not clean in my presentation: Karaf 5 is
|> |> |> |still under development and so, everything is not yet ready.
|> |> |> |As said, I will “move” the code to Apache Karaf repo as soon as
|> |> |> |I consider I have something clean and running.
|> |> |> |
|> |> |> |Anyway, about your email, I will check. Today my focus is on
|> |> |> |the OsgiApplicationManager to be Karaf 4 compliant.
|> |> |> |I also have to improve the Karaf Config service.
|> |> |> |
|> |> |> |By the way, you don’t need your own Main, just use the
|> |> |> |repackage with regular provided Main (you can take a look on
|> |> |> |the K4 assembly repackage as an example). I will create a
|> |> |> |gradle/maven plugin with
|> |> |repackage.
|> |> |> |
|> |> |> |Regarding your issue, as you are running with JDK11, I guess
|> |> |> |you have to add -- add-modules java.security.jgss to avoid the
|> |> |NoClassDefFoundException.
|> |> |> |
|> |> |> |Thanks anyway for your feedback, much appreciated.
|> |> |> |
|> |> |> |Regards
|> |> |> |JB
|> |> |> |
|> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
|> |> |> |>
|> |> |> |> Hi Jean-Baptiste,
|> |> |> |>
|> |> |> |> I managed to start (well not completely) my spring application.
|> |> |> |> However, while starting up, I get an exception:
|> |> |> |>
|> |> |> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
|> |> |> |> Application run failed
|> |> |> |> org.springframework.context.ApplicationContextException:
|> |> |> |> Unable to start web server; nested exception is
|> |java.lang.NoClassDefFoundError:
|> |> |> |> org/ietf/jgss/GSSException
|> |> |> |>
|> |> |> |> Any ideas?
|> |> |> |>
|> |> |> |> Also, I had to make modifications in
|> |> |> |SpringBootApplicationManagerService/start:
|> |> |> |>
|> |> |> |> try {
|> |> |> |> Thread.currentThread().setContextClassLoader(classLoader);
|> |> |> |> // disable tomcat stream handler
|> |> |> |> /* There is no TomcatURLStreamHandlerFactory in my spring
|jar
|> |> |> |> final Method tomcat =
|> |> |> |classLoader.loadClass("org.apache.catalina.webresources.TomcatU
|> |> |> |RLS tre am HandlerFactory").getMethod("disable");
|> |> |> |> if (!tomcat.isBridge()) {
|> |> |> |> tomcat.setAccessible(true);
|> |> |> |> }
|> |> |> |> tomcat.invoke(null, null);
|> |> |> |> */
|> |> |> |> // invoke spring boot main
|> |> |> |> final Method main =
|> |> |>
||classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
|> |> |> |getM
|> |> |> |ethod("main", String[].class);
|> |> |> |> main.setAccessible(true);
|> |> |> |> log.info("Call JarLauncher");
|> |> |> |> if (properties.get("args") != null) {
|> |> |> |> log.info("Call JarLauncher with args");
|> |> |> |> main.invoke(null, new Object[]{ properties.get("args") });
|> |> |> |> } else {
|> |> |> |> log.info("Call JarLauncher without args");
|> |> |> |> main.invoke(null, new Object[]{new
|> |> |> |> String[0]}); // the original invoke
|> |> |> |did not work for me
|> |> |> |> }
|> |> |> |> } finally {
|> |> |> |> Thread.currentThread().setContextClassLoader(original);
|> |> |> |> }
|> |> |> |>
|> |> |> |> Further details:
|> |> |> |> - openjdk version "11.0.12" 2021-07-20
|> |> |> |> - invocation:
|> |> |> |> java -cp
|> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3w
|> |> |> |> eb-
|> |> |> |> tes
|> |> |> |> t-1
|> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-ma
|> |> |> |> nag er/ tar
|> |> |> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
|> |> |> |>
|> |> |> |> Main.java:
|> |> |> |> ###
|> |> |> |> public class Main {
|> |> |> |> public static void main(String[] args){
|> |> |> |> System.out.println("Starting Karaf");
|> |> |> |> Karaf karaf = Karaf.builder().build();
|> |> |> |> karaf.start();
|> |> |> |> }
|> |> |> |> }
|> |> |> |> ###
|> |> |> |>
|> |> |> |> Best,
|> |> |> |>
|> |> |> |> -- Jaap
|> |> |> |>
|> |> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
|> |> |> |> |Aan: user@karaf.apache.org
|> |> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |> |
|> |> |> |> |Hi Jaap,
|> |> |> |> |
|> |> |> |> |The presentation is available here:
|> |> |> |> |
|> |> |> |>
|> |> |>
|> |>
|>
|||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdah
|K
|> |h
|> |> |c
|> |> |> |S
|> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
|> |> |> |> |
|> |> |> |> |Karaf 5 WIP is available here:
|> |> |> |> |
|> |> |> |> |https://github.com/jbonofre/karaf5
|> |> |> |> |
|> |> |> |> |I'm available on Slack or by email if you wanna chat about Karaf5.
|> |> |> |> |
|> |> |> |> |Regards
|> |> |> |> |JB
|> |> |> |> |
|> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
|> |> |> |> |> Hi,
|> |> |> |> |>
|> |> |> |> |> I have two questions about Karaf 5:
|> |> |> |> |> - is the presentation by Onofre at ApacheConf online
|somewhere?
|> |> |> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
|> |> |> |> |> I am in particular interested in the Spring Boot
|> |> |> |> |> functionality, as I have a Spring Boot application that I
|> |> |> |> |> want to port to Karaf to support dynamic loading of
|> |> |> |> |> components. I have found the github repo of Onofre, but it
|> |> |> |> |> is
|> |unclear to me how e.g. to start Karaf.
|> |> |> |> |>
|> |> |> |> |> Best,
|> |> |> |> |>
|> |> |> |> |> -- Jaap
|> |> |> |> |>
|> |> |> |>
|> |> |>
|> |> |>
|> |>
|> |>
|>
|>
Re: Karaf 5
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks for the update.
I'm happy to say you are the first one to "use/launch" Karaf 5 ;)
About the TomcatURLStreamHandlerFactory is known "issue":
https://github.com/jbonofre/karaf5/blob/main/services/spring-boot-application-manager/src/main/java/org/apache/karaf/springboot/SpringBootApplicationManagerService.java#L110
I have to improve this ;)
Regards
JB
On 29/09/2021 17:19, jgfrm wrote:
> The following works:
>
> Karaf.json:
> ====
> {
> "applications": [
> {
> "name": "e3web",
> "url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
> "type": "spring-boot",
> "properties": {
> "enableHttp": true,
> "enablePrometheus": true
> }
> }
> ]
> }
> ====
>
> Add to Spring boot application:
> ====
> @SpringBootApplication
> @ComponentScan
> public class E3webApplication {
>
> ...
> public static void main(String[] args) {
> TomcatURLStreamHandlerFactory.disable(); // see https://github.com/spring-projects/spring-boot/issues/21535
> SpringApplication.run(E3webApplication.class, args);
> }
> ====
>
> Start with
> java --add-modules jdk.security.jgss -cp ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1.0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/target/spring-boot-application-manager-5.0-SNAPSHOT.jar -Dkaraf.config=src/main/resources/karaf.json org.apache.karaf.boot.Main
>
> |-----Oorspronkelijk bericht-----
> |Van: JB Onofré <jb...@nanthrax.net>
> |Verzonden: dinsdag 28 september 2021 06:34
> |Aan: user@karaf.apache.org
> |Onderwerp: Re: Karaf 5
> |
> |Hi
> |
> |No it’s not this because k5 don’t use OSGi for the spring boot launcher. I still
> |think it’s a missing add modules as Jvm arg. I will check today.
> |
> |Regards
> |JB
> |
> |> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
> |>
> |> While Googling, I came across on of your blogs
> |(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-
> |431.html) that one of the changes in Karaf was to export the java.* packages.
> |Could that be the cause?
> |>
> |> |-----Oorspronkelijk bericht-----
> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |Verzonden: zondag 26 september 2021 18:02
> |> |Aan: user@karaf.apache.org
> |> |Onderwerp: Re: Karaf 5
> |> |
> |> |Hi
> |> |
> |> |No sure, it’s only class loader issue. I remember this issue in pure
> |> |spring boot with JDK11.
> |> |
> |> |Let me check.
> |> |
> |> |Regards
> |> |JB
> |> |
> |> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
> |> |>
> |> |> Hi JB,
> |> |>
> |> |> Fully understand that it is still work in progress.
> |> |>
> |> |> Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
> |> |> --add-modules java.security.jgss does not solve it?
> |> |> Is it a class loader problem?
> |> |>
> |> |> Best,
> |> |>
> |> |> -- Jaap
> |> |>
> |> |>
> |> |> |-----Oorspronkelijk bericht-----
> |> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |> |Verzonden: zondag 26 september 2021 14:20
> |> |> |Aan: user@karaf.apache.org
> |> |> |Onderwerp: Re: Karaf 5
> |> |> |
> |> |> |Hi Jaap,
> |> |> |
> |> |> |First, maybe I was not clean in my presentation: Karaf 5 is still
> |> |> |under development and so, everything is not yet ready.
> |> |> |As said, I will “move” the code to Apache Karaf repo as soon as I
> |> |> |consider I have something clean and running.
> |> |> |
> |> |> |Anyway, about your email, I will check. Today my focus is on the
> |> |> |OsgiApplicationManager to be Karaf 4 compliant.
> |> |> |I also have to improve the Karaf Config service.
> |> |> |
> |> |> |By the way, you don’t need your own Main, just use the repackage
> |> |> |with regular provided Main (you can take a look on the K4 assembly
> |> |> |repackage as an example). I will create a gradle/maven plugin with
> |> |repackage.
> |> |> |
> |> |> |Regarding your issue, as you are running with JDK11, I guess you
> |> |> |have to add -- add-modules java.security.jgss to avoid the
> |> |NoClassDefFoundException.
> |> |> |
> |> |> |Thanks anyway for your feedback, much appreciated.
> |> |> |
> |> |> |Regards
> |> |> |JB
> |> |> |
> |> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
> |> |> |>
> |> |> |> Hi Jean-Baptiste,
> |> |> |>
> |> |> |> I managed to start (well not completely) my spring application.
> |> |> |> However, while starting up, I get an exception:
> |> |> |>
> |> |> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
> |> |> |> Application run failed
> |> |> |> org.springframework.context.ApplicationContextException: Unable
> |> |> |> to start web server; nested exception is
> |java.lang.NoClassDefFoundError:
> |> |> |> org/ietf/jgss/GSSException
> |> |> |>
> |> |> |> Any ideas?
> |> |> |>
> |> |> |> Also, I had to make modifications in
> |> |> |SpringBootApplicationManagerService/start:
> |> |> |>
> |> |> |> try {
> |> |> |> Thread.currentThread().setContextClassLoader(classLoader);
> |> |> |> // disable tomcat stream handler
> |> |> |> /* There is no TomcatURLStreamHandlerFactory in my spring jar
> |> |> |> final Method tomcat =
> |> |> |classLoader.loadClass("org.apache.catalina.webresources.TomcatURLS
> |> |> |tre am HandlerFactory").getMethod("disable");
> |> |> |> if (!tomcat.isBridge()) {
> |> |> |> tomcat.setAccessible(true);
> |> |> |> }
> |> |> |> tomcat.invoke(null, null);
> |> |> |> */
> |> |> |> // invoke spring boot main
> |> |> |> final Method main =
> |> |> |classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
> |> |> |getM
> |> |> |ethod("main", String[].class);
> |> |> |> main.setAccessible(true);
> |> |> |> log.info("Call JarLauncher");
> |> |> |> if (properties.get("args") != null) {
> |> |> |> log.info("Call JarLauncher with args");
> |> |> |> main.invoke(null, new Object[]{ properties.get("args") });
> |> |> |> } else {
> |> |> |> log.info("Call JarLauncher without args");
> |> |> |> main.invoke(null, new Object[]{new String[0]});
> |> |> |> // the original invoke
> |> |> |did not work for me
> |> |> |> }
> |> |> |> } finally {
> |> |> |> Thread.currentThread().setContextClassLoader(original);
> |> |> |> }
> |> |> |>
> |> |> |> Further details:
> |> |> |> - openjdk version "11.0.12" 2021-07-20
> |> |> |> - invocation:
> |> |> |> java -cp
> |> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-
> |> |> |> tes
> |> |> |> t-1
> |> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manag
> |> |> |> er/ tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
> |> |> |>
> |> |> |> Main.java:
> |> |> |> ###
> |> |> |> public class Main {
> |> |> |> public static void main(String[] args){
> |> |> |> System.out.println("Starting Karaf");
> |> |> |> Karaf karaf = Karaf.builder().build();
> |> |> |> karaf.start();
> |> |> |> }
> |> |> |> }
> |> |> |> ###
> |> |> |>
> |> |> |> Best,
> |> |> |>
> |> |> |> -- Jaap
> |> |> |>
> |> |> |> |-----Oorspronkelijk bericht-----
> |> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |> |> |Verzonden: vrijdag 24 september 2021 10:34
> |> |> |> |Aan: user@karaf.apache.org
> |> |> |> |Onderwerp: Re: Karaf 5
> |> |> |> |
> |> |> |> |Hi Jaap,
> |> |> |> |
> |> |> |> |The presentation is available here:
> |> |> |> |
> |> |> |>
> |> |>
> |>
> ||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahK
> |h
> |> |c
> |> |> |S
> |> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
> |> |> |> |
> |> |> |> |Karaf 5 WIP is available here:
> |> |> |> |
> |> |> |> |https://github.com/jbonofre/karaf5
> |> |> |> |
> |> |> |> |I'm available on Slack or by email if you wanna chat about Karaf5.
> |> |> |> |
> |> |> |> |Regards
> |> |> |> |JB
> |> |> |> |
> |> |> |> |On 24/09/2021 10:06, jgfrm wrote:
> |> |> |> |> Hi,
> |> |> |> |>
> |> |> |> |> I have two questions about Karaf 5:
> |> |> |> |> - is the presentation by Onofre at ApacheConf online somewhere?
> |> |> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
> |> |> |> |> I am in particular interested in the Spring Boot
> |> |> |> |> functionality, as I have a Spring Boot application that I
> |> |> |> |> want to port to Karaf to support dynamic loading of
> |> |> |> |> components. I have found the github repo of Onofre, but it is
> |unclear to me how e.g. to start Karaf.
> |> |> |> |>
> |> |> |> |> Best,
> |> |> |> |>
> |> |> |> |> -- Jaap
> |> |> |> |>
> |> |> |>
> |> |>
> |> |>
> |>
> |>
>
>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
The following works:
Karaf.json:
====
{
"applications": [
{
"name": "e3web",
"url": "file:///home/jaap/Karaf5Test/e3web-dev.jar",
"type": "spring-boot",
"properties": {
"enableHttp": true,
"enablePrometheus": true
}
}
]
}
====
Add to Spring boot application:
====
@SpringBootApplication
@ComponentScan
public class E3webApplication {
...
public static void main(String[] args) {
TomcatURLStreamHandlerFactory.disable(); // see https://github.com/spring-projects/spring-boot/issues/21535
SpringApplication.run(E3webApplication.class, args);
}
====
Start with
java --add-modules jdk.security.jgss -cp ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1.0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/target/spring-boot-application-manager-5.0-SNAPSHOT.jar -Dkaraf.config=src/main/resources/karaf.json org.apache.karaf.boot.Main
|-----Oorspronkelijk bericht-----
|Van: JB Onofré <jb...@nanthrax.net>
|Verzonden: dinsdag 28 september 2021 06:34
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Hi
|
|No it’s not this because k5 don’t use OSGi for the spring boot launcher. I still
|think it’s a missing add modules as Jvm arg. I will check today.
|
|Regards
|JB
|
|> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
|>
|> While Googling, I came across on of your blogs
|(http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-
|431.html) that one of the changes in Karaf was to export the java.* packages.
|Could that be the cause?
|>
|> |-----Oorspronkelijk bericht-----
|> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |Verzonden: zondag 26 september 2021 18:02
|> |Aan: user@karaf.apache.org
|> |Onderwerp: Re: Karaf 5
|> |
|> |Hi
|> |
|> |No sure, it’s only class loader issue. I remember this issue in pure
|> |spring boot with JDK11.
|> |
|> |Let me check.
|> |
|> |Regards
|> |JB
|> |
|> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
|> |>
|> |> Hi JB,
|> |>
|> |> Fully understand that it is still work in progress.
|> |>
|> |> Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
|> |> --add-modules java.security.jgss does not solve it?
|> |> Is it a class loader problem?
|> |>
|> |> Best,
|> |>
|> |> -- Jaap
|> |>
|> |>
|> |> |-----Oorspronkelijk bericht-----
|> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |> |Verzonden: zondag 26 september 2021 14:20
|> |> |Aan: user@karaf.apache.org
|> |> |Onderwerp: Re: Karaf 5
|> |> |
|> |> |Hi Jaap,
|> |> |
|> |> |First, maybe I was not clean in my presentation: Karaf 5 is still
|> |> |under development and so, everything is not yet ready.
|> |> |As said, I will “move” the code to Apache Karaf repo as soon as I
|> |> |consider I have something clean and running.
|> |> |
|> |> |Anyway, about your email, I will check. Today my focus is on the
|> |> |OsgiApplicationManager to be Karaf 4 compliant.
|> |> |I also have to improve the Karaf Config service.
|> |> |
|> |> |By the way, you don’t need your own Main, just use the repackage
|> |> |with regular provided Main (you can take a look on the K4 assembly
|> |> |repackage as an example). I will create a gradle/maven plugin with
|> |repackage.
|> |> |
|> |> |Regarding your issue, as you are running with JDK11, I guess you
|> |> |have to add -- add-modules java.security.jgss to avoid the
|> |NoClassDefFoundException.
|> |> |
|> |> |Thanks anyway for your feedback, much appreciated.
|> |> |
|> |> |Regards
|> |> |JB
|> |> |
|> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
|> |> |>
|> |> |> Hi Jean-Baptiste,
|> |> |>
|> |> |> I managed to start (well not completely) my spring application.
|> |> |> However, while starting up, I get an exception:
|> |> |>
|> |> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
|> |> |> Application run failed
|> |> |> org.springframework.context.ApplicationContextException: Unable
|> |> |> to start web server; nested exception is
|java.lang.NoClassDefFoundError:
|> |> |> org/ietf/jgss/GSSException
|> |> |>
|> |> |> Any ideas?
|> |> |>
|> |> |> Also, I had to make modifications in
|> |> |SpringBootApplicationManagerService/start:
|> |> |>
|> |> |> try {
|> |> |> Thread.currentThread().setContextClassLoader(classLoader);
|> |> |> // disable tomcat stream handler
|> |> |> /* There is no TomcatURLStreamHandlerFactory in my spring jar
|> |> |> final Method tomcat =
|> |> |classLoader.loadClass("org.apache.catalina.webresources.TomcatURLS
|> |> |tre am HandlerFactory").getMethod("disable");
|> |> |> if (!tomcat.isBridge()) {
|> |> |> tomcat.setAccessible(true);
|> |> |> }
|> |> |> tomcat.invoke(null, null);
|> |> |> */
|> |> |> // invoke spring boot main
|> |> |> final Method main =
|> |> |classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
|> |> |getM
|> |> |ethod("main", String[].class);
|> |> |> main.setAccessible(true);
|> |> |> log.info("Call JarLauncher");
|> |> |> if (properties.get("args") != null) {
|> |> |> log.info("Call JarLauncher with args");
|> |> |> main.invoke(null, new Object[]{ properties.get("args") });
|> |> |> } else {
|> |> |> log.info("Call JarLauncher without args");
|> |> |> main.invoke(null, new Object[]{new String[0]});
|> |> |> // the original invoke
|> |> |did not work for me
|> |> |> }
|> |> |> } finally {
|> |> |> Thread.currentThread().setContextClassLoader(original);
|> |> |> }
|> |> |>
|> |> |> Further details:
|> |> |> - openjdk version "11.0.12" 2021-07-20
|> |> |> - invocation:
|> |> |> java -cp
|> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-
|> |> |> tes
|> |> |> t-1
|> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manag
|> |> |> er/ tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
|> |> |>
|> |> |> Main.java:
|> |> |> ###
|> |> |> public class Main {
|> |> |> public static void main(String[] args){
|> |> |> System.out.println("Starting Karaf");
|> |> |> Karaf karaf = Karaf.builder().build();
|> |> |> karaf.start();
|> |> |> }
|> |> |> }
|> |> |> ###
|> |> |>
|> |> |> Best,
|> |> |>
|> |> |> -- Jaap
|> |> |>
|> |> |> |-----Oorspronkelijk bericht-----
|> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |> |Verzonden: vrijdag 24 september 2021 10:34
|> |> |> |Aan: user@karaf.apache.org
|> |> |> |Onderwerp: Re: Karaf 5
|> |> |> |
|> |> |> |Hi Jaap,
|> |> |> |
|> |> |> |The presentation is available here:
|> |> |> |
|> |> |>
|> |>
|>
||||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahK
|h
|> |c
|> |> |S
|> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
|> |> |> |
|> |> |> |Karaf 5 WIP is available here:
|> |> |> |
|> |> |> |https://github.com/jbonofre/karaf5
|> |> |> |
|> |> |> |I'm available on Slack or by email if you wanna chat about Karaf5.
|> |> |> |
|> |> |> |Regards
|> |> |> |JB
|> |> |> |
|> |> |> |On 24/09/2021 10:06, jgfrm wrote:
|> |> |> |> Hi,
|> |> |> |>
|> |> |> |> I have two questions about Karaf 5:
|> |> |> |> - is the presentation by Onofre at ApacheConf online somewhere?
|> |> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
|> |> |> |> I am in particular interested in the Spring Boot
|> |> |> |> functionality, as I have a Spring Boot application that I
|> |> |> |> want to port to Karaf to support dynamic loading of
|> |> |> |> components. I have found the github repo of Onofre, but it is
|unclear to me how e.g. to start Karaf.
|> |> |> |>
|> |> |> |> Best,
|> |> |> |>
|> |> |> |> -- Jaap
|> |> |> |>
|> |> |>
|> |>
|> |>
|>
|>
Re: Karaf 5
Posted by JB Onofré <jb...@nanthrax.net>.
Hi
No it’s not this because k5 don’t use OSGi for the spring boot launcher. I still think it’s a missing add modules as Jvm arg. I will check today.
Regards
JB
> Le 27 sept. 2021 à 23:39, jgfrm <fr...@gordijn.org> a écrit :
>
> While Googling, I came across on of your blogs (http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-431.html) that one of the changes in Karaf was to export the java.* packages. Could that be the cause?
>
> |-----Oorspronkelijk bericht-----
> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |Verzonden: zondag 26 september 2021 18:02
> |Aan: user@karaf.apache.org
> |Onderwerp: Re: Karaf 5
> |
> |Hi
> |
> |No sure, it’s only class loader issue. I remember this issue in pure spring boot
> |with JDK11.
> |
> |Let me check.
> |
> |Regards
> |JB
> |
> |> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
> |>
> |> Hi JB,
> |>
> |> Fully understand that it is still work in progress.
> |>
> |> Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
> |> --add-modules java.security.jgss does not solve it?
> |> Is it a class loader problem?
> |>
> |> Best,
> |>
> |> -- Jaap
> |>
> |>
> |> |-----Oorspronkelijk bericht-----
> |> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |> |Verzonden: zondag 26 september 2021 14:20
> |> |Aan: user@karaf.apache.org
> |> |Onderwerp: Re: Karaf 5
> |> |
> |> |Hi Jaap,
> |> |
> |> |First, maybe I was not clean in my presentation: Karaf 5 is still
> |> |under development and so, everything is not yet ready.
> |> |As said, I will “move” the code to Apache Karaf repo as soon as I
> |> |consider I have something clean and running.
> |> |
> |> |Anyway, about your email, I will check. Today my focus is on the
> |> |OsgiApplicationManager to be Karaf 4 compliant.
> |> |I also have to improve the Karaf Config service.
> |> |
> |> |By the way, you don’t need your own Main, just use the repackage with
> |> |regular provided Main (you can take a look on the K4 assembly
> |> |repackage as an example). I will create a gradle/maven plugin with
> |repackage.
> |> |
> |> |Regarding your issue, as you are running with JDK11, I guess you have
> |> |to add -- add-modules java.security.jgss to avoid the
> |NoClassDefFoundException.
> |> |
> |> |Thanks anyway for your feedback, much appreciated.
> |> |
> |> |Regards
> |> |JB
> |> |
> |> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
> |> |>
> |> |> Hi Jean-Baptiste,
> |> |>
> |> |> I managed to start (well not completely) my spring application.
> |> |> However, while starting up, I get an exception:
> |> |>
> |> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
> |> |> Application run failed
> |> |> org.springframework.context.ApplicationContextException: Unable to
> |> |> start web server; nested exception is java.lang.NoClassDefFoundError:
> |> |> org/ietf/jgss/GSSException
> |> |>
> |> |> Any ideas?
> |> |>
> |> |> Also, I had to make modifications in
> |> |SpringBootApplicationManagerService/start:
> |> |>
> |> |> try {
> |> |> Thread.currentThread().setContextClassLoader(classLoader);
> |> |> // disable tomcat stream handler
> |> |> /* There is no TomcatURLStreamHandlerFactory in my spring jar
> |> |> final Method tomcat =
> |> |classLoader.loadClass("org.apache.catalina.webresources.TomcatURLStre
> |> |am HandlerFactory").getMethod("disable");
> |> |> if (!tomcat.isBridge()) {
> |> |> tomcat.setAccessible(true);
> |> |> }
> |> |> tomcat.invoke(null, null);
> |> |> */
> |> |> // invoke spring boot main
> |> |> final Method main =
> |> |classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
> |> |getM
> |> |ethod("main", String[].class);
> |> |> main.setAccessible(true);
> |> |> log.info("Call JarLauncher");
> |> |> if (properties.get("args") != null) {
> |> |> log.info("Call JarLauncher with args");
> |> |> main.invoke(null, new Object[]{ properties.get("args") });
> |> |> } else {
> |> |> log.info("Call JarLauncher without args");
> |> |> main.invoke(null, new Object[]{new String[0]}); //
> |> |> the original invoke
> |> |did not work for me
> |> |> }
> |> |> } finally {
> |> |> Thread.currentThread().setContextClassLoader(original);
> |> |> }
> |> |>
> |> |> Further details:
> |> |> - openjdk version "11.0.12" 2021-07-20
> |> |> - invocation:
> |> |> java -cp
> |> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-tes
> |> |> t-1
> |> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/
> |> |> tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> |> -Dkaraf.config=src/main/resources/karaf.json Main
> |> |>
> |> |> Main.java:
> |> |> ###
> |> |> public class Main {
> |> |> public static void main(String[] args){
> |> |> System.out.println("Starting Karaf");
> |> |> Karaf karaf = Karaf.builder().build();
> |> |> karaf.start();
> |> |> }
> |> |> }
> |> |> ###
> |> |>
> |> |> Best,
> |> |>
> |> |> -- Jaap
> |> |>
> |> |> |-----Oorspronkelijk bericht-----
> |> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |> |Verzonden: vrijdag 24 september 2021 10:34
> |> |> |Aan: user@karaf.apache.org
> |> |> |Onderwerp: Re: Karaf 5
> |> |> |
> |> |> |Hi Jaap,
> |> |> |
> |> |> |The presentation is available here:
> |> |> |
> |> |>
> |>
> |||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKh
> |c
> |> |S
> |> |> |VZJjlPk5FPxfBE/edit?usp=sharing
> |> |> |
> |> |> |Karaf 5 WIP is available here:
> |> |> |
> |> |> |https://github.com/jbonofre/karaf5
> |> |> |
> |> |> |I'm available on Slack or by email if you wanna chat about Karaf5.
> |> |> |
> |> |> |Regards
> |> |> |JB
> |> |> |
> |> |> |On 24/09/2021 10:06, jgfrm wrote:
> |> |> |> Hi,
> |> |> |>
> |> |> |> I have two questions about Karaf 5:
> |> |> |> - is the presentation by Onofre at ApacheConf online somewhere?
> |> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
> |> |> |> I am in particular interested in the Spring Boot functionality,
> |> |> |> as I have a Spring Boot application that I want to port to Karaf
> |> |> |> to support dynamic loading of components. I have found the
> |> |> |> github repo of Onofre, but it is unclear to me how e.g. to start Karaf.
> |> |> |>
> |> |> |> Best,
> |> |> |>
> |> |> |> -- Jaap
> |> |> |>
> |> |>
> |>
> |>
>
>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
While Googling, I came across on of your blogs (http://nanthrax.blogspot.com/2021/04/whats-new-in-apache-karaf-431.html) that one of the changes in Karaf was to export the java.* packages. Could that be the cause?
|-----Oorspronkelijk bericht-----
|Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|Verzonden: zondag 26 september 2021 18:02
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Hi
|
|No sure, it’s only class loader issue. I remember this issue in pure spring boot
|with JDK11.
|
|Let me check.
|
|Regards
|JB
|
|> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
|>
|> Hi JB,
|>
|> Fully understand that it is still work in progress.
|>
|> Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
|> --add-modules java.security.jgss does not solve it?
|> Is it a class loader problem?
|>
|> Best,
|>
|> -- Jaap
|>
|>
|> |-----Oorspronkelijk bericht-----
|> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|> |Verzonden: zondag 26 september 2021 14:20
|> |Aan: user@karaf.apache.org
|> |Onderwerp: Re: Karaf 5
|> |
|> |Hi Jaap,
|> |
|> |First, maybe I was not clean in my presentation: Karaf 5 is still
|> |under development and so, everything is not yet ready.
|> |As said, I will “move” the code to Apache Karaf repo as soon as I
|> |consider I have something clean and running.
|> |
|> |Anyway, about your email, I will check. Today my focus is on the
|> |OsgiApplicationManager to be Karaf 4 compliant.
|> |I also have to improve the Karaf Config service.
|> |
|> |By the way, you don’t need your own Main, just use the repackage with
|> |regular provided Main (you can take a look on the K4 assembly
|> |repackage as an example). I will create a gradle/maven plugin with
|repackage.
|> |
|> |Regarding your issue, as you are running with JDK11, I guess you have
|> |to add -- add-modules java.security.jgss to avoid the
|NoClassDefFoundException.
|> |
|> |Thanks anyway for your feedback, much appreciated.
|> |
|> |Regards
|> |JB
|> |
|> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
|> |>
|> |> Hi Jean-Baptiste,
|> |>
|> |> I managed to start (well not completely) my spring application.
|> |> However, while starting up, I get an exception:
|> |>
|> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 -
|> |> Application run failed
|> |> org.springframework.context.ApplicationContextException: Unable to
|> |> start web server; nested exception is java.lang.NoClassDefFoundError:
|> |> org/ietf/jgss/GSSException
|> |>
|> |> Any ideas?
|> |>
|> |> Also, I had to make modifications in
|> |SpringBootApplicationManagerService/start:
|> |>
|> |> try {
|> |> Thread.currentThread().setContextClassLoader(classLoader);
|> |> // disable tomcat stream handler
|> |> /* There is no TomcatURLStreamHandlerFactory in my spring jar
|> |> final Method tomcat =
|> |classLoader.loadClass("org.apache.catalina.webresources.TomcatURLStre
|> |am HandlerFactory").getMethod("disable");
|> |> if (!tomcat.isBridge()) {
|> |> tomcat.setAccessible(true);
|> |> }
|> |> tomcat.invoke(null, null);
|> |> */
|> |> // invoke spring boot main
|> |> final Method main =
|> |classLoader.loadClass("org.springframework.boot.loader.JarLauncher").
|> |getM
|> |ethod("main", String[].class);
|> |> main.setAccessible(true);
|> |> log.info("Call JarLauncher");
|> |> if (properties.get("args") != null) {
|> |> log.info("Call JarLauncher with args");
|> |> main.invoke(null, new Object[]{ properties.get("args") });
|> |> } else {
|> |> log.info("Call JarLauncher without args");
|> |> main.invoke(null, new Object[]{new String[0]}); //
|> |> the original invoke
|> |did not work for me
|> |> }
|> |> } finally {
|> |> Thread.currentThread().setContextClassLoader(original);
|> |> }
|> |>
|> |> Further details:
|> |> - openjdk version "11.0.12" 2021-07-20
|> |> - invocation:
|> |> java -cp
|> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-tes
|> |> t-1
|> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/
|> |> tar get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> |> -Dkaraf.config=src/main/resources/karaf.json Main
|> |>
|> |> Main.java:
|> |> ###
|> |> public class Main {
|> |> public static void main(String[] args){
|> |> System.out.println("Starting Karaf");
|> |> Karaf karaf = Karaf.builder().build();
|> |> karaf.start();
|> |> }
|> |> }
|> |> ###
|> |>
|> |> Best,
|> |>
|> |> -- Jaap
|> |>
|> |> |-----Oorspronkelijk bericht-----
|> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |> |Verzonden: vrijdag 24 september 2021 10:34
|> |> |Aan: user@karaf.apache.org
|> |> |Onderwerp: Re: Karaf 5
|> |> |
|> |> |Hi Jaap,
|> |> |
|> |> |The presentation is available here:
|> |> |
|> |>
|>
|||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKh
|c
|> |S
|> |> |VZJjlPk5FPxfBE/edit?usp=sharing
|> |> |
|> |> |Karaf 5 WIP is available here:
|> |> |
|> |> |https://github.com/jbonofre/karaf5
|> |> |
|> |> |I'm available on Slack or by email if you wanna chat about Karaf5.
|> |> |
|> |> |Regards
|> |> |JB
|> |> |
|> |> |On 24/09/2021 10:06, jgfrm wrote:
|> |> |> Hi,
|> |> |>
|> |> |> I have two questions about Karaf 5:
|> |> |> - is the presentation by Onofre at ApacheConf online somewhere?
|> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
|> |> |> I am in particular interested in the Spring Boot functionality,
|> |> |> as I have a Spring Boot application that I want to port to Karaf
|> |> |> to support dynamic loading of components. I have found the
|> |> |> github repo of Onofre, but it is unclear to me how e.g. to start Karaf.
|> |> |>
|> |> |> Best,
|> |> |>
|> |> |> -- Jaap
|> |> |>
|> |>
|>
|>
Re: Karaf 5
Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi
No sure, it’s only class loader issue. I remember this issue in pure spring boot with JDK11.
Let me check.
Regards
JB
> Le 26 sept. 2021 à 17:59, jgfrm <fr...@gordijn.org> a écrit :
>
> Hi JB,
>
> Fully understand that it is still work in progress.
>
> Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
> --add-modules java.security.jgss does not solve it?
> Is it a class loader problem?
>
> Best,
>
> -- Jaap
>
>
> |-----Oorspronkelijk bericht-----
> |Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
> |Verzonden: zondag 26 september 2021 14:20
> |Aan: user@karaf.apache.org
> |Onderwerp: Re: Karaf 5
> |
> |Hi Jaap,
> |
> |First, maybe I was not clean in my presentation: Karaf 5 is still under
> |development and so, everything is not yet ready.
> |As said, I will “move” the code to Apache Karaf repo as soon as I consider I
> |have something clean and running.
> |
> |Anyway, about your email, I will check. Today my focus is on the
> |OsgiApplicationManager to be Karaf 4 compliant.
> |I also have to improve the Karaf Config service.
> |
> |By the way, you don’t need your own Main, just use the repackage with
> |regular provided Main (you can take a look on the K4 assembly repackage as
> |an example). I will create a gradle/maven plugin with repackage.
> |
> |Regarding your issue, as you are running with JDK11, I guess you have to add --
> |add-modules java.security.jgss to avoid the NoClassDefFoundException.
> |
> |Thanks anyway for your feedback, much appreciated.
> |
> |Regards
> |JB
> |
> |> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
> |>
> |> Hi Jean-Baptiste,
> |>
> |> I managed to start (well not completely) my spring application.
> |> However, while starting up, I get an exception:
> |>
> |> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 - Application
> |> run failed
> |> org.springframework.context.ApplicationContextException: Unable to
> |> start web server; nested exception is java.lang.NoClassDefFoundError:
> |> org/ietf/jgss/GSSException
> |>
> |> Any ideas?
> |>
> |> Also, I had to make modifications in
> |SpringBootApplicationManagerService/start:
> |>
> |> try {
> |> Thread.currentThread().setContextClassLoader(classLoader);
> |> // disable tomcat stream handler
> |> /* There is no TomcatURLStreamHandlerFactory in my spring jar
> |> final Method tomcat =
> |classLoader.loadClass("org.apache.catalina.webresources.TomcatURLStream
> |HandlerFactory").getMethod("disable");
> |> if (!tomcat.isBridge()) {
> |> tomcat.setAccessible(true);
> |> }
> |> tomcat.invoke(null, null);
> |> */
> |> // invoke spring boot main
> |> final Method main =
> |classLoader.loadClass("org.springframework.boot.loader.JarLauncher").getM
> |ethod("main", String[].class);
> |> main.setAccessible(true);
> |> log.info("Call JarLauncher");
> |> if (properties.get("args") != null) {
> |> log.info("Call JarLauncher with args");
> |> main.invoke(null, new Object[]{ properties.get("args") });
> |> } else {
> |> log.info("Call JarLauncher without args");
> |> main.invoke(null, new Object[]{new String[0]}); // the original invoke
> |did not work for me
> |> }
> |> } finally {
> |> Thread.currentThread().setContextClassLoader(original);
> |> }
> |>
> |> Further details:
> |> - openjdk version "11.0.12" 2021-07-20
> |> - invocation:
> |> java -cp
> |> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1
> |> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/tar
> |> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
> |> -Dkaraf.config=src/main/resources/karaf.json Main
> |>
> |> Main.java:
> |> ###
> |> public class Main {
> |> public static void main(String[] args){
> |> System.out.println("Starting Karaf");
> |> Karaf karaf = Karaf.builder().build();
> |> karaf.start();
> |> }
> |> }
> |> ###
> |>
> |> Best,
> |>
> |> -- Jaap
> |>
> |> |-----Oorspronkelijk bericht-----
> |> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |> |Verzonden: vrijdag 24 september 2021 10:34
> |> |Aan: user@karaf.apache.org
> |> |Onderwerp: Re: Karaf 5
> |> |
> |> |Hi Jaap,
> |> |
> |> |The presentation is available here:
> |> |
> |>
> ||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKhc
> |S
> |> |VZJjlPk5FPxfBE/edit?usp=sharing
> |> |
> |> |Karaf 5 WIP is available here:
> |> |
> |> |https://github.com/jbonofre/karaf5
> |> |
> |> |I'm available on Slack or by email if you wanna chat about Karaf5.
> |> |
> |> |Regards
> |> |JB
> |> |
> |> |On 24/09/2021 10:06, jgfrm wrote:
> |> |> Hi,
> |> |>
> |> |> I have two questions about Karaf 5:
> |> |> - is the presentation by Onofre at ApacheConf online somewhere?
> |> |> - is it possible to explore Karaf 5 (or: what is there right now)?
> |> |> I am in particular interested in the Spring Boot functionality, as
> |> |> I have a Spring Boot application that I want to port to Karaf to
> |> |> support dynamic loading of components. I have found the github repo
> |> |> of Onofre, but it is unclear to me how e.g. to start Karaf.
> |> |>
> |> |> Best,
> |> |>
> |> |> -- Jaap
> |> |>
> |>
>
>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
Hi JB,
Fully understand that it is still work in progress.
Regarding the .NoClassDefFoundError: org/ietf/jgss/GSSException
--add-modules java.security.jgss does not solve it?
Is it a class loader problem?
Best,
-- Jaap
|-----Oorspronkelijk bericht-----
|Van: Jean-Baptiste Onofre <jb...@nanthrax.net>
|Verzonden: zondag 26 september 2021 14:20
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Hi Jaap,
|
|First, maybe I was not clean in my presentation: Karaf 5 is still under
|development and so, everything is not yet ready.
|As said, I will “move” the code to Apache Karaf repo as soon as I consider I
|have something clean and running.
|
|Anyway, about your email, I will check. Today my focus is on the
|OsgiApplicationManager to be Karaf 4 compliant.
|I also have to improve the Karaf Config service.
|
|By the way, you don’t need your own Main, just use the repackage with
|regular provided Main (you can take a look on the K4 assembly repackage as
|an example). I will create a gradle/maven plugin with repackage.
|
|Regarding your issue, as you are running with JDK11, I guess you have to add --
|add-modules java.security.jgss to avoid the NoClassDefFoundException.
|
|Thanks anyway for your feedback, much appreciated.
|
|Regards
|JB
|
|> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
|>
|> Hi Jean-Baptiste,
|>
|> I managed to start (well not completely) my spring application.
|> However, while starting up, I get an exception:
|>
|> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 - Application
|> run failed
|> org.springframework.context.ApplicationContextException: Unable to
|> start web server; nested exception is java.lang.NoClassDefFoundError:
|> org/ietf/jgss/GSSException
|>
|> Any ideas?
|>
|> Also, I had to make modifications in
|SpringBootApplicationManagerService/start:
|>
|> try {
|> Thread.currentThread().setContextClassLoader(classLoader);
|> // disable tomcat stream handler
|> /* There is no TomcatURLStreamHandlerFactory in my spring jar
|> final Method tomcat =
|classLoader.loadClass("org.apache.catalina.webresources.TomcatURLStream
|HandlerFactory").getMethod("disable");
|> if (!tomcat.isBridge()) {
|> tomcat.setAccessible(true);
|> }
|> tomcat.invoke(null, null);
|> */
|> // invoke spring boot main
|> final Method main =
|classLoader.loadClass("org.springframework.boot.loader.JarLauncher").getM
|ethod("main", String[].class);
|> main.setAccessible(true);
|> log.info("Call JarLauncher");
|> if (properties.get("args") != null) {
|> log.info("Call JarLauncher with args");
|> main.invoke(null, new Object[]{ properties.get("args") });
|> } else {
|> log.info("Call JarLauncher without args");
|> main.invoke(null, new Object[]{new String[0]}); // the original invoke
|did not work for me
|> }
|> } finally {
|> Thread.currentThread().setContextClassLoader(original);
|> }
|>
|> Further details:
|> - openjdk version "11.0.12" 2021-07-20
|> - invocation:
|> java -cp
|> ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1
|> .0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/tar
|> get/spring-boot-application-manager-5.0-SNAPSHOT.jar
|> -Dkaraf.config=src/main/resources/karaf.json Main
|>
|> Main.java:
|> ###
|> public class Main {
|> public static void main(String[] args){
|> System.out.println("Starting Karaf");
|> Karaf karaf = Karaf.builder().build();
|> karaf.start();
|> }
|> }
|> ###
|>
|> Best,
|>
|> -- Jaap
|>
|> |-----Oorspronkelijk bericht-----
|> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|> |Verzonden: vrijdag 24 september 2021 10:34
|> |Aan: user@karaf.apache.org
|> |Onderwerp: Re: Karaf 5
|> |
|> |Hi Jaap,
|> |
|> |The presentation is available here:
|> |
|>
||https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKhc
|S
|> |VZJjlPk5FPxfBE/edit?usp=sharing
|> |
|> |Karaf 5 WIP is available here:
|> |
|> |https://github.com/jbonofre/karaf5
|> |
|> |I'm available on Slack or by email if you wanna chat about Karaf5.
|> |
|> |Regards
|> |JB
|> |
|> |On 24/09/2021 10:06, jgfrm wrote:
|> |> Hi,
|> |>
|> |> I have two questions about Karaf 5:
|> |> - is the presentation by Onofre at ApacheConf online somewhere?
|> |> - is it possible to explore Karaf 5 (or: what is there right now)?
|> |> I am in particular interested in the Spring Boot functionality, as
|> |> I have a Spring Boot application that I want to port to Karaf to
|> |> support dynamic loading of components. I have found the github repo
|> |> of Onofre, but it is unclear to me how e.g. to start Karaf.
|> |>
|> |> Best,
|> |>
|> |> -- Jaap
|> |>
|>
Re: Karaf 5
Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi Jaap,
First, maybe I was not clean in my presentation: Karaf 5 is still under development and so, everything is not yet ready.
As said, I will “move” the code to Apache Karaf repo as soon as I consider I have something clean and running.
Anyway, about your email, I will check. Today my focus is on the OsgiApplicationManager to be Karaf 4 compliant.
I also have to improve the Karaf Config service.
By the way, you don’t need your own Main, just use the repackage with regular provided Main (you can take a look on the K4 assembly repackage as an example). I will create a gradle/maven plugin with repackage.
Regarding your issue, as you are running with JDK11, I guess you have to add --add-modules java.security.jgss to avoid the NoClassDefFoundException.
Thanks anyway for your feedback, much appreciated.
Regards
JB
> Le 26 sept. 2021 à 12:00, jgfrm <fr...@gordijn.org> a écrit :
>
> Hi Jean-Baptiste,
>
> I managed to start (well not completely) my spring application.
> However, while starting up, I get an exception:
>
> 11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 - Application run failed
> org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoClassDefFoundError: org/ietf/jgss/GSSException
>
> Any ideas?
>
> Also, I had to make modifications in SpringBootApplicationManagerService/start:
>
> try {
> Thread.currentThread().setContextClassLoader(classLoader);
> // disable tomcat stream handler
> /* There is no TomcatURLStreamHandlerFactory in my spring jar
> final Method tomcat = classLoader.loadClass("org.apache.catalina.webresources.TomcatURLStreamHandlerFactory").getMethod("disable");
> if (!tomcat.isBridge()) {
> tomcat.setAccessible(true);
> }
> tomcat.invoke(null, null);
> */
> // invoke spring boot main
> final Method main = classLoader.loadClass("org.springframework.boot.loader.JarLauncher").getMethod("main", String[].class);
> main.setAccessible(true);
> log.info("Call JarLauncher");
> if (properties.get("args") != null) {
> log.info("Call JarLauncher with args");
> main.invoke(null, new Object[]{ properties.get("args") });
> } else {
> log.info("Call JarLauncher without args");
> main.invoke(null, new Object[]{new String[0]}); // the original invoke did not work for me
> }
> } finally {
> Thread.currentThread().setContextClassLoader(original);
> }
>
> Further details:
> - openjdk version "11.0.12" 2021-07-20
> - invocation:
> java -cp ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1.0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/target/spring-boot-application-manager-5.0-SNAPSHOT.jar -Dkaraf.config=src/main/resources/karaf.json Main
>
> Main.java:
> ###
> public class Main {
> public static void main(String[] args){
> System.out.println("Starting Karaf");
> Karaf karaf = Karaf.builder().build();
> karaf.start();
> }
> }
> ###
>
> Best,
>
> -- Jaap
>
> |-----Oorspronkelijk bericht-----
> |Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
> |Verzonden: vrijdag 24 september 2021 10:34
> |Aan: user@karaf.apache.org
> |Onderwerp: Re: Karaf 5
> |
> |Hi Jaap,
> |
> |The presentation is available here:
> |
> |https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKhcS
> |VZJjlPk5FPxfBE/edit?usp=sharing
> |
> |Karaf 5 WIP is available here:
> |
> |https://github.com/jbonofre/karaf5
> |
> |I'm available on Slack or by email if you wanna chat about Karaf5.
> |
> |Regards
> |JB
> |
> |On 24/09/2021 10:06, jgfrm wrote:
> |> Hi,
> |>
> |> I have two questions about Karaf 5:
> |> - is the presentation by Onofre at ApacheConf online somewhere?
> |> - is it possible to explore Karaf 5 (or: what is there right now)? I
> |> am in particular interested in the Spring Boot functionality, as I
> |> have a Spring Boot application that I want to port to Karaf to support
> |> dynamic loading of components. I have found the github repo of Onofre,
> |> but it is unclear to me how e.g. to start Karaf.
> |>
> |> Best,
> |>
> |> -- Jaap
> |>
>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
Hi Jean-Baptiste,
I managed to start (well not completely) my spring application.
However, while starting up, I get an exception:
11:43:03.148 [main] ERROR o.s.boot.SpringApplication:837 - Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoClassDefFoundError: org/ietf/jgss/GSSException
Any ideas?
Also, I had to make modifications in SpringBootApplicationManagerService/start:
try {
Thread.currentThread().setContextClassLoader(classLoader);
// disable tomcat stream handler
/* There is no TomcatURLStreamHandlerFactory in my spring jar
final Method tomcat = classLoader.loadClass("org.apache.catalina.webresources.TomcatURLStreamHandlerFactory").getMethod("disable");
if (!tomcat.isBridge()) {
tomcat.setAccessible(true);
}
tomcat.invoke(null, null);
*/
// invoke spring boot main
final Method main = classLoader.loadClass("org.springframework.boot.loader.JarLauncher").getMethod("main", String[].class);
main.setAccessible(true);
log.info("Call JarLauncher");
if (properties.get("args") != null) {
log.info("Call JarLauncher with args");
main.invoke(null, new Object[]{ properties.get("args") });
} else {
log.info("Call JarLauncher without args");
main.invoke(null, new Object[]{new String[0]}); // the original invoke did not work for me
}
} finally {
Thread.currentThread().setContextClassLoader(original);
}
Further details:
- openjdk version "11.0.12" 2021-07-20
- invocation:
java -cp ../karaf5/assemblies/k4/target/k4-5.0-SNAPSHOT.jar:target/e3web-test-1.0-SNAPSHOT.jar:../karaf5/services/spring-boot-application-manager/target/spring-boot-application-manager-5.0-SNAPSHOT.jar -Dkaraf.config=src/main/resources/karaf.json Main
Main.java:
###
public class Main {
public static void main(String[] args){
System.out.println("Starting Karaf");
Karaf karaf = Karaf.builder().build();
karaf.start();
}
}
###
Best,
-- Jaap
|-----Oorspronkelijk bericht-----
|Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|Verzonden: vrijdag 24 september 2021 10:34
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Hi Jaap,
|
|The presentation is available here:
|
|https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKhcS
|VZJjlPk5FPxfBE/edit?usp=sharing
|
|Karaf 5 WIP is available here:
|
|https://github.com/jbonofre/karaf5
|
|I'm available on Slack or by email if you wanna chat about Karaf5.
|
|Regards
|JB
|
|On 24/09/2021 10:06, jgfrm wrote:
|> Hi,
|>
|> I have two questions about Karaf 5:
|> - is the presentation by Onofre at ApacheConf online somewhere?
|> - is it possible to explore Karaf 5 (or: what is there right now)? I
|> am in particular interested in the Spring Boot functionality, as I
|> have a Spring Boot application that I want to port to Karaf to support
|> dynamic loading of components. I have found the github repo of Onofre,
|> but it is unclear to me how e.g. to start Karaf.
|>
|> Best,
|>
|> -- Jaap
|>
RE: Karaf 5
Posted by jgfrm <fr...@gordijn.org>.
Excellent, many thanks.
I will first view your presentation (couldn't make it when it was presented unfortunately) and I case of questions come back to best.
Best,
-- Jaa[
|-----Oorspronkelijk bericht-----
|Van: Jean-Baptiste Onofré <jb...@nanthrax.net>
|Verzonden: vrijdag 24 september 2021 10:34
|Aan: user@karaf.apache.org
|Onderwerp: Re: Karaf 5
|
|Hi Jaap,
|
|The presentation is available here:
|
|https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKhcS
|VZJjlPk5FPxfBE/edit?usp=sharing
|
|Karaf 5 WIP is available here:
|
|https://github.com/jbonofre/karaf5
|
|I'm available on Slack or by email if you wanna chat about Karaf5.
|
|Regards
|JB
|
|On 24/09/2021 10:06, jgfrm wrote:
|> Hi,
|>
|> I have two questions about Karaf 5:
|> - is the presentation by Onofre at ApacheConf online somewhere?
|> - is it possible to explore Karaf 5 (or: what is there right now)? I
|> am in particular interested in the Spring Boot functionality, as I
|> have a Spring Boot application that I want to port to Karaf to support
|> dynamic loading of components. I have found the github repo of Onofre,
|> but it is unclear to me how e.g. to start Karaf.
|>
|> Best,
|>
|> -- Jaap
|>
Re: Karaf 5
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jaap,
The presentation is available here:
https://docs.google.com/presentation/d/1nDqd4oVbrggTDlwrzWc8zEdahKhcSVZJjlPk5FPxfBE/edit?usp=sharing
Karaf 5 WIP is available here:
https://github.com/jbonofre/karaf5
I'm available on Slack or by email if you wanna chat about Karaf5.
Regards
JB
On 24/09/2021 10:06, jgfrm wrote:
> Hi,
>
> I have two questions about Karaf 5:
> - is the presentation by Onofre at ApacheConf online somewhere?
> - is it possible to explore Karaf 5 (or: what is there right now)? I am in
> particular interested in the Spring Boot functionality, as I have a Spring
> Boot application that I want to port to Karaf to support dynamic loading of
> components. I have found the github repo of Onofre, but it is unclear to me
> how e.g. to start Karaf.
>
> Best,
>
> -- Jaap
>