Hello

I had your email marked as _unread_ for long time - sorry I didn't answer
earlier...

I think the answer may be funnier and simpler than expected...

Most registerXXX() methods inside HttpServiceStarted call
`org.ops4j.pax.web.service.internal.HttpServiceStarted#getOrCreateContext()`
method. Only
`org.ops4j.pax.web.service.internal.HttpServiceStarted#registerWelcomeFiles()`
calls simply
org.ops4j.pax.web.service.spi.model.ServiceModel#getContextModel(), so if
the welcome files are first thing you do, no wonder you're getting null
"context".

The reason is
https://github.com/ops4j/org.ops4j.pax.web/commit/76a1042a84c9b14d2abbd3e97499919ae15536b6
commit from 4th August 2008...

I'm just checking
org.ops4j.pax.web.itest.common.AbstractWebContainerIntegrationTest#testWelcomFiles
test and everything works fine, because the sequence of registrations in
org.ops4j.pax.web.samples.helloworld.wc.internal.Activator#start() starts
with servlet registration...

so I have one recommendation - please register something before welcome
pages ;)

I'm reviewing entire Pax Web in version 8 and the registrations will be
done a bit different (but not much).

regards
Grzegorz Grzybek

śr., 26 lut 2020 o 09:32 Silvano Maffeis <[email protected]> napisał(a):

> I've tried the newest 7.3.6 now and I'm still getting this
> NullPointerException:
>
> org.apache.felix.log.LogException: org.ops4j.lang.NullArgumentException:
> Context model is null.
> at
> org.ops4j.lang.NullArgumentException.validateNotNull(NullArgumentException.java:74)
> at org.ops4j.pax.web.service.spi.model.Model.<init>(Model.java:27)
> at
> org.ops4j.pax.web.service.spi.model.WelcomeFileModel.<init>(WelcomeFileModel.java:32)
> at
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerWelcomeFiles(HttpServiceStarted.java:1005)
> at
> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerWelcomeFiles(HttpServiceProxy.java:364)
>
> The use case is where only static resources are being exposes, and
> registerWelcomeFiles is called.
> I hit the NPE trying to access the welcome page (index.html):
>
> WebContainer webCont = ...
>
> webCont.registerResources(urlPath, urlPath , httpContext);
> webCont.registerWelcomeFiles(new String[] { "index.html" }, true,
> httpContext);
>
> Silvano
>
> On Thu, Dec 12, 2019 at 6:14 PM Silvano Maffeis <[email protected]>
> wrote:
>
>> This used to work with pax-web 4.2.7
>>
>>
>
> --
> Silvano Maffeis
> Dr. oec. publ.
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/CAMuHPN2dYu1QE8kDp%2BZoj2OY4G0-KB6CGAyhmXQu4Oqn3idoAw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ops4j/CAMuHPN2dYu1QE8kDp%2BZoj2OY4G0-KB6CGAyhmXQu4Oqn3idoAw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhorsQfdAHVxruY-_m9_eYmRTRb%2B8%2BzQEOzgOngphXLKgw%40mail.gmail.com.

Reply via email to