Hi, Again thanks for a quick response. I tried to remove the http feature from startupFeatures but then Karaf does not start and I can see the following error in the log file:
Error resolving artifact org.ops4j.pax.web:pax-web-features:xml:config-jetty:8.0.6: [Could not find artifact org.ops4j.pax.web:pax-web-features:xml:config-jetty:8.0.6 in defaultlocal (file:/opt/apache-karaf-STABILIT-4.4.1/repository/), Could not find artifact org.ops4j.pax.web:pax-web-features:xml:config-jetty:8.0.6 in local.repository (file:/opt/apache-karaf-STABILIT-4.4.1/repository/)] at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.configureIOException(AetherBasedResolver.java:803) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:774) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:657) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:598) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:565) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:555) at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:123) at java.base/java.net.URL.openStream(Unknown Source) at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installConfigurationFile(FeatureConfigInstaller.java:304) at org.apache.karaf.features.internal.service.FeatureConfigInstaller.installFeatureConfigs(FeatureConfigInstaller.java:173) at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.installConfigs(BundleInstallSupportImpl.java:301) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.installConfigs(FeaturesServiceImpl.java:1185) at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:961) at org.apache.karaf.features.internal.service.Deployer.handlePrerequisites(Deployer.java:1121) at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:394) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Suppressed: shaded.org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.ops4j.pax.web:pax-web-features:xml:config-jetty:8.0.6 in defaultlocal (file:/opt/apache-karaf-STABILIT-4.4.1/repository/) at shaded.org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:48) at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:368) at shaded.org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:75) at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:642) at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:262) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:489) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:390) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:215) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:192) at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:247) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:767) ... 19 more Suppressed: shaded.org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.ops4j.pax.web:pax-web-features:xml:config-jetty:8.0.6 in local.repository (file:/opt/apache-karaf-STABILIT-4.4.1/repository/) at shaded.org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:48) at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:368) at shaded.org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:75) at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:642) at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:262) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:489) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:390) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:215) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:192) at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:247) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:767) ... 19 more Caused by: shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Error resolving artifact org.ops4j.pax.web:pax-web-features:xml:config-jetty:8.0.6 at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:413) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:215) at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:192) at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:247) at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:767) I guess that there is still some other feature which requires jetty. Looking at the standard features I believe it is the war feature. War feature is specified in my feature.xml file as follows: <feature prerequisite="true">war</feature>. Is there a way how to deploy WAB file and use tomcat as the container? Best Regards Martin Zukal P.S.: I am going to send another email regarding the startup and boot features. From: Grzegorz Grzybek <gr.grzy...@gmail.com> Sent: Thursday, November 3, 2022 11:04 AM To: user@karaf.apache.org; Martin Zukal <martin.zu...@stabilit.ch> Subject: Re: webconsole and pax-web-http-tomcat Hi about "pax-web-http-jetty", just get rid of "<startupFeature>http</startupFeature>" because it's quite legacy/convenient feature defined like this: <feature name="http" description="Transition feature for backward compatibility" version="8.0.6"> <feature>pax-web-http</feature> </feature> and "pax-web-http" (notice that the feature name doesn't specify the runtime to choose: jetty, tomcat or undertow) is: <feature name="pax-web-http" description="Pax Web OSGi HTTP Service" version="8.0.6"> <feature>pax-web-http-jetty</feature> <bundle start-level="30">mvn:org.apache.karaf.http/org.apache.karaf.http.core/4.4.1</bundle> <capability>http-service;provider:=pax-http</capability> <conditional> <condition>webconsole</condition> <bundle start-level="30">mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.http/4.4.1</bundle> </conditional> </feature> So you just need "pax-web-http-tomcat" (or "pax-web-http-jetty" or "pax-web-http-undertow") specified explicitly. Webconsole is listed in the bootFeatures (see above). […] Actually, it's specified in <startupFeatures> :) that's big difference - you're effectively doing (karaf-maven-plugin is doing) the resolution at build time, so you simply get a big list of bundles inside etc/startup.properties. This makes uninstalling the features a bit harder. In other words - "<startupFeatures>" vs. "<bootFeatures>" is like bundle vs feature. With "startup features" you're "flattening" the features into a list of bundles. It may speed things up, but generally I'm not recommending it. And finally, to see what's the problem, you can increase logging level of "org.ops4j.pax.web.extender.war" (to DEBUG or even TRACE) to get a lot of information about ServletContainerInitializers and annotated classes being discovered. I still hope that removing pax-web-http-jetty (by not including "http" feature) will solve your problem. regards Grzegorz Grzybek czw., 3 lis 2022 o 10:36 Martin Zukal via user <user@karaf.apache.org <mailto:user@karaf.apache.org> > napisał(a): Hello and thank you for a quick response! Sorry, I forgot to include the versions. I am running Apache Karaf 4.4.1 which comes with Pax Web 8.0.6. I looked at the samples and they already helped me a lot but I will look at them once again, maybe I missed something. Basically, I followed: https://github.com/ops4j/org.ops4j.pax.web/blob/web-8.0.11/samples/samples-jsf/war-primefaces-wired/pom.xml You actually don't uninstall features using karaf-maven-plugin - you declare features you want, and karaf-maven-plugin will put the features into boot features (etc/org.apache.karaf.features.cfg - when in runtime scope) or into startup bundles (etc/startup.properties - when in compile scope). So definitely you have to fix your <configuration> for karaf-maven-plugin. I have the following dependencies in my pom.xml (used to build custom Karaf distribution) <dependency> <groupId>org.apache.karaf.features</groupId> <artifactId>framework</artifactId> <version>${karaf.version}</version> <type>kar</type> </dependency> <dependency> <groupId>org.apache.karaf.features</groupId> <artifactId>framework</artifactId> <version>${karaf.version}</version> <classifier>features</classifier> <type>xml</type> <scope>runtime</scope> </dependency> <dependency> <groupId>org.apache.karaf.features</groupId> <artifactId>standard</artifactId> <version>${karaf.version}</version> <classifier>features</classifier> <type>xml</type> <scope>runtime</scope> </dependency> And I listed the following features in startupFeatures: <startupFeatures> <startupFeature>framework-logback</startupFeature> <startupFeature>instance</startupFeature> <startupFeature>package</startupFeature> <startupFeature>log</startupFeature> <startupFeature>ssh</startupFeature> <startupFeature>system</startupFeature> <startupFeature>feature</startupFeature> <startupFeature>shell</startupFeature> <startupFeature>management</startupFeature> <startupFeature>service</startupFeature> <startupFeature>jaas</startupFeature> <startupFeature>deployer</startupFeature> <startupFeature>diagnostic</startupFeature> <startupFeature>wrap</startupFeature> <startupFeature>bundle</startupFeature> <startupFeature>config</startupFeature> <startupFeature>http</startupFeature> <startupFeature>webconsole</startupFeature> <startupFeature>pax-web-http-tomcat</startupFeature> </startupFeatures> This results in the above declared features listed in bootFeatures in etc/org.apache.karaf.features.cfg. When I start Karaf with this set up without my application the webconsole works fine and I can see the following on the features page: pax-web-http-jetty 8.0.6 org.ops4j.pax.web-8.0.6 Installed pax-web-http-tomcat 8.0.6 org.ops4j.pax.web-8.0.6 Installed Therefore I asked whether it i possible to uninstall pax-web-http-jetty. 2nd - how do you install the webconsole and/or your JSF bundle? Are then installed as WAR (WAB) files? May I see them? I don't claim that the problem is only at your side - maybe Pax Web didn't anticpate some setup and I'd be happy to help solving this problem. Webconsole is listed in the bootFeatures (see above). My application consists of a lot of bundles but the one with the UI is a WAB (war packaging with manifest which includes: Web-ContextPath: /main). Primefaces and JSF are wired using the Require-Bundle header in manifest: <Require-Bundle> javax.faces-api, org.primefaces </Require-Bundle> All the bundles and their dependencies (JSF, primefaces etc.) are listed in a feature.xml file which I place in the deploy directory in Karaf. The application loads and works fine. I am just having problem with the webconsole. I unfortunately cannot share the code of the bundles. But I am happy to provide more information if necessary. Let me know if you need more information. Best regards Martin Zukal From: Grzegorz Grzybek <gr.grzy...@gmail.com <mailto:gr.grzy...@gmail.com> > Sent: Thursday, November 3, 2022 9:56 AM To: user@karaf.apache.org <mailto:user@karaf.apache.org> ; Martin Zukal <martin.zu...@stabilit.ch <mailto:martin.zu...@stabilit.ch> > Subject: Re: webconsole and pax-web-http-tomcat Hello First - which Karaf version are you using? Assuming it's Karaf 4.4.x with Pax Web 8.0.x I can try helping. Pax Web 8 is highly refactored major version of the project where we've tried to make sure that things like JSF (which rely heavily on ServletContainerInitializers) work smoothly. There are dedicated tests both for webconsole and for JSF (MyFaces, Primefaces) and even for techs like Vaadin. Check the JSF samples at https://github.com/ops4j/org.ops4j.pax.web/tree/web-8.0.11/samples/samples-jsf Is it possible that the behavior is caused by conflict between pax-web-http-jetty and pax-web-http-tomcat? Is there a way how to uninstall pax-web-http-jetty using karaf-maven-plugin? You actually don't uninstall features using karaf-maven-plugin - you declare features you want, and karaf-maven-plugin will put the features into boot features (etc/org.apache.karaf.features.cfg - when in runtime scope) or into startup bundles (etc/startup.properties - when in compile scope). So definitely you have to fix your <configuration> for karaf-maven-plugin. 2nd - how do you install the webconsole and/or your JSF bundle? Are then installed as WAR (WAB) files? May I see them? I don't claim that the problem is only at your side - maybe Pax Web didn't anticpate some setup and I'd be happy to help solving this problem. kind regards Grzegorz Grzybek czw., 3 lis 2022 o 09:46 Martin Zukal via user <user@karaf.apache.org <mailto:user@karaf.apache.org> > napisał(a): Hello everyone, I am experiencing strange behavior with webconsole of Apache Karaf. I have an application deployed using a custom feature file in Apache Karaf. The application is based on Spring and is using Primefaces (and Mojarra JSF implementation version 2.2.15). When I run it with standard war feature (which by default installs pax-web-http-jetty) I am getting the following error messages in the log file: Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI? Unable to inject com.sun.faces.application.ApplicationFactoryImpl@5005965f <mailto:com.sun.faces.application.ApplicationFactoryImpl@5005965f> because no InjectionProvider can be found. Does this container implement the Mojarra Injection SPI? However, the webconsole works perfectly in this case. When I install the pax-web-http-tomcat feature the above mentioned error messages are gone but the webconsole is not working properly (the resources from res and lib are not loaded so I see allmost an empty page - see attachment). I can see the following errors in the log file: [2022-11-03 09:29:26.358] INFO tp-nio2-0.0.0.0-8080-exec-10 o.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/] Marking servlet [default-56ee4de3-f9f8-44c8-96ea-4580393e6469] as unavailable [2022-11-03 09:29:26.360] ERROR tp-nio2-0.0.0.0-8080-exec-10 o.a.c.c.C.[.[.[/].[default-56ee4de3-f9f8-44c8-96ea-4580393e6469] Allocate exception for servlet [default-56ee4de3-f9f8-44c8-96ea-4580393e6469] javax.servlet.UnavailableException: No static resources were found at org.apache.catalina.servlets.DefaultServlet.init(DefaultServlet.java:384) at org.ops4j.pax.web.service.tomcat.internal.web.TomcatResourceServlet.init(TomcatResourceServlet.java:87) at javax.servlet.GenericServlet.init(GenericServlet.java:180) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1164) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:804) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:128) at org.ops4j.pax.web.service.tomcat.internal.PaxWebStandardWrapperValve.invoke(PaxWebStandardWrapperValve.java:50) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.ops4j.pax.web.service.tomcat.internal.PaxWebStandardContextValve.invoke(PaxWebStandardContextValve.java:98) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) at org.apache.tomcat.util.net <http://org.apache.tomcat.util.net> .Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1701) at org.apache.tomcat.util.net <http://org.apache.tomcat.util.net> .SocketProcessorBase.run(SocketProcessorBase.java:49) at org.apache.tomcat.util.net <http://org.apache.tomcat.util.net> .AbstractEndpoint.processSocket(AbstractEndpoint.java:1190) at org.apache.tomcat.util.net <http://org.apache.tomcat.util.net> .Nio2Endpoint$Nio2SocketWrapper$2.completed(Nio2Endpoint.java:633) at org.apache.tomcat.util.net <http://org.apache.tomcat.util.net> .Nio2Endpoint$Nio2SocketWrapper$2.completed(Nio2Endpoint.java:611) at java.base/sun.nio.ch.Invoker.invokeUnchecked(Unknown Source) at java.base/sun.nio.ch.Invoker$2.run(Unknown Source) at java.base/sun.nio.ch <http://sun.nio.ch> .AsynchronousChannelGroupImpl$1.run(Unknown Source) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Unknown Source) Does it mean that the webconsole works only with pax-web-http-jetty? I can also see that both pax-web-http-jetty and pax-web-http-tomcat features are installed. Is it possible that the behavior is caused by conflict between pax-web-http-jetty and pax-web-http-tomcat? Is there a way how to uninstall pax-web-http-jetty using karaf-maven-plugin? Any help with this issue will be appreciated. Best regards Martin Zukal