[ https://issues.apache.org/jira/browse/KARAF-6633?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jean-Baptiste Onofré updated KARAF-6633: ---------------------------------------- Fix Version/s: (was: 4.2.9) 4.2.10 > Unable to bind servlet to specific HttpConnectors > ------------------------------------------------- > > Key: KARAF-6633 > URL: https://issues.apache.org/jira/browse/KARAF-6633 > Project: Karaf > Issue Type: Bug > Components: karaf > Affects Versions: 4.2.8 > Reporter: Alex Soto > Assignee: Jean-Baptiste Onofré > Priority: Major > Labels: documentation, http, web > Fix For: 4.3.0, 4.2.10 > > > On a fresh Karaf run: > {quote}feature:install war > {quote} > Logout, then configure a Jetty connector _jettyConn1_ in _etc/jetty.xml:_ > > {color:#008080}<{color}{color:#3f7f7f}Call{color} > {color:#7f007f}name{color}{color:#000000}={color}"addConnector"{color:#008080}>{color} > {color:#008080}<{color}Arg{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}New{color} > {color:#7f007f}class{color}{color:#000000}={color}"org.eclipse.jetty.server.ServerConnector"{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Arg{color} > {color:#7f007f}name{color}{color:#000000}={color}"server"{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Ref{color} > {color:#7f007f}refid{color}={color:#2a00ff}"Server"{color} > {color:#008080}/>{color} > {color:#008080}</{color}{color:#3f7f7f}Arg{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Arg{color} > {color:#7f007f}name{color}{color:#000000}={color}"factories"{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Array{color} > {color:#7f007f}type{color}{color:#000000}={color}"org.eclipse.jetty.server.ConnectionFactory"{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Item{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}New{color} > {color:#7f007f}class{color}{color:#000000}={color}"org.eclipse.jetty.server.HttpConnectionFactory"{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Arg{color} > {color:#7f007f}name{color}={color:#2a00ff}"config"{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Ref{color} > {color:#7f007f}refid{color}={color:#2a00ff}"httpConfig"{color} > {color:#008080}/>{color} > {color:#008080}</{color}{color:#3f7f7f}Arg{color}{color:#008080}>{color} > {color:#008080}</{color}{color:#3f7f7f}New{color}{color:#008080}>{color} > {color:#008080}</{color}{color:#3f7f7f}Item{color}{color:#008080}>{color} > {color:#008080}</{color}{color:#3f7f7f}Array{color}{color:#008080}>{color} > {color:#008080}</{color}{color:#3f7f7f}Arg{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Set{color} > {color:#7f007f}name{color}={color:#2a00ff}"host"{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Property{color} > {color:#7f007f}name{color}{color:#000000}={color}"jetty.host" > {color:#7f007f}default{color}{color:#000000}={color}"localhost" > {color:#008080}/>{color} > {color:#008080}</{color}{color:#3f7f7f}Set{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Set{color} > {color:#7f007f}name{color}={color:#2a00ff}"port"{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Property{color} > {color:#7f007f}name{color}{color:#000000}={color}"jetty.port" > {color:#7f007f}default{color}{color:#000000}={color}"8282" > {color:#008080}/>{color} > {color:#008080}</{color}{color:#3f7f7f}Set{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Set{color} > {color:#7f007f}name{color}{color:#000000}={color}"idleTimeout"{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Property{color} > {color:#7f007f}name{color}{color:#000000}={color}"http.timeout" > {color:#7f007f}default{color}{color:#000000}={color}"30000" > {color:#008080}/>{color} > {color:#008080}</{color}{color:#3f7f7f}Set{color}{color:#008080}>{color} > {color:#008080}<{color}{color:#3f7f7f}Set{color} > {color:#7f007f}name{color}={color:#2a00ff}"name"{color}{color:#008080}>{color}jettyConn1{color:#008080}</{color}{color:#3f7f7f}Set{color}{color:#008080}>{color} > {color:#008080}</{color}{color:#3f7f7f}New{color}{color:#008080}>{color} > {color:#008080}</{color}Arg{color:#008080}>{color} > {color:#008080}</{color}Call{color:#008080}>{color} > Now run Karaf again and run the command: > {quote}bundle:install --start > mvn:org.ops4j.pax.web.samples/whiteboard-extended/7.2.14 > {quote} > This will install sample bundle from Pax-Web project: > [https://github.com/ops4j/org.ops4j.pax.web/tree/web-7.2.14/samples/whiteboard-extended] > > > Which registers a servlet to bind to the _jettyConn1_ configured in jetty.xml. > I can verify the servlets are deployed: > karaf@root()> http:list > ID │ Servlet │ Servlet-Name │ State > │ Alias │ > Url───┼──────────────────────┼──────────────────────────────┼─────────────┼───────────────────────────┼─309 > │ WhiteboardServlet │ ServletModel-26 │ Deployed │ > /whiteboard │ [/whiteboard/*]309 │ WhiteboardServlet │ > ServletModel-28 │ Deployed │ /whiteboard2 │ > [/whiteboard2/*]309 │ WhiteboardServlet │ ServletModel-30 > │ Deployed │ /whiteboard3 │ [/whiteboard3/*]309 │ > WhiteboardServlet │ ServletModel-32 │ Deployed │ > /whiteboard4 │ [/whiteboard4/*] > > But Jetty is responding 404 to a GET request on > [http://localhost:8282/whiteboard], same for all other ports. > > I see this warning in the log file: > > 2020-03-10T10:12:07,497 | WARN | features-3-thread-1 | ContextHandler > | 245 - org.eclipse.jetty.util - 9.4.22.v20191022 | ContextHandler > [+localhost+, @jettyConn1] has a connector only entry e.g. "@connector" and > one or more host only entries. > The host entries will be ignored to match legacy behavior. To clear this > warning remove the host entries or update to use at least one host@connector > syntax entry that will match a host for an specific connector > > The expected result is that a GET request to > [http://localhost:8282/whiteboard] responds 200, and 404 to > [http://localhost:8181/whiteboard|http://localhost:8282/whiteboard] because > the servlet is registered to bind to the _jettyConn1_: > > {quote}contextMappingParams.put(ExtenderConstants.PROPERTY_HTTP_CONNECTORS, > "jettyConn1");{quote} > -- This message was sent by Atlassian Jira (v8.3.4#803005)