You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Vamsikrishna Koka <va...@motivitylabs.com.INVALID> on 2022/11/07 10:24:36 UTC

Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Hi Team,

I have migrated KARAF (from 4.2.15 to 4.4.1) and JDK (Open JDK 8 to OpenJDK 11) along with required dependency also. As per KARAF release NOTE.

There is issue with jetty xml configuration and org.ops4j.pax.web.cfg.

Jetty.xml file

<Call name="addConnector">
        <Arg>
            <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="Server" /></Arg>
                <Arg name="acceptors" type="int"><Property name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
                <Arg name="selectors" type="int"><Property name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <!-- uncomment to support proxy protocol
                        <Item>
                          <New class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
                        </Item>-->
                    </Array>
                </Arg>
                <Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host" /></Set>
                <Set name="port"><Property name="jetty.ssl.port" deprecated="ssl.port" default="8443"/></Set>
                <Set name="name">127.0.0.1:8443</Set>
                <Set name="idleTimeout"><Property name="jetty.ssl.idleTimeout" deprecated="ssl.timeout" default="30000"/></Set>
                <Set name="soLingerTime"><Property name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime" default="-1"/></Set>
                <Set name="acceptorPriorityDelta"><Property name="jetty.ssl.acceptorPriorityDelta" deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
                <Set name="acceptQueueSize"><Property name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize" default="0"/></Set>
            </New>
        </Arg>
    </Call>


org.ops4j.pax.web.cfg

org.osgi.service.http.port=8181
org.osgi.service.http.secure.enabled=true
org.osgi.service.http.port.secure=8443
org.ops4j.pax.web.listening.addresses=127.0.0.1
org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
org.ops4j.pax.web.session.timeout=30


The above configuration perfectly working on KARAF 4.2.15 version both jetty 9.4.43 and pax web 7.2.29. So, I have migrated jetty and Pax web dependency part of the KARAF upgrade 4.4.1 version.

Tried to start KARAF 4.4.1 server on console logs, I have seen  More than one HttpConfiguration found in external Jetty configuration. Using HttpConfiguration and Failed to bind to /127.0.0.1:8443. Understand some where latest PAX Web also started container with port 8443. If I change port my login page does not able to land on browser.

Difference b/w Pax-Web 7.2.29 and 8.0.6 version.

Pax-Web 7.2.29

OPS4J Pax Web - APIorg.ops4j.pax.web.pax-web-api                                                                       7.2.29          Active
OPS4J Pax Web - Deployment Descriptor Modelorg.ops4j.pax.web.pax-web-descriptor         7.2.29          Active
OPS4J Pax Web - Extender - WARorg.ops4j.pax.web.pax-web-extender-war                             7.2.29          Active
OPS4J Pax Web - Extender - Whiteboardorg.ops4j.pax.web.pax-web-extender-whiteboard  7.2.29          Active
OPS4J Pax Web - FileInstall Deployerorg.ops4j.pax.web.pax-web-deployer                                7.2.29          Active
OPS4J Pax Web - Jettyorg.ops4j.pax.web.pax-web-jetty                                                                7.2.29          Active
OPS4J Pax Web - Jsp Supportorg.ops4j.pax.web.pax-web-jsp        7.2.29                                           Active
OPS4J Pax Web - Runtimeorg.ops4j.pax.web.pax-web-runtime   7.2.29                                           Active
OPS4J Pax Web - Service SPIorg.ops4j.pax.web.pax-web-spi         7.2.29                                           Active


karaf@root()> list -s -t 0 | grep "org.ops4j.pax.web"

252 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-api
253 | Resolved |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-compatibility-el2
254 | Resolved |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-compatibility-servlet31
255 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-extender-war
256 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-jetty
257 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-jsp
258 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-runtime
259 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-spi
260 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-tomcat-common
261 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-websocket

ERROR :  Tried to restart the above bundle 253 AND 254. I got the an error Caused by: org.osgi.framework.BundleException: Fragment bundles can not be started.

karaf@root()> start 253
15:52:07.302 [Karaf local console user karaf] ERROR org.apache.karaf.shell.support.ShellUtil - Exception caught while executing command
org.apache.karaf.shell.support.MultiException: Error executing command on bundles:
        Error starting bundle 253: Fragment bundles can not be started.
        at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61) ~[?:?]
        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:70) ~[?:?]
        at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) ~[?:?]
        at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:834) ~[?:?]
        Suppressed: java.lang.Exception: Error starting bundle 253: Fragment bundles can not be started.
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67) ~[?:?]
                at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) ~[?:?]
                at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
                at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
                at java.lang.Thread.run(Thread.java:834) ~[?:?]
        Caused by: org.osgi.framework.BundleException: Fragment bundles can not be started.
                at org.apache.felix.framework.Felix.startBundle(Felix.java:2175) ~[?:?]
                at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
                at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65) ~[?:?]
                ... 14 more
Error executing command: Error executing command on bundles:
        Error starting bundle 253: Fragment bundles can not be started.


Please can any one take a look at once. Why I could not able to start my port number which is defined in jetty.xml file.

Thanks,
VamsiKrishna


Mob: +91 9381078936

[Motivitylabs - Enabling Mobile Enterprises]
US: 222 W. Las Colinas Blvd.
Suite 755 East
Irving, TX 75039
Ph:+1-214-730-0798
INDIA: 9th & 10th floor, Water Mark Building, Kondapur, Hitech City,
Hyderabad 500 084, Telangana.
Ph:+91-40-4651-5454
Confidentiality Note: This message is confidential. It may also be privileged or otherwise protected by work product immunity or other legal rules. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they ar



Re: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Posted by Grzegorz Grzybek <gr...@gmail.com>.
Hello

I found a solution - Pax Web tries to validate whether
etc/org.ops4j.pax.web.cfg matches the runtime-specific configuration

In PID config you have:

org.osgi.service.http.secure.enabled = true
org.osgi.service.http.port.secure = 8443
org.ops4j.pax.web.listening.addresses=127.0.0.1

So Pax Web tries to find a connector in etc/jetty.xml which has 127.0.0.1
as bind address.

However your <New id="sslConnector"
class="org.eclipse.jetty.server.ServerConnector"> is not bound to
127.0.0.1, but to 0.0.0.0.

To fix this, change:

<Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host"
/></Set>

To:

<Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host"
default="127.0.0.1" /></Set>

Worked for me ;)

regards
Grzegorz Grzybek

pon., 7 lis 2022 o 14:35 Vamsikrishna Koka
<va...@motivitylabs.com.invalid> napisał(a):

> Hi Grzegorz,
>
> Thank you so much for looking into this.
>
> Here is entire information for etc/org.ops4j.pax.web.cfg, etc/jetty.xml
> and logs.
>
>
>
> Entire org.ops4j.pax.web.cfg File :
>
> org.osgi.service.http.port=8181
>
> org.osgi.service.http.secure.enabled=true
>
> org.osgi.service.http.port.secure=8443
>
> org.ops4j.pax.web.listening.addresses=127.0.0.1
>
> org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
>
> org.ops4j.pax.web.session.timeout=30
>
>
>
> Entire Jetty.xml File :
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>
> <!--
>
> Licensed to the Apache Software Foundation (ASF) under one
>
> or more contributor license agreements.  See the NOTICE file
>
> distributed with this work for additional information
>
> regarding copyright ownership.  The ASF licenses this file
>
> to you under the Apache License, Version 2.0 (the
>
> "License"); you may not use this file except in compliance
>
> with the License.  You may obtain a copy of the License at
>
>
>
>    http://www.apache.org/licenses/LICENSE-2.0
>
>
>
> Unless required by applicable law or agreed to in writing,
>
> software distributed under the License is distributed on an
>
> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>
> KIND, either express or implied.  See the License for the
>
> specific language governing permissions and limitations
>
> under the License.
>
> --><!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting// DTD Configure//EN"
> http://jetty.mortbay.org/configure.dtd>
>
> <Configure id="Server" class="org.eclipse.jetty.server.Server">
>
>
>
>                 <!--
> =========================================================== -->
>
>     <!-- Configure maximum jetty threads -->
>
>     <!-- default is 200, we are overriding it with 300 -->
>
>     <!-- =========================================================== -->
>
>                 <New
> class="org.eclipse.jetty.util.thread.QueuedThreadPool">
>
>                                 <Set name="maxThreads">300</Set>
>
>                 </New>
>
>
>
>     <!-- =========================================================== -->
>
>     <!-- Configure Authentication Realms -->
>
>     <!-- Realms may be configured for the entire server here, or -->
>
>     <!-- they can be configured for a specific web app in a context -->
>
>     <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
>
>     <!-- example). -->
>
>     <!-- =========================================================== -->
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">karaf</Set>
>
>                 <Set name="loginModuleName">karaf</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">default</Set>
>
>                 <Set name="loginModuleName">karaf</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">adminGod</Set>
>
>                 <Set name="loginModuleName">adminGod</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>                 <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">admincert</Set>
>
>                 <Set name="loginModuleName">admincert</Set>
>
>                                                                 <Set
> name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">adminGodproperties</Set>
>
>                 <Set name="loginModuleName">adminGodproperties</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">admin-db</Set>
>
>                 <Set name="loginModuleName">admin-db</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>     <!-- =========================================================== -->
>
>     <!-- Set connectors -->
>
>     <!-- =========================================================== -->
>
>
>
>     <New id="sslContextFactory"
> class="org.eclipse.jetty.util.ssl.SslContextFactory$Server">
>
>         <Set name="KeyStorePath"><SystemProperty default="."
> name="jetty.home"/>/etc/keystores/keystores.pfx</Set>
>
>         <Set name="TrustStorePath"><SystemProperty default="."
> name="jetty.home"/>/etc/keystores/keystores.pfx</Set>
>
>
>
>         <Set name="KeyStorePassword">remove sensitive data</Set>
>
>         <Set name="KeyManagerPassword">remove sensitive data</Set>
>
>         <Set name="TrustStorePassword">remove sensitive data</Set>
>
>         <Set name="KeyStoreType">PKCS12</Set>
>
>         <Set name="TrustStoreType">PKCS12</Set>
>
>                                 <Set name="wantClientAuth">false</Set>
>
>                                 <Set name="CertAlias">adminGodkey</Set>
>
>
>
>         <Set name="ExcludeProtocols">
>
>                     <Array type="java.lang.String">
>
>                                 <Item>TLSv1.1</Item>
>
>         <Item>TLSv1</Item>
>
>                                 <Item>SSL</Item>
>
>                                 <Item>SSLv2</Item>
>
>                                 <Item>SSLv2Hello</Item>
>
>                                 <Item>SSLv3</Item>
>
>                    </Array>
>
>                 </Set>
>
>                 <Set name="ExcludeCipherSuites">
>
>                     <Array type="java.lang.String">
>
>                   <Item>remove sensitive data</Item>
>
>                     </Array>
>
>                 </Set>
>
>     </New>
>
>
>
>     <New id="httpConfig"
> class="org.eclipse.jetty.server.HttpConfiguration">
>
>         <Set name="secureScheme">https</Set>
>
>         <Set name="securePort"><Property name="jetty.secure.port"
> default="8443" /></Set>
>
>         <Set name="outputBufferSize">32768</Set>
>
>         <Set name="requestHeaderSize">8192</Set>
>
>         <Set name="responseHeaderSize">8192</Set>
>
>         <Set name="sendServerVersion">false</Set>
>
>         <Set name="sendDateHeader">false</Set>
>
>         <Set name="headerCacheSize">512</Set>
>
>     </New>
>
>
>
>     <!-- =========================================================== -->
>
>     <!-- Create a TLS specific HttpConfiguration based on the        -->
>
>     <!-- common HttpConfiguration defined in jetty.xml               -->
>
>     <!-- Add a SecureRequestCustomizer to extract certificate and    -->
>
>     <!-- session information                                         -->
>
>     <!-- =========================================================== -->
>
>     <New id="sslHttpConfig"
> class="org.eclipse.jetty.server.HttpConfiguration">
>
>         <Arg><Ref refid="httpConfig"/></Arg>
>
>         <Call name="addCustomizer">
>
>             <Arg>
>
>                 <New
> class="org.eclipse.jetty.server.SecureRequestCustomizer">
>
>                     <Arg type="boolean"><Property
> name="jetty.ssl.sniHostCheck" default="true"/></Arg>
>
>                 </New>
>
>             </Arg>
>
>         </Call>
>
>     </New>
>
>
>
>     <!-- ============================================================= -->
>
>     <!-- Configure the Jetty Server instance with an ID "Server"       -->
>
>     <!-- by adding a HTTP connector.                                   -->
>
>     <!-- This configuration must be used in conjunction with jetty.xml -->
>
>     <!-- ============================================================= -->
>
>
>
>     <Call name="addConnector">
>
>         <Arg>
>
>             <New id="sslConnector"
> class="org.eclipse.jetty.server.ServerConnector">
>
>                 <Arg name="server"><Ref refid="Server" /></Arg>
>
>                 <Arg name="acceptors" type="int"><Property
> name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
>
>                 <Arg name="selectors" type="int"><Property
> name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
>
>                 <Arg name="factories">
>
>                     <Array
> type="org.eclipse.jetty.server.ConnectionFactory">
>
>                         <!-- uncomment to support proxy protocol
>
>                         <Item>
>
>                           <New
> class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
>
>                         </Item>-->
>
>                     </Array>
>
>                 </Arg>
>
>
>
>                 <Set name="host"><Property name="jetty.ssl.host"
> deprecated="jetty.host" /></Set>
>
>                 <Set name="port"><Property name="jetty.ssl.port"
> deprecated="ssl.port" default="8443" /></Set>
>
>                 <Set name="name">127.0.0.1:8443</Set>
>
>                 <Set name="idleTimeout"><Property
> name="jetty.ssl.idleTimeout" deprecated="ssl.timeout"
> default="30000"/></Set>
>
>                 <Set name="soLingerTime"><Property
> name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime"
> default="-1"/></Set>
>
>                 <Set name="acceptorPriorityDelta"><Property
> name="jetty.ssl.acceptorPriorityDelta"
> deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
>
>                 <Set name="acceptQueueSize"><Property
> name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize"
> default="0"/></Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>     <Ref id="sslConnector">
>
>         <Call name="addIfAbsentConnectionFactory">
>
>             <Arg>
>
>                 <New class="org.eclipse.jetty.server.SslConnectionFactory">
>
>                     <Arg name="next">http/1.1</Arg>
>
>                     <Arg name="sslContextFactory"><Ref
> refid="sslContextFactory"/></Arg>
>
>                 </New>
>
>             </Arg>
>
>         </Call>
>
>
>
>         <Call name="addConnectionFactory">
>
>             <Arg>
>
>                 <New
> class="org.eclipse.jetty.server.HttpConnectionFactory">
>
>                     <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
>
>                 </New>
>
>             </Arg>
>
>         </Call>
>
>     </Ref>
>
> </Configure>
>
>
> Logs :  My apologies, For me difficulty to share entire logs on public
> portal.
>
> 18:56:37.664 [paxweb-config-1-thread-1 (change controller)] INFO
> org.eclipse.jetty.server.AbstractConnector - Started 127.0.0.1:8443@763bf1c8{SSL,
> (ssl, http/1.1)}{0.0.0.0:8443}
>
> 18:56:37.729 [paxweb-config-1-thread-1 (change controller)] INFO
> org.eclipse.jetty.server.AbstractConnector - Started
> default@ef05682{HTTP/1.1, (http/1.1)}{127.0.0.1:8181}
>
> 18:56:37.750 [paxweb-config-1-thread-1 (change controller)] ERROR
> org.ops4j.pax.web.service.internal.Activator - Unable to start Pax Web
> server: Failed to bind to /127.0.0.1:8443
>
> java.io.IOException: Failed to bind to /127.0.0.1:8443
>
>         at
> org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
> ~[?:?]
>
>         at
> org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
> ~[?:?]
>
>         at
> org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
> ~[?:?]
>
>         at
> org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
> ~[?:?]
>
>         at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
> ~[?:?]
>
>         at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[?:?]
>
>         at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.start(JettyServerWrapper.java:623)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.jetty.internal.JettyServerController.start(JettyServerController.java:109)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.internal.Activator.performConfiguration(Activator.java:551)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:441)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.internal.Activator.lambda$updateServerControllerFactory$1(Activator.java:347)
> ~[?:?]
>
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> ~[?:?]
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>         at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
> Caused by: java.net.BindException: Address already in use: bind
>
>         at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
>
>         at sun.nio.ch.Net.bind(Net.java:461) ~[?:?]
>
>         at sun.nio.ch.Net.bind(Net.java:453) ~[?:?]
>
>         at
> sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
> ~[?:?]
>
>         at
> sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80) ~[?:?]
>
>         at
> org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
> ~[?:?]
>
>         ... 17 more
>
>
>
> Thanks
>
>
>
> *From:* Vamsikrishna Koka
> *Sent:* Monday, November 7, 2022 3:55 PM
> *To:* issues@karaf.apache.org; dev@karaf.apache.org
> *Subject:* Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax
> Web (8.0.6) in KARAF 4.4.1
>
>
>
> Hi Team,
>
> I have migrated KARAF (from 4.2.15 to 4.4.1) and JDK (Open JDK 8 to
> OpenJDK 11) along with required dependency also. As per KARAF release NOTE.
>
> There is issue with jetty xml configuration and org.ops4j.pax.web.cfg.
>
>
>
> *Jetty.xml file*
>
>
> <Call name="addConnector">
>
>         <Arg>
>
>             <New id="sslConnector"
> class="org.eclipse.jetty.server.ServerConnector">
>
>                 <Arg name="server"><Ref refid="Server" /></Arg>
>
>                 <Arg name="acceptors" type="int"><Property
> name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
>
>                 <Arg name="selectors" type="int"><Property
> name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
>
>                 <Arg name="factories">
>
>                     <Array
> type="org.eclipse.jetty.server.ConnectionFactory">
>
>                         <!-- uncomment to support proxy protocol
>
>                         <Item>
>
>                           <New
> class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
>
>                         </Item>-->
>
>                     </Array>
>
>                 </Arg>
>
>                 <Set name="host"><Property name="jetty.ssl.host"
> deprecated="jetty.host" /></Set>
>
>                 <Set name="port"><Property name="jetty.ssl.port"
> deprecated="ssl.port" default="8443"/></Set>
>
>                 <Set name="name">127.0.0.1:8443</Set>
>
>                 <Set name="idleTimeout"><Property
> name="jetty.ssl.idleTimeout" deprecated="ssl.timeout"
> default="30000"/></Set>
>
>                 <Set name="soLingerTime"><Property
> name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime"
> default="-1"/></Set>
>
>                 <Set name="acceptorPriorityDelta"><Property
> name="jetty.ssl.acceptorPriorityDelta"
> deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
>
>                 <Set name="acceptQueueSize"><Property
> name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize"
> default="0"/></Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>
>
> *org.ops4j.pax.web.cfg*
>
>
>
> org.osgi.service.http.port=8181
>
> org.osgi.service.http.secure.enabled=true
>
> org.osgi.service.http.port.secure=8443
>
> org.ops4j.pax.web.listening.addresses=127.0.0.1
>
> org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
>
> org.ops4j.pax.web.session.timeout=30
>
>
>
>
>
> The above configuration *perfectly working* on KARAF 4.2.15 version both
> jetty *9.4.43* and pax web *7.2.29. *So, I have migrated jetty and Pax
> web dependency part of the KARAF upgrade 4.4.1 version.
>
>
>
> Tried to start KARAF 4.4.1 server on console logs, I have seen  *More
> than one HttpConfiguration found in external Jetty configuration. Using
> HttpConfiguration and Failed to bind to /127.0.0.1:8443
> <http://127.0.0.1:8443>. *Understand some where latest PAX Web also
> started container with port 8443*. *If I change port my login page does
> not able to land on browser.
>
>
>
> *Difference b/w Pax-Web 7.2.29 and 8.0.6 version.*
>
> *Pax-Web 7.2.29*
>
>
>
> OPS4J Pax Web - APIorg.ops4j.pax.web.pax-web-api
>
>    7.2.29          Active
>
> OPS4J Pax Web - Deployment Descriptor
> Modelorg.ops4j.pax.web.pax-web-descriptor         7.2.29
>  Active
>
> OPS4J Pax Web - Extender -
> WARorg.ops4j.pax.web.pax-web-extender-war
>   7.2.29          Active
>
> OPS4J Pax Web - Extender -
> Whiteboardorg.ops4j.pax.web.pax-web-extender-whiteboard  7.2.29
> Active
>
> OPS4J Pax Web - FileInstall
> Deployerorg.ops4j.pax.web.pax-web-deployer
> 7.2.29          Active
>
> OPS4J Pax Web - Jettyorg.ops4j.pax.web.pax-web-jetty
>
>                             7.2.29          Active
>
> OPS4J Pax Web - Jsp Supportorg.ops4j.pax.web.pax-web-jsp
> 7.2.29                                           Active
>
> OPS4J Pax Web - Runtimeorg.ops4j.pax.web.pax-web-runtime
> 7.2.29                                           Active
>
> OPS4J Pax Web - Service SPIorg.ops4j.pax.web.pax-web-spi
> 7.2.29                                           Active
>
>
>
>
>
> *karaf@root()> list -s -t 0 | grep "org.ops4j.pax.web"*
>
>
>
> 252 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-api
>
> 253 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-el2
>
> 254 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-servlet31
>
> 255 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-extender-war
>
> 256 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jetty
>
> 257 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jsp
>
> 258 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-runtime
>
> 259 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-spi
>
> 260 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-tomcat-common
>
> 261 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-websocket
>
>
>
> ERROR :  Tried to restart the above bundle 253 AND 254. I got the an error
> Caused by: org.osgi.framework.BundleException: Fragment bundles can not be
> started.
>
>
>
> karaf@root()> start 253
>
> 15:52:07.302 [Karaf local console user karaf] ERROR
> org.apache.karaf.shell.support.ShellUtil - Exception caught while executing
> command
>
> org.apache.karaf.shell.support.MultiException: Error executing command on
> bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>         at
> org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:70)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>         at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Suppressed: java.lang.Exception: Error starting bundle 253:
> Fragment bundles can not be started.
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67)
> ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
> ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
> ~[?:?]
>
>                 at
> java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>                 at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Caused by: org.osgi.framework.BundleException: Fragment bundles
> can not be started.
>
>                 at
> org.apache.felix.framework.Felix.startBundle(Felix.java:2175) ~[?:?]
>
>                 at
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65)
> ~[?:?]
>
>                 ... 14 more
>
> Error executing command: Error executing command on bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>
>
>
>
> Please can any one take a look at once. Why I could not able to start my
> port number which is defined in jetty.xml file.
>
>
>
> Thanks,
> * VamsiKrishna*
>
>
> Mob: +91 9381078936
>
>
> [image: Motivitylabs - Enabling Mobile Enterprises]
>
> *US: *222 W. Las Colinas Blvd.
> Suite 755 East
> Irving, TX 75039
> Ph:+1-214-730-0798
>
> *INDIA:* 9th & 10th floor, Water Mark Building, Kondapur, Hitech City,
> Hyderabad 500 084, Telangana.
> Ph:+91-40-4651-5454
>
> *Confidentiality Note:* This message is confidential. It may also be
> privileged or otherwise protected by work product immunity or other legal
> rules. This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they ar
>
>
>
>
>

Re: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Posted by Grzegorz Grzybek <gr...@gmail.com>.
Hello

I found a solution - Pax Web tries to validate whether
etc/org.ops4j.pax.web.cfg matches the runtime-specific configuration

In PID config you have:

org.osgi.service.http.secure.enabled = true
org.osgi.service.http.port.secure = 8443
org.ops4j.pax.web.listening.addresses=127.0.0.1

So Pax Web tries to find a connector in etc/jetty.xml which has 127.0.0.1
as bind address.

However your <New id="sslConnector"
class="org.eclipse.jetty.server.ServerConnector"> is not bound to
127.0.0.1, but to 0.0.0.0.

To fix this, change:

<Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host"
/></Set>

To:

<Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host"
default="127.0.0.1" /></Set>

Worked for me ;)

regards
Grzegorz Grzybek

pon., 7 lis 2022 o 14:35 Vamsikrishna Koka
<va...@motivitylabs.com.invalid> napisał(a):

> Hi Grzegorz,
>
> Thank you so much for looking into this.
>
> Here is entire information for etc/org.ops4j.pax.web.cfg, etc/jetty.xml
> and logs.
>
>
>
> Entire org.ops4j.pax.web.cfg File :
>
> org.osgi.service.http.port=8181
>
> org.osgi.service.http.secure.enabled=true
>
> org.osgi.service.http.port.secure=8443
>
> org.ops4j.pax.web.listening.addresses=127.0.0.1
>
> org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
>
> org.ops4j.pax.web.session.timeout=30
>
>
>
> Entire Jetty.xml File :
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>
> <!--
>
> Licensed to the Apache Software Foundation (ASF) under one
>
> or more contributor license agreements.  See the NOTICE file
>
> distributed with this work for additional information
>
> regarding copyright ownership.  The ASF licenses this file
>
> to you under the Apache License, Version 2.0 (the
>
> "License"); you may not use this file except in compliance
>
> with the License.  You may obtain a copy of the License at
>
>
>
>    http://www.apache.org/licenses/LICENSE-2.0
>
>
>
> Unless required by applicable law or agreed to in writing,
>
> software distributed under the License is distributed on an
>
> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>
> KIND, either express or implied.  See the License for the
>
> specific language governing permissions and limitations
>
> under the License.
>
> --><!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting// DTD Configure//EN"
> http://jetty.mortbay.org/configure.dtd>
>
> <Configure id="Server" class="org.eclipse.jetty.server.Server">
>
>
>
>                 <!--
> =========================================================== -->
>
>     <!-- Configure maximum jetty threads -->
>
>     <!-- default is 200, we are overriding it with 300 -->
>
>     <!-- =========================================================== -->
>
>                 <New
> class="org.eclipse.jetty.util.thread.QueuedThreadPool">
>
>                                 <Set name="maxThreads">300</Set>
>
>                 </New>
>
>
>
>     <!-- =========================================================== -->
>
>     <!-- Configure Authentication Realms -->
>
>     <!-- Realms may be configured for the entire server here, or -->
>
>     <!-- they can be configured for a specific web app in a context -->
>
>     <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
>
>     <!-- example). -->
>
>     <!-- =========================================================== -->
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">karaf</Set>
>
>                 <Set name="loginModuleName">karaf</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">default</Set>
>
>                 <Set name="loginModuleName">karaf</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">adminGod</Set>
>
>                 <Set name="loginModuleName">adminGod</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>                 <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">admincert</Set>
>
>                 <Set name="loginModuleName">admincert</Set>
>
>                                                                 <Set
> name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">adminGodproperties</Set>
>
>                 <Set name="loginModuleName">adminGodproperties</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>     <Call name="addBean">
>
>         <Arg>
>
>             <New class="org.eclipse.jetty.jaas.JAASLoginService">
>
>                 <Set name="name">admin-db</Set>
>
>                 <Set name="loginModuleName">admin-db</Set>
>
>                 <Set name="roleClassNames">
>
>                     <Array type="java.lang.String">
>
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>
>                         </Item>
>
>                     </Array>
>
>                 </Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>     <!-- =========================================================== -->
>
>     <!-- Set connectors -->
>
>     <!-- =========================================================== -->
>
>
>
>     <New id="sslContextFactory"
> class="org.eclipse.jetty.util.ssl.SslContextFactory$Server">
>
>         <Set name="KeyStorePath"><SystemProperty default="."
> name="jetty.home"/>/etc/keystores/keystores.pfx</Set>
>
>         <Set name="TrustStorePath"><SystemProperty default="."
> name="jetty.home"/>/etc/keystores/keystores.pfx</Set>
>
>
>
>         <Set name="KeyStorePassword">remove sensitive data</Set>
>
>         <Set name="KeyManagerPassword">remove sensitive data</Set>
>
>         <Set name="TrustStorePassword">remove sensitive data</Set>
>
>         <Set name="KeyStoreType">PKCS12</Set>
>
>         <Set name="TrustStoreType">PKCS12</Set>
>
>                                 <Set name="wantClientAuth">false</Set>
>
>                                 <Set name="CertAlias">adminGodkey</Set>
>
>
>
>         <Set name="ExcludeProtocols">
>
>                     <Array type="java.lang.String">
>
>                                 <Item>TLSv1.1</Item>
>
>         <Item>TLSv1</Item>
>
>                                 <Item>SSL</Item>
>
>                                 <Item>SSLv2</Item>
>
>                                 <Item>SSLv2Hello</Item>
>
>                                 <Item>SSLv3</Item>
>
>                    </Array>
>
>                 </Set>
>
>                 <Set name="ExcludeCipherSuites">
>
>                     <Array type="java.lang.String">
>
>                   <Item>remove sensitive data</Item>
>
>                     </Array>
>
>                 </Set>
>
>     </New>
>
>
>
>     <New id="httpConfig"
> class="org.eclipse.jetty.server.HttpConfiguration">
>
>         <Set name="secureScheme">https</Set>
>
>         <Set name="securePort"><Property name="jetty.secure.port"
> default="8443" /></Set>
>
>         <Set name="outputBufferSize">32768</Set>
>
>         <Set name="requestHeaderSize">8192</Set>
>
>         <Set name="responseHeaderSize">8192</Set>
>
>         <Set name="sendServerVersion">false</Set>
>
>         <Set name="sendDateHeader">false</Set>
>
>         <Set name="headerCacheSize">512</Set>
>
>     </New>
>
>
>
>     <!-- =========================================================== -->
>
>     <!-- Create a TLS specific HttpConfiguration based on the        -->
>
>     <!-- common HttpConfiguration defined in jetty.xml               -->
>
>     <!-- Add a SecureRequestCustomizer to extract certificate and    -->
>
>     <!-- session information                                         -->
>
>     <!-- =========================================================== -->
>
>     <New id="sslHttpConfig"
> class="org.eclipse.jetty.server.HttpConfiguration">
>
>         <Arg><Ref refid="httpConfig"/></Arg>
>
>         <Call name="addCustomizer">
>
>             <Arg>
>
>                 <New
> class="org.eclipse.jetty.server.SecureRequestCustomizer">
>
>                     <Arg type="boolean"><Property
> name="jetty.ssl.sniHostCheck" default="true"/></Arg>
>
>                 </New>
>
>             </Arg>
>
>         </Call>
>
>     </New>
>
>
>
>     <!-- ============================================================= -->
>
>     <!-- Configure the Jetty Server instance with an ID "Server"       -->
>
>     <!-- by adding a HTTP connector.                                   -->
>
>     <!-- This configuration must be used in conjunction with jetty.xml -->
>
>     <!-- ============================================================= -->
>
>
>
>     <Call name="addConnector">
>
>         <Arg>
>
>             <New id="sslConnector"
> class="org.eclipse.jetty.server.ServerConnector">
>
>                 <Arg name="server"><Ref refid="Server" /></Arg>
>
>                 <Arg name="acceptors" type="int"><Property
> name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
>
>                 <Arg name="selectors" type="int"><Property
> name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
>
>                 <Arg name="factories">
>
>                     <Array
> type="org.eclipse.jetty.server.ConnectionFactory">
>
>                         <!-- uncomment to support proxy protocol
>
>                         <Item>
>
>                           <New
> class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
>
>                         </Item>-->
>
>                     </Array>
>
>                 </Arg>
>
>
>
>                 <Set name="host"><Property name="jetty.ssl.host"
> deprecated="jetty.host" /></Set>
>
>                 <Set name="port"><Property name="jetty.ssl.port"
> deprecated="ssl.port" default="8443" /></Set>
>
>                 <Set name="name">127.0.0.1:8443</Set>
>
>                 <Set name="idleTimeout"><Property
> name="jetty.ssl.idleTimeout" deprecated="ssl.timeout"
> default="30000"/></Set>
>
>                 <Set name="soLingerTime"><Property
> name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime"
> default="-1"/></Set>
>
>                 <Set name="acceptorPriorityDelta"><Property
> name="jetty.ssl.acceptorPriorityDelta"
> deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
>
>                 <Set name="acceptQueueSize"><Property
> name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize"
> default="0"/></Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>     <Ref id="sslConnector">
>
>         <Call name="addIfAbsentConnectionFactory">
>
>             <Arg>
>
>                 <New class="org.eclipse.jetty.server.SslConnectionFactory">
>
>                     <Arg name="next">http/1.1</Arg>
>
>                     <Arg name="sslContextFactory"><Ref
> refid="sslContextFactory"/></Arg>
>
>                 </New>
>
>             </Arg>
>
>         </Call>
>
>
>
>         <Call name="addConnectionFactory">
>
>             <Arg>
>
>                 <New
> class="org.eclipse.jetty.server.HttpConnectionFactory">
>
>                     <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
>
>                 </New>
>
>             </Arg>
>
>         </Call>
>
>     </Ref>
>
> </Configure>
>
>
> Logs :  My apologies, For me difficulty to share entire logs on public
> portal.
>
> 18:56:37.664 [paxweb-config-1-thread-1 (change controller)] INFO
> org.eclipse.jetty.server.AbstractConnector - Started 127.0.0.1:8443@763bf1c8{SSL,
> (ssl, http/1.1)}{0.0.0.0:8443}
>
> 18:56:37.729 [paxweb-config-1-thread-1 (change controller)] INFO
> org.eclipse.jetty.server.AbstractConnector - Started
> default@ef05682{HTTP/1.1, (http/1.1)}{127.0.0.1:8181}
>
> 18:56:37.750 [paxweb-config-1-thread-1 (change controller)] ERROR
> org.ops4j.pax.web.service.internal.Activator - Unable to start Pax Web
> server: Failed to bind to /127.0.0.1:8443
>
> java.io.IOException: Failed to bind to /127.0.0.1:8443
>
>         at
> org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
> ~[?:?]
>
>         at
> org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
> ~[?:?]
>
>         at
> org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
> ~[?:?]
>
>         at
> org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
> ~[?:?]
>
>         at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
> ~[?:?]
>
>         at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[?:?]
>
>         at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.start(JettyServerWrapper.java:623)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.jetty.internal.JettyServerController.start(JettyServerController.java:109)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.internal.Activator.performConfiguration(Activator.java:551)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:441)
> ~[?:?]
>
>         at
> org.ops4j.pax.web.service.internal.Activator.lambda$updateServerControllerFactory$1(Activator.java:347)
> ~[?:?]
>
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> ~[?:?]
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>         at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
> Caused by: java.net.BindException: Address already in use: bind
>
>         at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
>
>         at sun.nio.ch.Net.bind(Net.java:461) ~[?:?]
>
>         at sun.nio.ch.Net.bind(Net.java:453) ~[?:?]
>
>         at
> sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
> ~[?:?]
>
>         at
> sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80) ~[?:?]
>
>         at
> org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
> ~[?:?]
>
>         ... 17 more
>
>
>
> Thanks
>
>
>
> *From:* Vamsikrishna Koka
> *Sent:* Monday, November 7, 2022 3:55 PM
> *To:* issues@karaf.apache.org; dev@karaf.apache.org
> *Subject:* Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax
> Web (8.0.6) in KARAF 4.4.1
>
>
>
> Hi Team,
>
> I have migrated KARAF (from 4.2.15 to 4.4.1) and JDK (Open JDK 8 to
> OpenJDK 11) along with required dependency also. As per KARAF release NOTE.
>
> There is issue with jetty xml configuration and org.ops4j.pax.web.cfg.
>
>
>
> *Jetty.xml file*
>
>
> <Call name="addConnector">
>
>         <Arg>
>
>             <New id="sslConnector"
> class="org.eclipse.jetty.server.ServerConnector">
>
>                 <Arg name="server"><Ref refid="Server" /></Arg>
>
>                 <Arg name="acceptors" type="int"><Property
> name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
>
>                 <Arg name="selectors" type="int"><Property
> name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
>
>                 <Arg name="factories">
>
>                     <Array
> type="org.eclipse.jetty.server.ConnectionFactory">
>
>                         <!-- uncomment to support proxy protocol
>
>                         <Item>
>
>                           <New
> class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
>
>                         </Item>-->
>
>                     </Array>
>
>                 </Arg>
>
>                 <Set name="host"><Property name="jetty.ssl.host"
> deprecated="jetty.host" /></Set>
>
>                 <Set name="port"><Property name="jetty.ssl.port"
> deprecated="ssl.port" default="8443"/></Set>
>
>                 <Set name="name">127.0.0.1:8443</Set>
>
>                 <Set name="idleTimeout"><Property
> name="jetty.ssl.idleTimeout" deprecated="ssl.timeout"
> default="30000"/></Set>
>
>                 <Set name="soLingerTime"><Property
> name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime"
> default="-1"/></Set>
>
>                 <Set name="acceptorPriorityDelta"><Property
> name="jetty.ssl.acceptorPriorityDelta"
> deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
>
>                 <Set name="acceptQueueSize"><Property
> name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize"
> default="0"/></Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>
>
> *org.ops4j.pax.web.cfg*
>
>
>
> org.osgi.service.http.port=8181
>
> org.osgi.service.http.secure.enabled=true
>
> org.osgi.service.http.port.secure=8443
>
> org.ops4j.pax.web.listening.addresses=127.0.0.1
>
> org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
>
> org.ops4j.pax.web.session.timeout=30
>
>
>
>
>
> The above configuration *perfectly working* on KARAF 4.2.15 version both
> jetty *9.4.43* and pax web *7.2.29. *So, I have migrated jetty and Pax
> web dependency part of the KARAF upgrade 4.4.1 version.
>
>
>
> Tried to start KARAF 4.4.1 server on console logs, I have seen  *More
> than one HttpConfiguration found in external Jetty configuration. Using
> HttpConfiguration and Failed to bind to /127.0.0.1:8443
> <http://127.0.0.1:8443>. *Understand some where latest PAX Web also
> started container with port 8443*. *If I change port my login page does
> not able to land on browser.
>
>
>
> *Difference b/w Pax-Web 7.2.29 and 8.0.6 version.*
>
> *Pax-Web 7.2.29*
>
>
>
> OPS4J Pax Web - APIorg.ops4j.pax.web.pax-web-api
>
>    7.2.29          Active
>
> OPS4J Pax Web - Deployment Descriptor
> Modelorg.ops4j.pax.web.pax-web-descriptor         7.2.29
>  Active
>
> OPS4J Pax Web - Extender -
> WARorg.ops4j.pax.web.pax-web-extender-war
>   7.2.29          Active
>
> OPS4J Pax Web - Extender -
> Whiteboardorg.ops4j.pax.web.pax-web-extender-whiteboard  7.2.29
> Active
>
> OPS4J Pax Web - FileInstall
> Deployerorg.ops4j.pax.web.pax-web-deployer
> 7.2.29          Active
>
> OPS4J Pax Web - Jettyorg.ops4j.pax.web.pax-web-jetty
>
>                             7.2.29          Active
>
> OPS4J Pax Web - Jsp Supportorg.ops4j.pax.web.pax-web-jsp
> 7.2.29                                           Active
>
> OPS4J Pax Web - Runtimeorg.ops4j.pax.web.pax-web-runtime
> 7.2.29                                           Active
>
> OPS4J Pax Web - Service SPIorg.ops4j.pax.web.pax-web-spi
> 7.2.29                                           Active
>
>
>
>
>
> *karaf@root()> list -s -t 0 | grep "org.ops4j.pax.web"*
>
>
>
> 252 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-api
>
> 253 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-el2
>
> 254 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-servlet31
>
> 255 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-extender-war
>
> 256 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jetty
>
> 257 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jsp
>
> 258 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-runtime
>
> 259 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-spi
>
> 260 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-tomcat-common
>
> 261 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-websocket
>
>
>
> ERROR :  Tried to restart the above bundle 253 AND 254. I got the an error
> Caused by: org.osgi.framework.BundleException: Fragment bundles can not be
> started.
>
>
>
> karaf@root()> start 253
>
> 15:52:07.302 [Karaf local console user karaf] ERROR
> org.apache.karaf.shell.support.ShellUtil - Exception caught while executing
> command
>
> org.apache.karaf.shell.support.MultiException: Error executing command on
> bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>         at
> org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:70)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>         at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Suppressed: java.lang.Exception: Error starting bundle 253:
> Fragment bundles can not be started.
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67)
> ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
> ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
> ~[?:?]
>
>                 at
> java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>                 at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Caused by: org.osgi.framework.BundleException: Fragment bundles
> can not be started.
>
>                 at
> org.apache.felix.framework.Felix.startBundle(Felix.java:2175) ~[?:?]
>
>                 at
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65)
> ~[?:?]
>
>                 ... 14 more
>
> Error executing command: Error executing command on bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>
>
>
>
> Please can any one take a look at once. Why I could not able to start my
> port number which is defined in jetty.xml file.
>
>
>
> Thanks,
> * VamsiKrishna*
>
>
> Mob: +91 9381078936
>
>
> [image: Motivitylabs - Enabling Mobile Enterprises]
>
> *US: *222 W. Las Colinas Blvd.
> Suite 755 East
> Irving, TX 75039
> Ph:+1-214-730-0798
>
> *INDIA:* 9th & 10th floor, Water Mark Building, Kondapur, Hitech City,
> Hyderabad 500 084, Telangana.
> Ph:+91-40-4651-5454
>
> *Confidentiality Note:* This message is confidential. It may also be
> privileged or otherwise protected by work product immunity or other legal
> rules. This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they ar
>
>
>
>
>

