Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fast-jar packaging for quarkus #360

Closed
lburgazzoli opened this issue Jun 11, 2020 · 8 comments
Closed

Support fast-jar packaging for quarkus #360

lburgazzoli opened this issue Jun 11, 2020 · 8 comments
Assignees
Labels
Milestone

Comments

@lburgazzoli
Copy link
Contributor

https://quarkus.io/blog/quarkus-1-5-final-released/#fast-jar-packaging-format

@lburgazzoli lburgazzoli added this to the 1.4.0 milestone Jun 11, 2020
@lburgazzoli lburgazzoli modified the milestones: 1.4.0, 1.5.0 Jun 24, 2020
@jamesnetherton
Copy link
Contributor

jamesnetherton commented Aug 20, 2020

I can try to take a look at this one.

Do we think there is anything required on the camel-k-runtime side to support fast-jar?

The operator can set a maven property for quarkus.package.type and then it's a case of ensuring the correct runner jar is picked up.

@lburgazzoli
Copy link
Contributor Author

The issue I see is that - if I'm not mistaking - the fast-jar packaging assumes the dependencies are in a specific location relative to the bootstrap jar but that does not hold true for camel-k as we don't deploy quarkus based application using the layout the plugin generates but we assemble the classpath.

I don't know if the location of the jars can be configured or if we need a specific BuildItem to control the fast-jar set-up so we may need to do something here.

@jamesnetherton
Copy link
Contributor

Right - that makes sense, thanks for clarifying.

I'll have a look.

@lburgazzoli lburgazzoli modified the milestones: 1.5.0, 1.6.0 Sep 16, 2020
@lburgazzoli lburgazzoli modified the milestones: 1.6.0, 1.7.0 Jan 11, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Jan 21, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Jan 21, 2021
@jamesnetherton jamesnetherton self-assigned this Jan 21, 2021
jamesnetherton added a commit to jamesnetherton/camel-k-runtime that referenced this issue Jan 21, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Jan 22, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Jan 22, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Jan 25, 2021
@jamesnetherton
Copy link
Contributor

I will probably have to revert the change I made to support fast-jar. There's a problem with loading Kotlin integrations.

The Kotlin bootstrap tries to do ClassLoader.findResources(""), but the Quarkus RunnerClassLoader can't handle it, because it tries and fails to do some string sanitization on the empty string:

2021-01-25 13:24:08,916 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
	at java.base/java.lang.String.charAt(String.java:693)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.sanitizeName(RunnerClassLoader.java:150)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.findResources(RunnerClassLoader.java:180)
	at java.base/java.lang.ClassLoader.getResources(ClassLoader.java:1467)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.rawClassPathFromKeyResourcePath(jvmClasspathUtil.kt:130)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.classPathFromTypicalResourceUrls(jvmClasspathUtil.kt:143)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt$classpathFromClassloader$1.invoke(jvmClasspathUtil.kt:87)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt$classpathFromClassloader$1.invoke(jvmClasspathUtil.kt)
	at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:315)
	at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:169)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:752)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:782)
	at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:773)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.classpathFromClassloader(jvmClasspathUtil.kt:92)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.scriptCompilationClasspathFromContextOrNull(jvmClasspathUtil.kt:275)
	at kotlin.script.experimental.jvm.util.JvmClasspathUtilKt.scriptCompilationClasspathFromContext(jvmClasspathUtil.kt:298)
	at kotlin.script.experimental.jvm.JvmScriptCompilationKt.dependenciesFromClassloader(jvmScriptCompilation.kt:57)
	at kotlin.script.experimental.jvm.JvmScriptCompilationKt.dependenciesFromClassloader$default(jvmScriptCompilation.kt:54)
	at org.apache.camel.k.loader.kotlin.KotlinCompilationConfiguration$1$1.invoke(KotlinCompilationConfiguration.kt:35)
	at org.apache.camel.k.loader.kotlin.KotlinCompilationConfiguration$1$1.invoke(KotlinCompilationConfiguration.kt:23)
	at kotlin.script.experimental.util.PropertiesCollection$Builder.invoke(propertiesCollection.kt:281)
	at org.apache.camel.k.loader.kotlin.KotlinCompilationConfiguration$1.invoke(KotlinCompilationConfiguration.kt:30)
	at org.apache.camel.k.loader.kotlin.KotlinCompilationConfiguration$1.invoke(KotlinCompilationConfiguration.kt:23)
	at kotlin.script.experimental.api.ScriptCompilationConfiguration.<init>(scriptCompilation.kt:22)
	at kotlin.script.experimental.api.ScriptCompilationConfiguration.<init>(scriptCompilation.kt:24)
	at org.apache.camel.k.loader.kotlin.KotlinCompilationConfiguration.<init>(KotlinCompilationConfiguration.kt:23)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at kotlin.script.experimental.host.ConfigurationFromTemplateKt.constructCompilationConfiguration(configurationFromTemplate.kt:212)
	at kotlin.script.experimental.host.ConfigurationFromTemplateKt.createCompilationConfigurationFromTemplate(configurationFromTemplate.kt:67)
	at org.apache.camel.k.loader.kotlin.KotlinSourceLoader.doLoad(KotlinSourceLoader.kt:88)
	at org.apache.camel.k.loader.kotlin.KotlinSourceLoader.access$doLoad(KotlinSourceLoader.kt:40)
	at org.apache.camel.k.loader.kotlin.KotlinSourceLoader$load$1.accept(KotlinSourceLoader.kt:47)
	at org.apache.camel.k.loader.kotlin.KotlinSourceLoader$load$1.accept(KotlinSourceLoader.kt:40)
	at org.apache.camel.k.support.RouteBuilders$1.configure(RouteBuilders.java:37)
	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:483)
	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:430)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:405)
	at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1110)
	at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:94)
	at org.apache.camel.main.BaseMainSupport.configureRoutes(BaseMainSupport.java:454)
	at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:474)
	at org.apache.camel.quarkus.main.CamelMain.initCamelContext(CamelMain.java:97)
	at org.apache.camel.quarkus.main.CamelMain.doInit(CamelMain.java:67)
	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:118)
	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:523)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:97)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:48)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)

@lburgazzoli
Copy link
Contributor Author

@jamesnetherton maybe we can improve the catalog to be able to set specific property per artefact

@jamesnetherton
Copy link
Contributor

For reference the bug is fixed in Quarkus 1.12.x quarkusio/quarkus#14583.

@jamesnetherton
Copy link
Contributor

Also for reference, in Quarkus 1.12, seems fast-jar will finally become the default. If we need to keep the old format for any reason then we'll need to configure quakus.package.type as legacy-jar.

jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Feb 23, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Feb 23, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Feb 24, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Mar 1, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Mar 1, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Mar 2, 2021
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue Mar 2, 2021
@jamesnetherton
Copy link
Contributor

This has been implemented here and in the camel-k project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants