Thanks for the reproducer +Martin Zukal <[email protected]> !

I found that it is indeed a problem with pax-web-http-tomcat. Jetty and
Undertow runtimes are fine.

I've created https://github.com/ops4j/org.ops4j.pax.web/issues/1784 to
track this and I already have a fix.

I know that Undertow 2.2.21 is going to be released soon, so please give me
few days to prepare new 8.0.x release of Pax Web.

kind regards
Grzegorz Grzybek

pt., 4 lis 2022 o 11:12 Martin Zukal via user <[email protected]>
napisał(a):

> Hi,
>
> Thanks for your hint to use mvn:io.hawt/hawtio-osgi/2.15.0/war web
> application for testing. It would be really cumbersome to get something
> meaningful from the log file when running with my application.
>
> So I created a feature.xml file with the following content:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
>
>
> <features name="application-40.0.1-SNAPSHOT"
>
>                 xmlns=http://karaf.apache.org/xmlns/features/v1.4.0
>
>                 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
>
>                 xsi:schemaLocation=
> http://karaf.apache.org/xmlns/features/v1.4.0>
>
>
>
>                 <feature name="application" install="auto"
> version="40.0.1-SNAPSHOT">
>
>                                <feature prerequisite="true">jpa</feature>
>
>                                <feature
> prerequisite="true">hibernate</feature>
>
>                                <feature
> prerequisite="true">spring</feature>
>
>                                <feature
> prerequisite="true">spring-jdbc</feature>
>
>                                <feature
> prerequisite="true">spring-orm</feature>
>
>                                <feature
> prerequisite="true">spring-aspects</feature>
>
>                                <feature
> prerequisite="true">spring-instrument</feature>
>
>                                <feature
> prerequisite="true">spring-security</feature>
>
>                                <feature
> prerequisite="true">spring-web</feature>
>
>                                <feature
> prerequisite="true">spifly</feature>
>
>                                <feature
> prerequisite="true">pax-web-war</feature>
>
>
> <bundle>mvn:io.hawt/hawtio-osgi/2.15.0/war</bundle>
>
>                 </feature>
>
> </features>
>
>
>
> The feature.xml file is placed in the deploy directory. When I start Karaf
> it loads successfully but when I try to access /system/console page I get
> the already mentioned error in the log file.
>
> To complete the information I have the following features listed in
> featuresBoot:
>
> featuresBoot = \
>
>     instance/4.4.1, \
>
>     package/4.4.1, \
>
>     log/4.4.1, \
>
>     ssh/4.4.1, \
>
>     pax-web-http-tomcat/8.0.6, \
>
>     webconsole/4.4.1, \
>
>     framework-logback/4.4.1, \
>
>     system/4.4.1, \
>
>     feature/4.4.1, \
>
>     shell/4.4.1, \
>
>     management/4.4.1, \
>
>     service/4.4.1, \
>
>     jaas/4.4.1, \
>
>     deployer/4.4.1, \
>
>     diagnostic/4.4.1, \
>
>     wrap/2.6.11, \
>
>     bundle/4.4.1, \
>
>     config/4.4.1
>
>
>
> I believe you should be able to reproduce it as well and possibly debug it
> if necessary.
>
> My humbe guess would be that the problem might be caused by the spring-web
> feature.
>
> Regards
>
> Martin Zukal
>
>
>
> *From:* Grzegorz Grzybek <[email protected]>
> *Sent:* Thursday, November 3, 2022 3:41 PM
> *To:* [email protected]; Martin Zukal <[email protected]>
> *Subject:* Re: webconsole and pax-web-http-tomcat
>
>
>
> Hi
>
>
>
> OK, I checked the scenario (Karaf 4.4.1, Pax Web 8.0.6,
> pax-web-http-tomcat and mvn:io.hawt/hawtio-osgi/2.15.0/war web application).
>
>
>
> The missing RESOURCES_ATTR attribute in your case is available in my case
> and is added with this code (in
> org.apache.catalina.core.StandardContext#startInternal()):
>
>
>
> if (ok) {
>     getServletContext().setAttribute
>         (Globals.RESOURCES_ATTR, getResources());
>
>
>
> so looks like "ok" is false ;) please increase logging for
> "org.ops4j.pax.web.extender.war" logger to see what may be wrong.
>
>
>
> regards
>
> Grzegorz Grzybek
>
>
>
> czw., 3 lis 2022 o 14:47 Grzegorz Grzybek <[email protected]>
> napisał(a):
>
> Let me check this, because there's obvious check in Tomcat code:
>
>
>
> // Load the web resources
> resources = (WebResourceRoot)
> getServletContext().getAttribute(Globals.RESOURCES_ATTR);
> if (resources == null) {
>     throw new
> UnavailableException(sm.getString("defaultServlet.noResources"));
> }
>
>
>
> I'm sure I've added enough customization, but maybe something's wrong with
> Tomcat upgrade? Give me few hours (I have urgent tasks to do..)
>
>
>
> regards
>
> Grzegorz Grzybek
>
>
>
> czw., 3 lis 2022 o 14:34 Martin Zukal via user <[email protected]>
> napisał(a):
>
> Hi,
>
> Thanks a lot! I finally got rid off the jetty feature when using the
> pax-web-war.
>
> Unfortunately, I still see the following errors in the log file:
>
> [2022-11-03 14:21:03.337] INFO  ttp-nio2-0.0.0.0-8080-exec-4
> o.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]  Marking
> servlet [default-e4573fbf-222b-4d8d-a8b6-3509f9ba89f9] as unavailable
>
> [2022-11-03 14:21:03.341] ERROR ttp-nio2-0.0.0.0-8080-exec-4
> o.a.c.c.C.[.[.[/].[default-e4573fbf-222b-4d8d-a8b6-3509f9ba89f9] Allocate
> exception for servlet [default-e4573fbf-222b-4d8d-a8b6-3509f9ba89f9]
> 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.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1701)
>
>                 at
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
>
>                 at
> org.apache.tomcat.util.net.AbstractEndpoint.processSocket(AbstractEndpoint.java:1190)
>
>                 at
> org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper$2.completed(Nio2Endpoint.java:633)
>
>                 at
> org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper$2.completed(Nio2Endpoint.java:611)
>
>                 at
> java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:127)
>
>                 at java.base/sun.nio.ch.Invoker$2.run(Invoker.java:219)
>
>                 at
> java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
>
>                 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(Thread.java:829)
>
>
>
> The weird thing is that when I run Karaf locally (where it is configured
> to resolve the dependencies from my local maven repository) the console
> works. I can see the bundles, services, features etc. However, the menu
> item http under Main is not displayed.
>
> When I run Karaf in test environment (based on docker) where it is
> configured to resolve the dependencies from system or repository
> directories I see the alsmost empty page which I sent in attachment in my
> first email.
>
> The above mentioned errors are in the log file In both cases.´
>
> Best regards
>
> Martin Zukal
>
>
>
> *From:* Grzegorz Grzybek <[email protected]>
> *Sent:* Thursday, November 3, 2022 12:33 PM
> *To:* [email protected]; Martin Zukal <[email protected]>
> *Subject:* Re: webconsole and pax-web-http-tomcat
>
>
>
> Ah - I forgot about "war"...
>
>
>
> It's defined as:
>
>
>
>     <feature name="war" description="Transition feature for backward
> compatibility" version="4.4.1">
>         <feature>pax-web-http-war</feature>
>     </feature>
>
>
>
> which again leads to Jetty. You need "pax-web-war" feature, which doesn't
> enforce any particular runtime, so you have to use one explicitly - like
> pax-web-http-tomcat.
>
>
>
> regards
>
> Grzegorz Grzybek
>
>
>
> czw., 3 lis 2022 o 12:28 Martin Zukal via user <[email protected]>
> napisał(a):
>
> 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 <[email protected]>
> *Sent:* Thursday, November 3, 2022 11:04 AM
> *To:* [email protected]; Martin Zukal <[email protected]>
> *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 <[email protected]>
> 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 <[email protected]>
> *Sent:* Thursday, November 3, 2022 9:56 AM
> *To:* [email protected]; Martin Zukal <[email protected]>
> *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 <[email protected]>
> 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
> 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
> .Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1701)
>         at org.apache.tomcat.util.net
> .SocketProcessorBase.run(SocketProcessorBase.java:49)
>         at org.apache.tomcat.util.net
> .AbstractEndpoint.processSocket(AbstractEndpoint.java:1190)
>         at org.apache.tomcat.util.net
> .Nio2Endpoint$Nio2SocketWrapper$2.completed(Nio2Endpoint.java:633)
>         at 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.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
>
>

Reply via email to