RE: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Posted by Vamsikrishna Koka <va...@motivitylabs.com.INVALID>.
Hi Grzegorz,

Thank you so much for looking into this.

Here is entire information for etc/org.ops4j.pax.web.cfg, etc/jetty.xml and logs.

Entire org.ops4j.pax.web.cfg File :
org.osgi.service.http.port=8181
org.osgi.service.http.secure.enabled=true
org.osgi.service.http.port.secure=8443
org.ops4j.pax.web.listening.addresses=127.0.0.1
org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
org.ops4j.pax.web.session.timeout=30

Entire Jetty.xml File :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting// DTD Configure//EN" http://jetty.mortbay.org/configure.dtd>
<Configure id="Server" class="org.eclipse.jetty.server.Server">

                <!-- =========================================================== -->
    <!-- Configure maximum jetty threads -->
    <!-- default is 200, we are overriding it with 300 -->
    <!-- =========================================================== -->
                <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
                                <Set name="maxThreads">300</Set>
                </New>

    <!-- =========================================================== -->
    <!-- Configure Authentication Realms -->
    <!-- Realms may be configured for the entire server here, or -->
    <!-- they can be configured for a specific web app in a context -->
    <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
    <!-- example). -->
    <!-- =========================================================== -->
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">karaf</Set>
                <Set name="loginModuleName">karaf</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">default</Set>
                <Set name="loginModuleName">karaf</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">adminGod</Set>
                <Set name="loginModuleName">adminGod</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
                <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">admincert</Set>
                <Set name="loginModuleName">admincert</Set>
                                                                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">adminGodproperties</Set>
                <Set name="loginModuleName">adminGodproperties</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">admin-db</Set>
                <Set name="loginModuleName">admin-db</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>

    <!-- =========================================================== -->
    <!-- Set connectors -->
    <!-- =========================================================== -->

    <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory$Server">
        <Set name="KeyStorePath"><SystemProperty default="." name="jetty.home"/>/etc/keystores/keystores.pfx</Set>
        <Set name="TrustStorePath"><SystemProperty default="." name="jetty.home"/>/etc/keystores/keystores.pfx</Set>

        <Set name="KeyStorePassword">remove sensitive data</Set>
        <Set name="KeyManagerPassword">remove sensitive data</Set>
        <Set name="TrustStorePassword">remove sensitive data</Set>
        <Set name="KeyStoreType">PKCS12</Set>
        <Set name="TrustStoreType">PKCS12</Set>
                                <Set name="wantClientAuth">false</Set>
                                <Set name="CertAlias">adminGodkey</Set>

        <Set name="ExcludeProtocols">
                    <Array type="java.lang.String">
                                <Item>TLSv1.1</Item>
        <Item>TLSv1</Item>
                                <Item>SSL</Item>
                                <Item>SSLv2</Item>
                                <Item>SSLv2Hello</Item>
                                <Item>SSLv3</Item>
                   </Array>
                </Set>
                <Set name="ExcludeCipherSuites">
                    <Array type="java.lang.String">
                  <Item>remove sensitive data</Item>
                    </Array>
                </Set>
    </New>

    <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
        <Set name="secureScheme">https</Set>
        <Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
        <Set name="outputBufferSize">32768</Set>
        <Set name="requestHeaderSize">8192</Set>
        <Set name="responseHeaderSize">8192</Set>
        <Set name="sendServerVersion">false</Set>
        <Set name="sendDateHeader">false</Set>
        <Set name="headerCacheSize">512</Set>
    </New>

    <!-- =========================================================== -->
    <!-- Create a TLS specific HttpConfiguration based on the        -->
    <!-- common HttpConfiguration defined in jetty.xml               -->
    <!-- Add a SecureRequestCustomizer to extract certificate and    -->
    <!-- session information                                         -->
    <!-- =========================================================== -->
    <New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
        <Arg><Ref refid="httpConfig"/></Arg>
        <Call name="addCustomizer">
            <Arg>
                <New class="org.eclipse.jetty.server.SecureRequestCustomizer">
                    <Arg type="boolean"><Property name="jetty.ssl.sniHostCheck" default="true"/></Arg>
                </New>
            </Arg>
        </Call>
    </New>

    <!-- ============================================================= -->
    <!-- Configure the Jetty Server instance with an ID "Server"       -->
    <!-- by adding a HTTP connector.                                   -->
    <!-- This configuration must be used in conjunction with jetty.xml -->
    <!-- ============================================================= -->

    <Call name="addConnector">
        <Arg>
            <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="Server" /></Arg>
                <Arg name="acceptors" type="int"><Property name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
                <Arg name="selectors" type="int"><Property name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <!-- uncomment to support proxy protocol
                        <Item>
                          <New class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
                        </Item>-->
                    </Array>
                </Arg>

                <Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host" /></Set>
                <Set name="port"><Property name="jetty.ssl.port" deprecated="ssl.port" default="8443" /></Set>
                <Set name="name">127.0.0.1:8443</Set>
                <Set name="idleTimeout"><Property name="jetty.ssl.idleTimeout" deprecated="ssl.timeout" default="30000"/></Set>
                <Set name="soLingerTime"><Property name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime" default="-1"/></Set>
                <Set name="acceptorPriorityDelta"><Property name="jetty.ssl.acceptorPriorityDelta" deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
                <Set name="acceptQueueSize"><Property name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize" default="0"/></Set>
            </New>
        </Arg>
    </Call>

    <Ref id="sslConnector">
        <Call name="addIfAbsentConnectionFactory">
            <Arg>
                <New class="org.eclipse.jetty.server.SslConnectionFactory">
                    <Arg name="next">http/1.1</Arg>
                    <Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
                </New>
            </Arg>
        </Call>

        <Call name="addConnectionFactory">
            <Arg>
                <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                    <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
                </New>
            </Arg>
        </Call>
    </Ref>
