Hello

You have this message:

Adding servlet
ServletModel{id=ServletModel-239,name='helloboard',urlPatterns=[/],servletClass=class
com..gcs.console.helloboard.HelloboardServlet,contexts=null}

With this, you're overriding the "default" servlet normally mapped to "/"
with your "helloboard" servlet mapped to "/".

I'll check in Servlets specification how this should behave, but for now
this looks like this is the reason. If you don't add this servlet, named
dispatcher should work.

regards
Grzegorz Grzybek

wt., 15 lis 2022 o 15:38 Prashanth Ettaboina
<prashanth.ettabo...@motivitylabs.com.invalid> napisaƂ(a):

> Hi Grzegorz,
>
> I'm generating a WAR file of the bundle(which will have the web
> application).
>
> Adding the war file in the feature.xml and installing it in the karaf as a
> kar file.
>
>         <!--  Server Console Bundles -->
>         <bundle
> start-level="95">mvn:com.server.console/helloboard/${project.version}/war</bundle>
>
> karaf@root()> kar: install file :filepath*** snapshot.kar
>
> below are the logs from karaf which are generated while I installed the
> kar file.
>
> 2022-11-15T19:19:11.401+0530 CEF:1 | org.apache.karaf.kar.core | 4.4.1 |
> INFO  | ID=168 THR=0.0-SNAPSHOT.kar CAT=KarServiceImpl
>  MSG=Added feature repository
> 'mvn:com.server.kars/example-console/51.0.0-SNAPSHOT/xml/features'
> 2022-11-15T19:19:11.403+0530 CEF:1 | org.apache.karaf.features.core |
> 4.4.1 | INFO  | ID=19 THR=0.0-SNAPSHOT.kar CAT=FeaturesServiceImpl
>     MSG=Adding features: example-console/[51.0.0.SNAPSHOT,51.0.0.SNAPSHOT]
> 2022-11-15T19:19:15.041+0530 CEF:1 | org.apache.karaf.features.core |
> 4.4.1 | INFO  | ID=19 THR=tures-3-thread-1 CAT=FeaturesServiceImpl
>     MSG=Changes to perform:
> 2022-11-15T19:19:15.041+0530 CEF:1 | org.apache.karaf.features.core |
> 4.4.1 | INFO  | ID=19 THR=tures-3-thread-1 CAT=FeaturesServiceImpl
>     MSG=  Region: root
> 2022-11-15T19:19:15.042+0530 CEF:1 | org.apache.karaf.features.core |
> 4.4.1 | INFO  | ID=19 THR=tures-3-thread-1 CAT=FeaturesServiceImpl
>     MSG=    Bundles to install:
> 2022-11-15T19:19:15.042+0530 CEF:1 | org.apache.karaf.features.core |
> 4.4.1 | INFO  | ID=19 THR=tures-3-thread-1 CAT=FeaturesServiceImpl
>     MSG=      mvn:com.server.console/helloboard/51.0.0-SNAPSHOT/war
> 2022-11-15T19:19:20.621+0530 CEF:1 | org.apache.karaf.features.core |
> 4.4.1 | INFO  | ID=19 THR=tures-3-thread-1 CAT=FeaturesServiceImpl
>     MSG=  helloboard/51.0.0.SNAPSHOT
> 2022-11-15T19:19:20.634+0530 CEF:1 |
> org.ops4j.pax.web.pax-web-extender-war | 8.0.6 | INFO  | ID=269
> THR=ender-1-thread-1 CAT=BundleWebApplication             MSG=Configuring
> Web Application "/helloboard" for bundle helloboard/51.0.0.SNAPSHOT
> 2022-11-15T19:19:20.635+0530 CEF:1 | org.apache.karaf.features.core |
> 4.4.1 | INFO  | ID=19 THR=tures-3-thread-1 CAT=FeaturesServiceImpl
>     MSG=Done.
> 2022-11-15T19:19:32.512+0530 CEF:1 | org.ops4j.pax.web.pax-web-runtime |
> 8.0.6 | INFO  | ID=272 THR=ender-1-thread-1
> CAT=StoppableHttpServiceFactory      MSG=Binding HTTP Service for bundle:
> [helloboard [318]]
> 2022-11-15T19:19:32.514+0530 CEF:1 |
> org.ops4j.pax.web.pax-web-extender-war | 8.0.6 | INFO  | ID=269
> THR=ender-1-thread-1 CAT=BundleWebApplication             MSG=Allocated
> context for /helloboard:
> OsgiContextModel{WAB,id=OCM-233,name='/helloboard',path='/helloboard',bundle=helloboard,}
> 2022-11-15T19:19:32.520+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerController
>       MSG=Receiving Batch{"Deployment of Web Application "/helloboard" for
> bundle helloboard/51.0.0.SNAPSHOT", size=24}
> 2022-11-15T19:19:32.520+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Creating new Jetty context for
> ServletContextModel{id=ServletContextModel-234,contextPath='/helloboard'}
> 2022-11-15T19:19:32.521+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Adding
> OsgiContextModel{WAB,id=OCM-233,name='/helloboard',path='/helloboard',bundle=helloboard,context=WebContainerContextWrapper{bundle=helloboard
> [318],contextId='/helloboard',delegate=org.ops4j.pax.web.extender.war.internal.WebApplicationHelper@1641e385}}
> to o.o.p.w.s.j.i.PaxWebServletContextHandler@6ae38bdd
> {/helloboard,null,STOPPED}<mailto:
> o.o.p.w.s.j.i.PaxWebServletContextHandler@6ae38bdd
> %7b/dashboard,null,STOPPED%7d>
> 2022-11-15T19:19:32.522+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Changing default OSGi context model for
> o.o.p.w.s.j.i.PaxWebServletContextHandler@6ae38bdd
> {/helloboard,null,STOPPED}<mailto:
> o.o.p.w.s.j.i.PaxWebServletContextHandler@6ae38bdd
> %7b/dashboard,null,STOPPED%7d>
> 2022-11-15T19:19:32.522+0530 CEF:1 | org.ops4j.pax.web.pax-web-spi | 8.0.6
> | INFO  | ID=273 THR=ploy /helloboard) CAT=OsgiServletContext
>  MSG=Registering
> OsgiServletContext{model=OsgiContextModel{WAB,id=OCM-233,name='/helloboard',path='/helloboard',bundle=helloboard,context=WebContainerContextWrapper{bundle=helloboard
> [318],contextId='/helloboard',delegate=org.ops4j.pax.web.extender.war.internal.WebApplicationHelper@1641e385}}}
> as OSGi service for "/helloboard" context path
> 2022-11-15T19:19:32.523+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Configuring metadata of
> OsgiContextModel{WAB,id=OCM-233,name='/helloboard',path='/helloboard',bundle=helloboard,context=WebContainerContextWrapper{bundle=helloboard
> [318],contextId='/helloboard',delegate=org.ops4j.pax.web.extender.war.internal.WebApplicationHelper@1641e385
> }}
> 2022-11-15T19:19:32.523+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Configuring MIME and Locale Encoding mapping of
> OsgiContextModel{WAB,id=OCM-233,name='/helloboard',path='/helloboard',bundle=helloboard,context=WebContainerContextWrapper{bundle=helloboard
> [318],contextId='/helloboard',delegate=org.ops4j.pax.web.extender.war.internal.WebApplicationHelper@1641e385
> }}
> 2022-11-15T19:19:32.524+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Adding servlet
> ServletModel{id=ServletModel-235,name='audit',urlPatterns=[/uem/data/audit/*,
> /data/audit/*],servletClass=class
> com..gcs.console.helloboard.AuditLogServlet,contexts=null}
> 2022-11-15T19:19:32.524+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Adding servlet
> ServletModel{id=ServletModel-236,name='jsp',urlPatterns=[*.jspx,
> *.jsp],servletClass=class
> org.ops4j.pax.web.jsp.JspServlet,contexts=[{WAB,OCM-233,/helloboard,/helloboard}]}
> 2022-11-15T19:19:32.525+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Adding servlet
> ServletModel{id=ServletModel-237,name='login-typeCheck',urlPatterns=[/loginType/*],servletClass=class
> com..gcs.console.helloboard.LoginTypeCheckServlet,contexts=null}
> 2022-11-15T19:19:32.525+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Adding servlet
> ServletModel{id=ServletModel-238,name='repository',urlPatterns=[/data/docs/*,
> /uem/data/docs/*],servletClass=class
> com..gcs.console.helloboard.RepositoryServlet,contexts=null}
> 2022-11-15T19:19:32.525+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Adding servlet
> ServletModel{id=ServletModel-239,name='helloboard',urlPatterns=[/],servletClass=class
> com..gcs.console.helloboard.HelloboardServlet,contexts=null}
> 2022-11-15T19:19:32.525+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Adding servlet
> ServletModel{id=ServletModel-240,name='basic-auth',urlPatterns=[/login/*],servletClass=class
> com..gcs.console.helloboard.BasicAuthServlet,contexts=null}
> 2022-11-15T19:19:32.525+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Changing filter configuration for context /helloboard
> 2022-11-15T19:19:32.526+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Reconfiguration of welcome files for all resource servlets in
> context
> "OsgiContextModel{WAB,id=OCM-233,name='/helloboard',path='/helloboard',bundle=helloboard,context=WebContainerContextWrapper{bundle=helloboard
> [318],contextId='/helloboard',delegate=org.ops4j.pax.web.extender.war.internal.WebApplicationHelper@1641e385
> }}"
> 2022-11-15T19:19:32.526+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Changing error page configuration for context /helloboard
> 2022-11-15T19:19:32.526+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerWrapper
>        MSG=Starting Jetty context "/helloboard" with default Osgi Context
> OsgiContextModel{WAB,id=OCM-233,name='/helloboard',path='/helloboard',bundle=helloboard,context=WebContainerContextWrapper{bundle=helloboard
> [318],contextId='/helloboard',delegate=org.ops4j.pax.web.extender.war.internal.WebApplicationHelper@1641e385
> }}
> 2022-11-15T19:19:32.528+0530 CEF:1 | org.ops4j.pax.web.pax-web-jsp | 8.0.6
> | INFO  | ID=271 THR=ploy /helloboard) CAT=PaxWebTldScanner
>  MSG=Searching for TLDs in pax-web-jsp bundle
> 2022-11-15T19:19:32.639+0530 CEF:1 | org.ops4j.pax.web.pax-web-jsp | 8.0.6
> | INFO  | ID=271 THR=ploy /helloboard) CAT=PaxWebTldScanner
>  MSG=Searching for TLDs in context configuration (web.xml)
> 2022-11-15T19:19:32.639+0530 CEF:1 | org.ops4j.pax.web.pax-web-jsp | 8.0.6
> | INFO  | ID=271 THR=ploy /helloboard) CAT=PaxWebTldScanner
>  MSG=Searching for TLDs in /WEB-INF/
> 2022-11-15T19:19:32.640+0530 CEF:1 | org.ops4j.pax.web.pax-web-jsp | 8.0.6
> | INFO  | ID=271 THR=ploy /helloboard) CAT=PaxWebTldScanner
>  MSG=Searching for TLDs in bundle helloboard [318]
> 2022-11-15T19:19:32.828+0530 CEF:1 | org.ops4j.pax.web.pax-web-runtime |
> 8.0.6 | INFO  | ID=272 THR=ploy /helloboard) CAT=HttpServiceEnabled
>        MSG=Registering
> EventListenerModel{id=EventListenerModel-252,listener='ch.qos.logback.classic.servlet.LogbackServletContextListener@70476be6
> ',contexts=[{WAB,OCM-233,/helloboard,/helloboard}]}
> 2022-11-15T19:19:32.828+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerController
>       MSG=Receiving Batch{"Registration of
> EventListenerModel{id=EventListenerModel-252,listener='ch.qos.logback.classic.servlet.LogbackServletContextListener@70476be6',contexts=[{WAB,OCM-233,/helloboard,/helloboard}]}",
> size=1}
> 2022-11-15T19:19:32.830+0530 CEF:1 | org.ops4j.pax.web.pax-web-runtime |
> 8.0.6 | INFO  | ID=272 THR=ploy /helloboard) CAT=HttpServiceEnabled
>        MSG=Registering
> EventListenerModel{id=EventListenerModel-251,listener='org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer$ContextDestroyListener@526531fa
> ',contexts=[{WAB,OCM-233,/helloboard,/helloboard}]}
> 2022-11-15T19:19:32.831+0530 CEF:1 | org.ops4j.pax.web.pax-web-jetty |
> 8.0.6 | INFO  | ID=270 THR=ploy /helloboard) CAT=JettyServerController
>       MSG=Receiving Batch{"Registration of
> EventListenerModel{id=EventListenerModel-251,listener='org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer$ContextDestroyListener@526531fa',contexts=[{WAB,OCM-233,/helloboard,/helloboard}]}",
> size=1}
> 2022-11-15T19:19:32.834+0530 CEF:1 | org.eclipse.jetty.util |
> 9.4.48.v20220622 | INFO  | ID=243 THR=ploy /helloboard) CAT=ContextHandler
>                  MSG=Started
> o.o.p.w.s.j.i.PaxWebServletContextHandler@6ae38bdd
> {ServerHelloboard,/helloboard,null,AVAILABLE}<mailto:
> o.o.p.w.s.j.i.PaxWebServletContextHandler@6ae38bdd
> %7bServerDashboard,/dashboard,null,AVAILABLE%7d>
>
>
>
> From: Prashanth Ettaboina
> Sent: 15 November 2022 16:28
> To: 'iss...@karaf.apache.org' <iss...@karaf.apache.org>; '
> dev@karaf.apache.org' <dev@karaf.apache.org>; 'u...@karaf.apache.org' <
> u...@karaf.apache.org>
> Subject: RE: Unable to create default RequestDispatcher
>
> Hi Grzegorz,
>
> I'm not registering the ExampleServlet anywhere, I'm configuring them in
> web.xml.
> In the web.xml we are giving the servlet and servlet mapping with
> url-pattern and class path.
>
> Thanks,
> Prashanth Ettaboina.
>
> From: Prashanth Ettaboina
> Sent: 14 November 2022 19:11
> To: iss...@karaf.apache.org<mailto:iss...@karaf.apache.org>;
> dev@karaf.apache.org<mailto:dev@karaf.apache.org>; u...@karaf.apache.org
> <mailto:u...@karaf.apache.org>
> Subject: Unable to create default RequestDispatcher
>
> Hi Team,
>
> I have updated my KARAF version from 4.2.15 to 4.4.1 and Java from 8 to 11
> in my application.
> Gone through the official Release notes and updated some dependencies as
> well.
>
> Upgraded OSGI-Core from 6.0.0 to 8.0.0.
> Upgraded osgi.compendium 5.0.0 to osgi.cmpn 7.0.0
> Upgraded Jetty from 9.4.43.v20210629 to 9.4.46.v20220331.
> Upgraded pax-web-spi from 4.3.4 to 7.2.11.
> I'm using javax.servlet-api 3.1.0 version in my application.
>
> I'm unable to create default RequestDispatcher.
> Please check the below code lines.
>
> public class ExampleServlet extends HttpServlet {
>       protected void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
>              RequestDispatcher requestDispatcher =
> getServletContext().getNamedDispatcher("default"); // get
> getServletContext() is calling the method in GenericServlet.
>              requestDispatcher.include(request, response);
>       }
> }
>
> the above code used to work fine before the version upgrades but now I'm
> getting the requestDispatcher as null.
>
> Can anyone please look at it, let me know if I'm missing something.
>
> Thanks,
> Prashanth Ettaboina
>
>
>
>

Reply via email to