Hi Martin,

Generally speaking, I would recommend bootFeatures (startupFeatures
are more for Karaf internals or specific use cases).

Regards
JB

On Wed, Nov 9, 2022 at 11:24 AM Martin Zukal via user
<user@karaf.apache.org> wrote:
>
> Hi,
> Thanks for pointing me to the right documentation.
> So the best practice is to use:
> bootFeatures with runtime scope dependencies (features)
> or
> startupFeatures with compile scope dependencies (features)
> is that right?
> I currently use startupFeatures with runtime scope dependencies which is 
> apparently wrong (but it produces the same result as if bootFeatures are 
> used).
> Regards
> Martin Zukal
>
>
> -----Original Message-----
> From: Jean-Baptiste Onofré <j...@nanthrax.net>
> Sent: Sunday, November 6, 2022 11:32 AM
> To: user@karaf.apache.org
> Cc: Martin Zukal <martin.zu...@stabilit.ch>
> Subject: Re: startupFeatures vs. bootFeatures when building custom karaf 
> distribution
>
> Hi,
>
> As reminder, it's documented here:
> https://karaf.apache.org/manual/latest/#_instances_and_distributions_goals
>
> Especially you can see:
>
> startupFeatures | List<String> | List of features from compile-scope features 
> XML files and KARs to be installed into system repo and listed in 
> etc/startup.properties.
> bootFeatures | List<String> | List of features from runtime-scope features 
> XML files and KARs to be installed into system repo and listed in 
> featuresBoot property in etc/org.apache.karaf.features.cfg
>
> Regards
> JB
>
> On Thu, Nov 3, 2022 at 12:47 PM Grzegorz Grzybek <gr.grzy...@gmail.com> wrote:
> >
> > Hello
> >
> >> When I tried to replace the <startupFeatures> with <bootFeatures> Karaf 
> >> failed to start (the log file is completely empty).
> >
> >
> > In previous email I didn't explain enough about the difference. What I said 
> > could be confusing, though it's true:
> >
> > compile scoped dependencies and/or features declared in
> > <startupFeatures> are effectively replaced by a list of bundles and
> > put into etc/startup.properties runtime scoped dependencies and/or
> > features declared in <bootFeatures> are declared in "featuresBoot"
> > property in etc/org.apache.karaf.features.cfg
> >
> > In both cases, you get your dependencies in "system/" directory of your 
> > custom distro.
> >
> > What I didn't mention is that you actually need _some_ features to be 
> > startupFeatures - most importantly the "feature" feature ;) The point is 
> > that in order to install features (from etc/org.apache.karaf.features.cfg) 
> > you need a bundle running that reads this file, so this bundle 
> > (org.apache.karaf.features.core) needs to be installed directly - from 
> > etc/startup.properties.
> >
> > Please have a look at the configuration of karaf-maven-plugin of the
> > Apache Karaf distro itself:
> > https://github.com/apache/karaf/blob/karaf-4.4.2/assemblies/apache-kar
> > af/pom.xml While "feature" feature is not a startup feature, there's
> > compile-scoped dependency:
> >
> >         <dependency>
> >             <groupId>org.apache.karaf.features</groupId>
> >             <artifactId>framework</artifactId>
> >             <type>kar</type>
> >         </dependency>
> >
> > it (through a bit complex stages) installs a startup feature called 
> > "framework" which includes the org.apache.karaf.features.core bundle as 
> > startup bundle.
> > You're using "framework-logback" variant of this feature and it has to be 
> > kept as startupFeature.
> >
> > regards
> > Grzegorz Grzybek
> >
> > czw., 3 lis 2022 o 12:35 Martin Zukal via user <user@karaf.apache.org> 
> > napisał(a):
> >>
> >> Hello,
> >>
> >> To be honest I am confused about the <startupFeatures> and
> >> <bootFeatures>. I followed the documentation here:
> >> https://svn.apache.org/repos/asf/karaf/site/production/manual/latest/
> >> custom-distribution.html#_plugin_configuration but it did not work
> >> the way I expected. I am trying to build a custom Karaf distribution
> >> which should resolve all artifacts locally (not in the maven
> >> repository). The idea is to have all artifacts needed by Karaf itself
> >> in the <KARAF_HOME>/system directory and all artifacts required by my
> >> application in a new directory <KARAF_HOME>/repository. I firstly
> >> build the „bare“ karaf and then I add the repository directory (which
> >> is generated using karaf-maven-plugin but using the
> >> <goal>features-add-to-repository</goal> based on my feature.xml file
> >> )
> >>
> >> I created the following pom.xml:
> >>
> >>
> >>
> >> <project xmlns=http://maven.apache.org/POM/4.0.0
> >>
> >>                 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
> >>
> >>                 xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
> >> http://maven.apache.org/xsd/maven-4.0.0.xsd>
> >>
> >>                 <modelVersion>4.0.0</modelVersion>
> >>
> >>
> >>
> >>
> >>
> >>                 <groupId>ch.stabilit</groupId>
> >>
> >>                 <artifactId>apache-karaf-STABILIT</artifactId>
> >>
> >>                 <version>4.4.1</version>
> >>
> >>                 <name>Apache Karaf distribution</name>
> >>
> >>                 <packaging>karaf-assembly</packaging>
> >>
> >>
> >>
> >>
> >>
> >>                 <properties>
> >>
> >>                                <karaf.version>4.4.1</karaf.version>
> >>
> >>                 </properties>
> >>
> >>
> >>
> >>                 <dependencies>
> >>
> >>                                <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>
> >>
> >>                 </dependencies>
> >>
> >>
> >>
> >>                 <build>
> >>
> >>                                <plugins>
> >>
> >>                                                <plugin>
> >>
> >>
> >> <groupId>org.apache.karaf.tooling</groupId>
> >>
> >>
> >> <artifactId>karaf-maven-plugin</artifactId>
> >>
> >>
> >> <version>${karaf.version}</version>
> >>
> >>
> >> <extensions>true</extensions>
> >>
> >>
> >> <executions>
> >>
> >>
> >> <execution>
> >>
> >>
> >> <id>assembly</id>
> >>
> >>
> >> <phase>prepare-package</phase>
> >>
> >>
> >> <goals>
> >>
> >>
> >> <goal>assembly</goal>
> >>
> >>
> >> </goals>
> >>
> >>
> >> </execution>
> >>
> >>
> >> </executions>
> >>
> >>
> >> <configuration>
> >>
> >>
> >> <bootRepositories>
> >>
> >>
> >> <bootRepository>mvn:org.apache.karaf.features/spring/${karaf.version}
> >> /xml/features</bootRepository>
> >>
> >>
> >> <bootRepository>mvn:org.apache.karaf.features/specs/${karaf.version}/
> >> xml/features</bootRepository>
> >>
> >>
> >> <bootRepository>mvn:org.apache.karaf.features/enterprise/${karaf.vers
> >> ion}/xml/features</bootRepository>
> >>
> >>
> >> </bootRepositories>
> >>
> >>
> >> <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>webconsole</startupFeature>
> >>
> >>
> >> <startupFeature>pax-web-http-tomcat</startupFeature>
> >>
> >>
> >> </startupFeatures>
> >>
> >>
> >> <useReferenceUrls>true</useReferenceUrls>
> >>
> >>
> >> <installAllFeaturesByDefault>false</installAllFeaturesByDefault>
> >>
> >>
> >> <framework>framework-logback</framework>
> >>
> >>
> >> <archiveTarGz>false</archiveTarGz>
> >>
> >>
> >> <propertyEdits>
> >>
> >>
> >> <edits>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>config.properties</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>karaf.framework</key>
> >>
> >>
> >> <value>equinox</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>config.properties</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>extend</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.osgi.framework.system.packages</key>
> >>
> >>
> >> <value>com.sun.jndi.ldap</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>config.properties</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>extend</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.osgi.framework.system.packages</key>
> >>
> >>
> >> <value>com.sun.jndi.url.ldap</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>config.properties</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>extend</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.osgi.framework.bootdelegation</key>
> >>
> >>
> >> <value> com.sun.jndi.ldap.*</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>users.properties</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>_g_:admingroup</key>
> >>
> >>
> >> <value>group,admin,manager,viewer,systembundles,ssh</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>users.properties</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>karaf</key>
> >>
> >>
> >> <value>karaf,_g_:admingroup</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>org.ops4j.pax.logging.cfg</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.ops4j.pax.logging.logback.config.file</key>
> >>
> >>
> >> <value>${karaf.base}/configuration/serviceability.xml</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>system.properties</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>karaf.clean.all</key>
> >>
> >>
> >> <value>true</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>org.ops4j.pax.web.cfg</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.osgi.service.http.port</key>
> >>
> >>
> >> <value>8080</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>org.ops4j.pax.url.mvn.cfg</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.ops4j.pax.url.mvn.localRepository</key>
> >>
> >>
> >> <value>${karaf.base}/repository</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>org.ops4j.pax.url.mvn.cfg</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.ops4j.pax.url.mvn.defaultLocalRepoAsRemote</key>
> >>
> >>
> >> <value>true</value>
> >>
> >>
> >> </edit>
> >>
> >>
> >> <edit>
> >>
> >>
> >> <file>org.ops4j.pax.url.mvn.cfg</file>
> >>
> >>
> >> <operation>
> >>
> >>
> >> <operation>put</operation>
> >>
> >>
> >> </operation>
> >>
> >>
> >> <key>org.ops4j.pax.url.mvn.repositories</key>
> >>
> >>
> >> <value>${karaf.home.uri}repository@id=local.repository@snapshots</val
> >> ue>
> >>
> >>
> >> </edit>
> >>
> >>
> >> </edits>
> >>
> >>
> >> </propertyEdits>
> >>
> >>
> >> </configuration>
> >>
> >>
> >>
> >>                                                </plugin>
> >>
> >>                                </plugins>
> >>
> >>                 </build>
> >>
> >> </project>
> >>
> >>
> >>
> >> With which I am able to build Karaf distribution which satisfies all my 
> >> requirements.
> >>
> >>
> >>
> >> You wrote that using startupFeatures will create a large 
> >> startup.properties file. This is something I don’t observe. My 
> >> startup.properties looks like this:
> >>
> >> # Bundles to be started on startup, with startlevel
> >>
> >> reference\:file\:org/apache/karaf/features/org.apache.karaf.features.
> >> extension/4.4.1/org.apache.karaf.features.extension-4.4.1.jar = 1
> >>
> >> reference\:file\:org/ops4j/pax/url/pax-url-aether/2.6.11/pax-url-aeth
> >> er-2.6.11.jar = 5
> >>
> >> reference\:file\:org/ops4j/pax/logging/pax-logging-logback/2.1.3/pax-
> >> logging-logback-2.1.3.jar = 8
> >>
> >> reference\:file\:org/ops4j/pax/logging/pax-logging-api/2.1.3/pax-logg
> >> ing-api-2.1.3.jar = 8
> >>
> >> reference\:file\:org/osgi/org.osgi.util.function/1.2.0/org.osgi.util.
> >> function-1.2.0.jar = 9
> >>
> >> reference\:file\:org/osgi/org.osgi.util.promise/1.2.0/org.osgi.util.p
> >> romise-1.2.0.jar = 9
> >>
> >> reference\:file\:org/apache/felix/org.apache.felix.coordinator/1.0.2/
> >> org.apache.felix.coordinator-1.0.2.jar = 9
> >>
> >> reference\:file\:org/apache/felix/org.apache.felix.converter/1.0.14/o
> >> rg.apache.felix.converter-1.0.14.jar = 9
> >>
> >> reference\:file\:org/apache/felix/org.apache.felix.configadmin/1.9.24
> >> /org.apache.felix.configadmin-1.9.24.jar = 10
> >>
> >> reference\:file\:org/apache/felix/org.apache.felix.configurator/1.0.1
> >> 4/org.apache.felix.configurator-1.0.14.jar = 11
> >>
> >> reference\:file\:org/apache/sling/org.apache.sling.commons.johnzon/1.
> >> 2.14/org.apache.sling.commons.johnzon-1.2.14.jar = 11
> >>
> >> reference\:file\:org/apache/felix/org.apache.felix.configadmin.plugin
> >> .interpolation/1.2.4/org.apache.felix.configadmin.plugin.interpolatio
> >> n-1.2.4.jar = 11
> >>
> >> reference\:file\:org/apache/felix/org.apache.felix.cm.json/1.0.6/org.
> >> apache.felix.cm.json-1.0.6.jar = 11
> >>
> >> reference\:file\:org/apache/felix/org.apache.felix.fileinstall/3.7.4/
> >> org.apache.felix.fileinstall-3.7.4.jar = 12
> >>
> >> reference\:file\:org/apache/karaf/features/org.apache.karaf.features.
> >> core/4.4.1/org.apache.karaf.features.core-4.4.1.jar = 15
> >>
> >>
> >>
> >> When I tried to replace the <startupFeatures> with <bootFeatures> Karaf 
> >> failed to start (the log file is completely empty).
> >>
> >> I would really appreciate if you could point me to a good documentation on 
> >> startupFeatures and bootFeatures.
> >>
> >>
> >>
> >> Best regards
> >>
> >> Martin Zukal
> >>
> >>
> >>
> >> 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> 
> >> 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/sa
> >> mples-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>
> >> Sent: Thursday, November 3, 2022 9:56 AM
> >> To: user@karaf.apache.org; Martin Zukal <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/sa
> >> mples-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> 
> >> 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