</Configure>

Logs :  My apologies, For me difficulty to share entire logs on public portal.
18:56:37.664 [paxweb-config-1-thread-1 (change controller)] INFO  org.eclipse.jetty.server.AbstractConnector - Started 127.0.0.1:8443@763bf1c8{SSL, (ssl, http/1.1)}{0.0.0.0:8443}
18:56:37.729 [paxweb-config-1-thread-1 (change controller)] INFO  org.eclipse.jetty.server.AbstractConnector - Started default@ef05682{HTTP/1.1<mailto:default@ef05682%7bHTTP/1.1>, (http/1.1)}{127.0.0.1:8181}
18:56:37.750 [paxweb-config-1-thread-1 (change controller)] ERROR org.ops4j.pax.web.service.internal.Activator - Unable to start Pax Web server: Failed to bind to /127.0.0.1:8443
java.io.IOException: Failed to bind to /127.0.0.1:8443
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[?:?]
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310) ~[?:?]
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[?:?]
        at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234) ~[?:?]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[?:?]
        at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[?:?]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[?:?]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.start(JettyServerWrapper.java:623) ~[?:?]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerController.start(JettyServerController.java:109) ~[?:?]
        at org.ops4j.pax.web.service.internal.Activator.performConfiguration(Activator.java:551) ~[?:?]
        at org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:441) ~[?:?]
        at org.ops4j.pax.web.service.internal.Activator.lambda$updateServerControllerFactory$1(Activator.java:347) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:834) ~[?:?]
Caused by: java.net.BindException: Address already in use: bind
        at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:461) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:453) ~[?:?]
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227) ~[?:?]
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80) ~[?:?]
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[?:?]
        ... 17 more

Thanks

From: Vamsikrishna Koka
Sent: Monday, November 7, 2022 3:55 PM
To: issues@karaf.apache.org; dev@karaf.apache.org
Subject: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Hi Team,

I have migrated KARAF (from 4.2.15 to 4.4.1) and JDK (Open JDK 8 to OpenJDK 11) along with required dependency also. As per KARAF release NOTE.

There is issue with jetty xml configuration and org.ops4j.pax.web.cfg.

Jetty.xml file

<Call name="addConnector">
        <Arg>
            <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="Server" /></Arg>
                <Arg name="acceptors" type="int"><Property name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
                <Arg name="selectors" type="int"><Property name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <!-- uncomment to support proxy protocol
                        <Item>
                          <New class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
                        </Item>-->
                    </Array>
                </Arg>
                <Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host" /></Set>
                <Set name="port"><Property name="jetty.ssl.port" deprecated="ssl.port" default="8443"/></Set>
                <Set name="name">127.0.0.1:8443</Set>
                <Set name="idleTimeout"><Property name="jetty.ssl.idleTimeout" deprecated="ssl.timeout" default="30000"/></Set>
                <Set name="soLingerTime"><Property name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime" default="-1"/></Set>
                <Set name="acceptorPriorityDelta"><Property name="jetty.ssl.acceptorPriorityDelta" deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
                <Set name="acceptQueueSize"><Property name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize" default="0"/></Set>
            </New>
        </Arg>
    </Call>


org.ops4j.pax.web.cfg

org.osgi.service.http.port=8181
org.osgi.service.http.secure.enabled=true
org.osgi.service.http.port.secure=8443
org.ops4j.pax.web.listening.addresses=127.0.0.1
org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
org.ops4j.pax.web.session.timeout=30


The above configuration perfectly working on KARAF 4.2.15 version both jetty 9.4.43 and pax web 7.2.29. So, I have migrated jetty and Pax web dependency part of the KARAF upgrade 4.4.1 version.

Tried to start KARAF 4.4.1 server on console logs, I have seen  More than one HttpConfiguration found in external Jetty configuration. Using HttpConfiguration and Failed to bind to /127.0.0.1:8443. Understand some where latest PAX Web also started container with port 8443. If I change port my login page does not able to land on browser.

Difference b/w Pax-Web 7.2.29 and 8.0.6 version.

Pax-Web 7.2.29

OPS4J Pax Web - APIorg.ops4j.pax.web.pax-web-api                                                                       7.2.29          Active
OPS4J Pax Web - Deployment Descriptor Modelorg.ops4j.pax.web.pax-web-descriptor         7.2.29          Active
OPS4J Pax Web - Extender - WARorg.ops4j.pax.web.pax-web-extender-war                             7.2.29          Active
OPS4J Pax Web - Extender - Whiteboardorg.ops4j.pax.web.pax-web-extender-whiteboard  7.2.29          Active
OPS4J Pax Web - FileInstall Deployerorg.ops4j.pax.web.pax-web-deployer                                7.2.29          Active
OPS4J Pax Web - Jettyorg.ops4j.pax.web.pax-web-jetty                                                                7.2.29          Active
OPS4J Pax Web - Jsp Supportorg.ops4j.pax.web.pax-web-jsp        7.2.29                                           Active
OPS4J Pax Web - Runtimeorg.ops4j.pax.web.pax-web-runtime   7.2.29                                           Active
OPS4J Pax Web - Service SPIorg.ops4j.pax.web.pax-web-spi         7.2.29                                           Active


karaf@root()> list -s -t 0 | grep "org.ops4j.pax.web"

252 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-api
253 | Resolved |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-compatibility-el2
254 | Resolved |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-compatibility-servlet31
255 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-extender-war
256 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-jetty
257 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-jsp
258 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-runtime
259 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-spi
260 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-tomcat-common
261 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-websocket

ERROR :  Tried to restart the above bundle 253 AND 254. I got the an error Caused by: org.osgi.framework.BundleException: Fragment bundles can not be started.

karaf@root()> start 253
15:52:07.302 [Karaf local console user karaf] ERROR org.apache.karaf.shell.support.ShellUtil - Exception caught while executing command
org.apache.karaf.shell.support.MultiException: Error executing command on bundles:
        Error starting bundle 253: Fragment bundles can not be started.
        at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61) ~[?:?]
        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:70) ~[?:?]
        at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) ~[?:?]
        at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:834) ~[?:?]
        Suppressed: java.lang.Exception: Error starting bundle 253: Fragment bundles can not be started.
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67) ~[?:?]
                at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) ~[?:?]
                at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
                at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
                at java.lang.Thread.run(Thread.java:834) ~[?:?]
        Caused by: org.osgi.framework.BundleException: Fragment bundles can not be started.
                at org.apache.felix.framework.Felix.startBundle(Felix.java:2175) ~[?:?]
                at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
                at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65) ~[?:?]
                ... 14 more
Error executing command: Error executing command on bundles:
        Error starting bundle 253: Fragment bundles can not be started.


Please can any one take a look at once. Why I could not able to start my port number which is defined in jetty.xml file.

Thanks,
VamsiKrishna


Mob: +91 9381078936

[Motivitylabs - Enabling Mobile Enterprises]
US: 222 W. Las Colinas Blvd.
Suite 755 East
Irving, TX 75039
Ph:+1-214-730-0798
INDIA: 9th & 10th floor, Water Mark Building, Kondapur, Hitech City,
Hyderabad 500 084, Telangana.
Ph:+91-40-4651-5454
Confidentiality Note: This message is confidential. It may also be privileged or otherwise protected by work product immunity or other legal rules. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they ar



RE: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Posted by Vamsikrishna Koka <va...@motivitylabs.com.INVALID>.
Hi Grzegorz,

Thank you so much for looking into this.

Here is entire information for etc/org.ops4j.pax.web.cfg, etc/jetty.xml and logs.

Entire org.ops4j.pax.web.cfg File :
org.osgi.service.http.port=8181
org.osgi.service.http.secure.enabled=true
org.osgi.service.http.port.secure=8443
org.ops4j.pax.web.listening.addresses=127.0.0.1
org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
org.ops4j.pax.web.session.timeout=30

Entire Jetty.xml File :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting// DTD Configure//EN" http://jetty.mortbay.org/configure.dtd>
<Configure id="Server" class="org.eclipse.jetty.server.Server">

                <!-- =========================================================== -->
    <!-- Configure maximum jetty threads -->
    <!-- default is 200, we are overriding it with 300 -->
    <!-- =========================================================== -->
                <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
                                <Set name="maxThreads">300</Set>
                </New>

    <!-- =========================================================== -->
    <!-- Configure Authentication Realms -->
    <!-- Realms may be configured for the entire server here, or -->
    <!-- they can be configured for a specific web app in a context -->
    <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
    <!-- example). -->
    <!-- =========================================================== -->
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">karaf</Set>
                <Set name="loginModuleName">karaf</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">default</Set>
                <Set name="loginModuleName">karaf</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">adminGod</Set>
                <Set name="loginModuleName">adminGod</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
                <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">admincert</Set>
                <Set name="loginModuleName">admincert</Set>
                                                                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">adminGodproperties</Set>
                <Set name="loginModuleName">adminGodproperties</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>
    <Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.jaas.JAASLoginService">
                <Set name="name">admin-db</Set>
                <Set name="loginModuleName">admin-db</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">
                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>

    <!-- =========================================================== -->
    <!-- Set connectors -->
    <!-- =========================================================== -->

    <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory$Server">
        <Set name="KeyStorePath"><SystemProperty default="." name="jetty.home"/>/etc/keystores/keystores.pfx</Set>
        <Set name="TrustStorePath"><SystemProperty default="." name="jetty.home"/>/etc/keystores/keystores.pfx</Set>

        <Set name="KeyStorePassword">remove sensitive data</Set>
        <Set name="KeyManagerPassword">remove sensitive data</Set>
        <Set name="TrustStorePassword">remove sensitive data</Set>
        <Set name="KeyStoreType">PKCS12</Set>
        <Set name="TrustStoreType">PKCS12</Set>
                                <Set name="wantClientAuth">false</Set>
                                <Set name="CertAlias">adminGodkey</Set>

        <Set name="ExcludeProtocols">
                    <Array type="java.lang.String">
                                <Item>TLSv1.1</Item>
        <Item>TLSv1</Item>
                                <Item>SSL</Item>
                                <Item>SSLv2</Item>
                                <Item>SSLv2Hello</Item>
                                <Item>SSLv3</Item>
                   </Array>
                </Set>
                <Set name="ExcludeCipherSuites">
                    <Array type="java.lang.String">
                  <Item>remove sensitive data</Item>
                    </Array>
                </Set>
    </New>

    <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
        <Set name="secureScheme">https</Set>
        <Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
        <Set name="outputBufferSize">32768</Set>
        <Set name="requestHeaderSize">8192</Set>
        <Set name="responseHeaderSize">8192</Set>
        <Set name="sendServerVersion">false</Set>
        <Set name="sendDateHeader">false</Set>
        <Set name="headerCacheSize">512</Set>
    </New>

    <!-- =========================================================== -->
    <!-- Create a TLS specific HttpConfiguration based on the        -->
    <!-- common HttpConfiguration defined in jetty.xml               -->
    <!-- Add a SecureRequestCustomizer to extract certificate and    -->
    <!-- session information                                         -->
    <!-- =========================================================== -->
    <New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
        <Arg><Ref refid="httpConfig"/></Arg>
        <Call name="addCustomizer">
            <Arg>
                <New class="org.eclipse.jetty.server.SecureRequestCustomizer">
                    <Arg type="boolean"><Property name="jetty.ssl.sniHostCheck" default="true"/></Arg>
                </New>
            </Arg>
        </Call>
    </New>

    <!-- ============================================================= -->
    <!-- Configure the Jetty Server instance with an ID "Server"       -->
    <!-- by adding a HTTP connector.                                   -->
    <!-- This configuration must be used in conjunction with jetty.xml -->
    <!-- ============================================================= -->

    <Call name="addConnector">
        <Arg>
            <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="Server" /></Arg>
                <Arg name="acceptors" type="int"><Property name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
                <Arg name="selectors" type="int"><Property name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <!-- uncomment to support proxy protocol
                        <Item>
                          <New class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
                        </Item>-->
                    </Array>
                </Arg>

                <Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host" /></Set>
                <Set name="port"><Property name="jetty.ssl.port" deprecated="ssl.port" default="8443" /></Set>
                <Set name="name">127.0.0.1:8443</Set>
                <Set name="idleTimeout"><Property name="jetty.ssl.idleTimeout" deprecated="ssl.timeout" default="30000"/></Set>
                <Set name="soLingerTime"><Property name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime" default="-1"/></Set>
                <Set name="acceptorPriorityDelta"><Property name="jetty.ssl.acceptorPriorityDelta" deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
                <Set name="acceptQueueSize"><Property name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize" default="0"/></Set>
            </New>
        </Arg>
    </Call>

    <Ref id="sslConnector">
        <Call name="addIfAbsentConnectionFactory">
            <Arg>
                <New class="org.eclipse.jetty.server.SslConnectionFactory">
                    <Arg name="next">http/1.1</Arg>
                    <Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
                </New>
            </Arg>
        </Call>

        <Call name="addConnectionFactory">
            <Arg>
                <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                    <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
                </New>
            </Arg>
        </Call>
    </Ref>
</Configure>

Logs :  My apologies, For me difficulty to share entire logs on public portal.
18:56:37.664 [paxweb-config-1-thread-1 (change controller)] INFO  org.eclipse.jetty.server.AbstractConnector - Started 127.0.0.1:8443@763bf1c8{SSL, (ssl, http/1.1)}{0.0.0.0:8443}
18:56:37.729 [paxweb-config-1-thread-1 (change controller)] INFO  org.eclipse.jetty.server.AbstractConnector - Started default@ef05682{HTTP/1.1<mailto:default@ef05682%7bHTTP/1.1>, (http/1.1)}{127.0.0.1:8181}
18:56:37.750 [paxweb-config-1-thread-1 (change controller)] ERROR org.ops4j.pax.web.service.internal.Activator - Unable to start Pax Web server: Failed to bind to /127.0.0.1:8443
java.io.IOException: Failed to bind to /127.0.0.1:8443
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[?:?]
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310) ~[?:?]
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[?:?]
        at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234) ~[?:?]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[?:?]
        at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[?:?]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[?:?]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.start(JettyServerWrapper.java:623) ~[?:?]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerController.start(JettyServerController.java:109) ~[?:?]
        at org.ops4j.pax.web.service.internal.Activator.performConfiguration(Activator.java:551) ~[?:?]
        at org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:441) ~[?:?]
        at org.ops4j.pax.web.service.internal.Activator.lambda$updateServerControllerFactory$1(Activator.java:347) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:834) ~[?:?]
Caused by: java.net.BindException: Address already in use: bind
        at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:461) ~[?:?]
        at sun.nio.ch.Net.bind(Net.java:453) ~[?:?]
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227) ~[?:?]
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80) ~[?:?]
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[?:?]
        ... 17 more

Thanks

From: Vamsikrishna Koka
Sent: Monday, November 7, 2022 3:55 PM
To: issues@karaf.apache.org; dev@karaf.apache.org
Subject: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Hi Team,

I have migrated KARAF (from 4.2.15 to 4.4.1) and JDK (Open JDK 8 to OpenJDK 11) along with required dependency also. As per KARAF release NOTE.

There is issue with jetty xml configuration and org.ops4j.pax.web.cfg.

Jetty.xml file

<Call name="addConnector">
        <Arg>
            <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="Server" /></Arg>
                <Arg name="acceptors" type="int"><Property name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
                <Arg name="selectors" type="int"><Property name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <!-- uncomment to support proxy protocol
                        <Item>
                          <New class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
                        </Item>-->
                    </Array>
                </Arg>
                <Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host" /></Set>
                <Set name="port"><Property name="jetty.ssl.port" deprecated="ssl.port" default="8443"/></Set>
                <Set name="name">127.0.0.1:8443</Set>
                <Set name="idleTimeout"><Property name="jetty.ssl.idleTimeout" deprecated="ssl.timeout" default="30000"/></Set>
                <Set name="soLingerTime"><Property name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime" default="-1"/></Set>
                <Set name="acceptorPriorityDelta"><Property name="jetty.ssl.acceptorPriorityDelta" deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
                <Set name="acceptQueueSize"><Property name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize" default="0"/></Set>
            </New>
        </Arg>
    </Call>


org.ops4j.pax.web.cfg

org.osgi.service.http.port=8181
org.osgi.service.http.secure.enabled=true
org.osgi.service.http.port.secure=8443
org.ops4j.pax.web.listening.addresses=127.0.0.1
org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
org.ops4j.pax.web.session.timeout=30


The above configuration perfectly working on KARAF 4.2.15 version both jetty 9.4.43 and pax web 7.2.29. So, I have migrated jetty and Pax web dependency part of the KARAF upgrade 4.4.1 version.

Tried to start KARAF 4.4.1 server on console logs, I have seen  More than one HttpConfiguration found in external Jetty configuration. Using HttpConfiguration and Failed to bind to /127.0.0.1:8443. Understand some where latest PAX Web also started container with port 8443. If I change port my login page does not able to land on browser.

Difference b/w Pax-Web 7.2.29 and 8.0.6 version.

Pax-Web 7.2.29

OPS4J Pax Web - APIorg.ops4j.pax.web.pax-web-api                                                                       7.2.29          Active
OPS4J Pax Web - Deployment Descriptor Modelorg.ops4j.pax.web.pax-web-descriptor         7.2.29          Active
OPS4J Pax Web - Extender - WARorg.ops4j.pax.web.pax-web-extender-war                             7.2.29          Active
OPS4J Pax Web - Extender - Whiteboardorg.ops4j.pax.web.pax-web-extender-whiteboard  7.2.29          Active
OPS4J Pax Web - FileInstall Deployerorg.ops4j.pax.web.pax-web-deployer                                7.2.29          Active
OPS4J Pax Web - Jettyorg.ops4j.pax.web.pax-web-jetty                                                                7.2.29          Active
OPS4J Pax Web - Jsp Supportorg.ops4j.pax.web.pax-web-jsp        7.2.29                                           Active
OPS4J Pax Web - Runtimeorg.ops4j.pax.web.pax-web-runtime   7.2.29                                           Active
OPS4J Pax Web - Service SPIorg.ops4j.pax.web.pax-web-spi         7.2.29                                           Active


karaf@root()> list -s -t 0 | grep "org.ops4j.pax.web"

252 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-api
253 | Resolved |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-compatibility-el2
254 | Resolved |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-compatibility-servlet31
255 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-extender-war
256 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-jetty
257 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-jsp
258 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-runtime
259 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-spi
260 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-tomcat-common
261 | Active   |  30 | 8.0.6                 | org.ops4j.pax.web.pax-web-websocket

ERROR :  Tried to restart the above bundle 253 AND 254. I got the an error Caused by: org.osgi.framework.BundleException: Fragment bundles can not be started.

karaf@root()> start 253
15:52:07.302 [Karaf local console user karaf] ERROR org.apache.karaf.shell.support.ShellUtil - Exception caught while executing command
org.apache.karaf.shell.support.MultiException: Error executing command on bundles:
        Error starting bundle 253: Fragment bundles can not be started.
        at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61) ~[?:?]
        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:70) ~[?:?]
        at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) ~[?:?]
        at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:834) ~[?:?]
        Suppressed: java.lang.Exception: Error starting bundle 253: Fragment bundles can not be started.
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67) ~[?:?]
                at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) ~[?:?]
                at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
                at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
                at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
                at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
                at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
                at java.lang.Thread.run(Thread.java:834) ~[?:?]
        Caused by: org.osgi.framework.BundleException: Fragment bundles can not be started.
                at org.apache.felix.framework.Felix.startBundle(Felix.java:2175) ~[?:?]
                at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
                at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
                at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65) ~[?:?]
                ... 14 more
Error executing command: Error executing command on bundles:
        Error starting bundle 253: Fragment bundles can not be started.


Please can any one take a look at once. Why I could not able to start my port number which is defined in jetty.xml file.

Thanks,
VamsiKrishna


Mob: +91 9381078936

[Motivitylabs - Enabling Mobile Enterprises]
US: 222 W. Las Colinas Blvd.
Suite 755 East
Irving, TX 75039
Ph:+1-214-730-0798
INDIA: 9th & 10th floor, Water Mark Building, Kondapur, Hitech City,
Hyderabad 500 084, Telangana.
Ph:+91-40-4651-5454
Confidentiality Note: This message is confidential. It may also be privileged or otherwise protected by work product immunity or other legal rules. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they ar



Re: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Posted by Grzegorz Grzybek <gr...@gmail.com>.
Hello

Please show me your entire:

   - etc/org.ops4j.pax.web.cfg
   - etc/jetty.xml
   - logs

I've just checked with Karaf 4.4.1 and this SSL configuration works fine:

org.osgi.service.http.secure.enabled = true
org.osgi.service.http.port.secure = 8443
org.ops4j.pax.web.ssl.truststore = ${karaf.etc}/server.keystore
org.ops4j.pax.web.ssl.truststore.password = xxx
org.ops4j.pax.web.ssl.truststore.type = JKS
org.ops4j.pax.web.ssl.keystore = ${karaf.etc}/server.keystore
org.ops4j.pax.web.ssl.keystore.password = xxx
org.ops4j.pax.web.ssl.keystore.type = JKS
org.ops4j.pax.web.ssl.key.password = xxx
org.ops4j.pax.web.ssl.key.alias = server

if you want SSL, you seem to be missing keystore configuration.

regards
Grzegorz Grzybek

pon., 7 lis 2022 o 11:31 Vamsikrishna Koka
<va...@motivitylabs.com.invalid> napisał(a):

> Hi Team,
>
> I have migrated KARAF (from 4.2.15 to 4.4.1) and JDK (Open JDK 8 to
> OpenJDK 11) along with required dependency also. As per KARAF release NOTE.
>
> There is issue with jetty xml configuration and org.ops4j.pax.web.cfg.
>
>
>
> *Jetty.xml file*
>
>
> <Call name="addConnector">
>
>         <Arg>
>
>             <New id="sslConnector"
> class="org.eclipse.jetty.server.ServerConnector">
>
>                 <Arg name="server"><Ref refid="Server" /></Arg>
>
>                 <Arg name="acceptors" type="int"><Property
> name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
>
>                 <Arg name="selectors" type="int"><Property
> name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
>
>                 <Arg name="factories">
>
>                     <Array
> type="org.eclipse.jetty.server.ConnectionFactory">
>
>                         <!-- uncomment to support proxy protocol
>
>                         <Item>
>
>                           <New
> class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
>
>                         </Item>-->
>
>                     </Array>
>
>                 </Arg>
>
>                 <Set name="host"><Property name="jetty.ssl.host"
> deprecated="jetty.host" /></Set>
>
>                 <Set name="port"><Property name="jetty.ssl.port"
> deprecated="ssl.port" default="8443"/></Set>
>
>                 <Set name="name">127.0.0.1:8443</Set>
>
>                 <Set name="idleTimeout"><Property
> name="jetty.ssl.idleTimeout" deprecated="ssl.timeout"
> default="30000"/></Set>
>
>                 <Set name="soLingerTime"><Property
> name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime"
> default="-1"/></Set>
>
>                 <Set name="acceptorPriorityDelta"><Property
> name="jetty.ssl.acceptorPriorityDelta"
> deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
>
>                 <Set name="acceptQueueSize"><Property
> name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize"
> default="0"/></Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>
>
> *org.ops4j.pax.web.cfg*
>
>
>
> org.osgi.service.http.port=8181
>
> org.osgi.service.http.secure.enabled=true
>
> org.osgi.service.http.port.secure=8443
>
> org.ops4j.pax.web.listening.addresses=127.0.0.1
>
> org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
>
> org.ops4j.pax.web.session.timeout=30
>
>
>
>
>
> The above configuration *perfectly working* on KARAF 4.2.15 version both
> jetty *9.4.43* and pax web *7.2.29. *So, I have migrated jetty and Pax
> web dependency part of the KARAF upgrade 4.4.1 version.
>
>
>
> Tried to start KARAF 4.4.1 server on console logs, I have seen  *More
> than one HttpConfiguration found in external Jetty configuration. Using
> HttpConfiguration and Failed to bind to /127.0.0.1:8443
> <http://127.0.0.1:8443>. *Understand some where latest PAX Web also
> started container with port 8443*. *If I change port my login page does
> not able to land on browser.
>
>
>
> *Difference b/w Pax-Web 7.2.29 and 8.0.6 version.*
>
> *Pax-Web 7.2.29*
>
>
>
> OPS4J Pax Web - APIorg.ops4j.pax.web.pax-web-api
>
>    7.2.29          Active
>
> OPS4J Pax Web - Deployment Descriptor
> Modelorg.ops4j.pax.web.pax-web-descriptor         7.2.29
>  Active
>
> OPS4J Pax Web - Extender -
> WARorg.ops4j.pax.web.pax-web-extender-war
>   7.2.29          Active
>
> OPS4J Pax Web - Extender -
> Whiteboardorg.ops4j.pax.web.pax-web-extender-whiteboard  7.2.29
> Active
>
> OPS4J Pax Web - FileInstall
> Deployerorg.ops4j.pax.web.pax-web-deployer
> 7.2.29          Active
>
> OPS4J Pax Web - Jettyorg.ops4j.pax.web.pax-web-jetty
>
>                             7.2.29          Active
>
> OPS4J Pax Web - Jsp Supportorg.ops4j.pax.web.pax-web-jsp
> 7.2.29                                           Active
>
> OPS4J Pax Web - Runtimeorg.ops4j.pax.web.pax-web-runtime
> 7.2.29                                           Active
>
> OPS4J Pax Web - Service SPIorg.ops4j.pax.web.pax-web-spi
> 7.2.29                                           Active
>
>
>
>
>
> *karaf@root()> list -s -t 0 | grep "org.ops4j.pax.web"*
>
>
>
> 252 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-api
>
> 253 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-el2
>
> 254 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-servlet31
>
> 255 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-extender-war
>
> 256 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jetty
>
> 257 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jsp
>
> 258 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-runtime
>
> 259 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-spi
>
> 260 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-tomcat-common
>
> 261 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-websocket
>
>
>
> ERROR :  Tried to restart the above bundle 253 AND 254. I got the an error
> Caused by: org.osgi.framework.BundleException: Fragment bundles can not be
> started.
>
>
>
> karaf@root()> start 253
>
> 15:52:07.302 [Karaf local console user karaf] ERROR
> org.apache.karaf.shell.support.ShellUtil - Exception caught while executing
> command
>
> org.apache.karaf.shell.support.MultiException: Error executing command on
> bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>         at
> org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:70)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>         at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Suppressed: java.lang.Exception: Error starting bundle 253:
> Fragment bundles can not be started.
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67)
> ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
> ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
> ~[?:?]
>
>                 at
> java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>                 at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Caused by: org.osgi.framework.BundleException: Fragment bundles
> can not be started.
>
>                 at
> org.apache.felix.framework.Felix.startBundle(Felix.java:2175) ~[?:?]
>
>                 at
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65)
> ~[?:?]
>
>                 ... 14 more
>
> Error executing command: Error executing command on bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>
>
>
>
> Please can any one take a look at once. Why I could not able to start my
> port number which is defined in jetty.xml file.
>
>
>
> Thanks,
> * VamsiKrishna*
>
>
> Mob: +91 9381078936
>
>
> [image: Motivitylabs - Enabling Mobile Enterprises]
>
> *US: *222 W. Las Colinas Blvd.
> Suite 755 East
> Irving, TX 75039
> Ph:+1-214-730-0798
>
> *INDIA:* 9th & 10th floor, Water Mark Building, Kondapur, Hitech City,
> Hyderabad 500 084, Telangana.
> Ph:+91-40-4651-5454
>
> *Confidentiality Note:* This message is confidential. It may also be
> privileged or otherwise protected by work product immunity or other legal
> rules. This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they ar
>
>
>
>
>

Re: Issue with org.eclipse.jetty.server (9.4.46.v20220331) and Pax Web (8.0.6) in KARAF 4.4.1

Posted by Grzegorz Grzybek <gr...@gmail.com>.
Hello

Please show me your entire:

   - etc/org.ops4j.pax.web.cfg
   - etc/jetty.xml
   - logs

I've just checked with Karaf 4.4.1 and this SSL configuration works fine:

org.osgi.service.http.secure.enabled = true
org.osgi.service.http.port.secure = 8443
org.ops4j.pax.web.ssl.truststore = ${karaf.etc}/server.keystore
org.ops4j.pax.web.ssl.truststore.password = xxx
org.ops4j.pax.web.ssl.truststore.type = JKS
org.ops4j.pax.web.ssl.keystore = ${karaf.etc}/server.keystore
org.ops4j.pax.web.ssl.keystore.password = xxx
org.ops4j.pax.web.ssl.keystore.type = JKS
org.ops4j.pax.web.ssl.key.password = xxx
org.ops4j.pax.web.ssl.key.alias = server

if you want SSL, you seem to be missing keystore configuration.

regards
Grzegorz Grzybek

pon., 7 lis 2022 o 11:31 Vamsikrishna Koka
<va...@motivitylabs.com.invalid> napisał(a):

> Hi Team,
>
> I have migrated KARAF (from 4.2.15 to 4.4.1) and JDK (Open JDK 8 to
> OpenJDK 11) along with required dependency also. As per KARAF release NOTE.
>
> There is issue with jetty xml configuration and org.ops4j.pax.web.cfg.
>
>
>
> *Jetty.xml file*
>
>
> <Call name="addConnector">
>
>         <Arg>
>
>             <New id="sslConnector"
> class="org.eclipse.jetty.server.ServerConnector">
>
>                 <Arg name="server"><Ref refid="Server" /></Arg>
>
>                 <Arg name="acceptors" type="int"><Property
> name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg>
>
>                 <Arg name="selectors" type="int"><Property
> name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg>
>
>                 <Arg name="factories">
>
>                     <Array
> type="org.eclipse.jetty.server.ConnectionFactory">
>
>                         <!-- uncomment to support proxy protocol
>
>                         <Item>
>
>                           <New
> class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
>
>                         </Item>-->
>
>                     </Array>
>
>                 </Arg>
>
>                 <Set name="host"><Property name="jetty.ssl.host"
> deprecated="jetty.host" /></Set>
>
>                 <Set name="port"><Property name="jetty.ssl.port"
> deprecated="ssl.port" default="8443"/></Set>
>
>                 <Set name="name">127.0.0.1:8443</Set>
>
>                 <Set name="idleTimeout"><Property
> name="jetty.ssl.idleTimeout" deprecated="ssl.timeout"
> default="30000"/></Set>
>
>                 <Set name="soLingerTime"><Property
> name="jetty.ssl.soLingerTime" deprecated="ssl.soLingerTime"
> default="-1"/></Set>
>
>                 <Set name="acceptorPriorityDelta"><Property
> name="jetty.ssl.acceptorPriorityDelta"
> deprecated="ssl.acceptorPriorityDelta" default="0"/></Set>
>
>                 <Set name="acceptQueueSize"><Property
> name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize"
> default="0"/></Set>
>
>             </New>
>
>         </Arg>
>
>     </Call>
>
>
>
>
>
> *org.ops4j.pax.web.cfg*
>
>
>
> org.osgi.service.http.port=8181
>
> org.osgi.service.http.secure.enabled=true
>
> org.osgi.service.http.port.secure=8443
>
> org.ops4j.pax.web.listening.addresses=127.0.0.1
>
> org.ops4j.pax.web.config.file = ${karaf.home}/etc/jetty.xml
>
> org.ops4j.pax.web.session.timeout=30
>
>
>
>
>
> The above configuration *perfectly working* on KARAF 4.2.15 version both
> jetty *9.4.43* and pax web *7.2.29. *So, I have migrated jetty and Pax
> web dependency part of the KARAF upgrade 4.4.1 version.
>
>
>
> Tried to start KARAF 4.4.1 server on console logs, I have seen  *More
> than one HttpConfiguration found in external Jetty configuration. Using
> HttpConfiguration and Failed to bind to /127.0.0.1:8443
> <http://127.0.0.1:8443>. *Understand some where latest PAX Web also
> started container with port 8443*. *If I change port my login page does
> not able to land on browser.
>
>
>
> *Difference b/w Pax-Web 7.2.29 and 8.0.6 version.*
>
> *Pax-Web 7.2.29*
>
>
>
> OPS4J Pax Web - APIorg.ops4j.pax.web.pax-web-api
>
>    7.2.29          Active
>
> OPS4J Pax Web - Deployment Descriptor
> Modelorg.ops4j.pax.web.pax-web-descriptor         7.2.29
>  Active
>
> OPS4J Pax Web - Extender -
> WARorg.ops4j.pax.web.pax-web-extender-war
>   7.2.29          Active
>
> OPS4J Pax Web - Extender -
> Whiteboardorg.ops4j.pax.web.pax-web-extender-whiteboard  7.2.29
> Active
>
> OPS4J Pax Web - FileInstall
> Deployerorg.ops4j.pax.web.pax-web-deployer
> 7.2.29          Active
>
> OPS4J Pax Web - Jettyorg.ops4j.pax.web.pax-web-jetty
>
>                             7.2.29          Active
>
> OPS4J Pax Web - Jsp Supportorg.ops4j.pax.web.pax-web-jsp
> 7.2.29                                           Active
>
> OPS4J Pax Web - Runtimeorg.ops4j.pax.web.pax-web-runtime
> 7.2.29                                           Active
>
> OPS4J Pax Web - Service SPIorg.ops4j.pax.web.pax-web-spi
> 7.2.29                                           Active
>
>
>
>
>
> *karaf@root()> list -s -t 0 | grep "org.ops4j.pax.web"*
>
>
>
> 252 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-api
>
> 253 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-el2
>
> 254 | Resolved |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-compatibility-servlet31
>
> 255 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-extender-war
>
> 256 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jetty
>
> 257 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-jsp
>
> 258 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-runtime
>
> 259 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-spi
>
> 260 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-tomcat-common
>
> 261 | Active   |  30 | 8.0.6                 |
> org.ops4j.pax.web.pax-web-websocket
>
>
>
> ERROR :  Tried to restart the above bundle 253 AND 254. I got the an error
> Caused by: org.osgi.framework.BundleException: Fragment bundles can not be
> started.
>
>
>
> karaf@root()> start 253
>
> 15:52:07.302 [Karaf local console user karaf] ERROR
> org.apache.karaf.shell.support.ShellUtil - Exception caught while executing
> command
>
> org.apache.karaf.shell.support.MultiException: Error executing command on
> bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>         at
> org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:70)
> ~[?:?]
>
>         at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>         at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>         at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
> ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
>
>         at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>         at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Suppressed: java.lang.Exception: Error starting bundle 253:
> Fragment bundles can not be started.
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:67)
> ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
> ~[?:?]
>
>                 at
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
> ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
>
>                 at
> org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
> ~[?:?]
>
>                 at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
> ~[?:?]
>
>                 at
> java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>
>                 at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>
>                 at java.lang.Thread.run(Thread.java:834) ~[?:?]
>
>         Caused by: org.osgi.framework.BundleException: Fragment bundles
> can not be started.
>
>                 at
> org.apache.felix.framework.Felix.startBundle(Felix.java:2175) ~[?:?]
>
>                 at
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38) ~[?:?]
>
>                 at
> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:65)
> ~[?:?]
>
>                 ... 14 more
>
> Error executing command: Error executing command on bundles:
>
>         Error starting bundle 253: Fragment bundles can not be started.
>
>
>
>
>
> Please can any one take a look at once. Why I could not able to start my
> port number which is defined in jetty.xml file.
>
>
>
> Thanks,
> * VamsiKrishna*
>
>
> Mob: +91 9381078936
>
>
> [image: Motivitylabs - Enabling Mobile Enterprises]
>
> *US: *222 W. Las Colinas Blvd.
> Suite 755 East
> Irving, TX 75039
> Ph:+1-214-730-0798
>
> *INDIA:* 9th & 10th floor, Water Mark Building, Kondapur, Hitech City,
> Hyderabad 500 084, Telangana.
> Ph:+91-40-4651-5454
>
> *Confidentiality Note:* This message is confidential. It may also be
> privileged or otherwise protected by work product immunity or other legal
> rules. This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they ar
>
>
>
>
>