Re: error page servlet register twice

2019-09-10 Thread Nhut Thai Le
Hello,

I'll put the breakpoint at addErrorPageModel and check the value when this
error happen again.
About the prototype, i use it because both R6 and R7 recommends in section
140.5

Thai

On Tue, Sep 10, 2019 at 3:29 AM Grzegorz Grzybek 
wrote:

> Hello
>
> We have:
>  –
> org.ops4j.pax.web.itest.undertow.WhiteboardR6IntegrationTest#testErrorServlet
>  –
> org.ops4j.pax.web.itest.jetty.WhiteboardR6IntegrationTest#testErrorServlet
>  –
> org.ops4j.pax.web.itest.tomcat.WhiteboardR6IntegrationTest#testErrorServlet
>
> which tests servlet with "osgi.http.whiteboard.servlet.errorPage = [
> "404", "442", "5xx", "java.io.IOException" ]". This test never failed with
> such exception...
>
> Questions:
>  – did you try debugging and checking what's passed in
> org.ops4j.pax.web.service.spi.model.ServiceModel#addErrorPageModel? (e.g.,
> value of org.ops4j.pax.web.service.spi.model.ContextModel#classLoader)
> inside ErrorModel?
>  – why do you use scope = prototype?
>
> regards
> Grzegorz Grzybek
>
> wt., 3 wrz 2019 o 16:46 Nhut Thai Le  napisał(a):
>
>> Hello,
>>
>> We are using pax-web-extender-whiteboard 7.2.4 on equinox and I have a
>> few error page servlet annotated as followed:
>> @Component(
>> service = Servlet.class,
>> property = {
>> HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME + "=Error403Servlet",
>> "alias=/error403",
>> "osgi.http.whiteboard.servlet.errorPage=403",
>> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
>> =WebviewerServletContextHelper)"
>> },
>> scope = ServiceScope.PROTOTYPE
>> )
>> public final class Error403Servlet extends HttpServlet {...}
>>
>> However, sometimes when we start the server, we got this error:
>>
>> java.lang.IllegalArgumentException 
>> :
>>  Error 
>> 
>>  page for [403] already registered.
>>  at 
>> org.ops4j.pax.web.service.spi.model.ServiceModel.addErrorPageModel(ServiceModel.java:315)
>>  at 
>> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerErrorPage(HttpServiceStarted.java:961)
>>  at 
>> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerErrorPage(HttpServiceProxy.java:343)
>>  at 
>> org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:107)
>>  at 
>> org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElement(WebApplication.java:392)
>>  at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
>>  at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
>>  at java.util.ArrayList 
>> $ArrayListSpliterator.forEachRemaining(Unknown
>>  Source)
>>  at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
>>  at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
>>  at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown 
>> Source)
>>  at 
>> java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown 
>> Source)
>>  at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
>>  at java.util.stream.ReferencePipeline.forEach(Unknown Source)
>>  at 
>> org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.addWebElement(WebApplication.java:170)
>>  at 
>> org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractTracker.addingService(AbstractTracker.java:193)
>>  at 
>> org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractTracker.addingService(AbstractTracker.java:46)
>>  at 
>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>>  at 
>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
>>  at 
>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>>  at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
>>  at 
>> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
>>  at 
>> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
>>  at 
>> org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:920)
>>  at 
>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
>>  at 
>> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
>>  at 
>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
>>  at 
>> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
>>  at 
>> 

Re: alias: '/errorServlet' is already in use in this or another context when register more than one errorPage servlet

2019-09-10 Thread Nhut Thai Le
Yes, I'll update the other question with logs

Thai

On Tuesday, August 6, 2019 at 1:28:13 PM UTC-4, Nhut Thai Le wrote:
>
> Hello,
>
> I have a few error page servlets to handle 403, 404 and 500 errors. They 
> are annotated according to osgi cmpn R6  as  follow:
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=403",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error403Servlet extends HttpServlet {...}
>
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=404",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error404Servlet extends HttpServlet {..}
>
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=500",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error500Servlet extends HttpServlet {..}
>
> When i start the server, i got this error:
> 13:13:53.716 [paxweb-config-1-thread-1] ERROR o.o.p.w.e.w.i.WebApplication 
> - Registration skipped for 
> [ServletWebElement{mapping=DefaultServletMapping{httpContextId=WebviewerServletContextHelper,urlPatterns=null,initParams={},servlet=com.castortech.iris.ba.webviewer.internal.Error500Servlet@1399c32a,
>  
> alias=/errorServlet, servletNameError500Servlet}}] due to error during 
> registration
> org.osgi.service.http.NamespaceException: alias: '/errorServlet' is 
> already in use in this or another context
> at 
> org.ops4j.pax.web.service.spi.model.ServerModel.addServletModel(ServerModel.java:124)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:243)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:223)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:207)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerServlet(HttpServiceProxy.java:69)
> at 
> org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:88)
> Tracing the code to the ServletWebElement.register(), i see that all my 
> error page servlets above have the same alias (/errorServlet) which cause 
> pax.web to throw exception and skip registration when it encounter the 2nd 
> error page servlet. Is this a known bug and how do I get around this?
> I am using pax-web-extender-whiteboard 7.2.4
>
> Thai Le
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/c4c05bb7-e4d7-42d1-b079-602410ac17a8%40googlegroups.com.


Re: alias: '/errorServlet' is already in use in this or another context when register more than one errorPage servlet

2019-09-10 Thread Grzegorz Grzybek
Hello

So back to the case you've described in your email "error page servlet
register twice" ;)

Is there a chance to get some logs?

regards
Grzegorz Grzybek

wt., 10 wrz 2019 o 16:25 Nhut Thai Le  napisał(a):

> Thank you Grzegorz,
>
> I did what you said and the error does go away but from time to time i got
> this:
>
> java.lang.IllegalArgumentException 
> :
>  Error 
> 
>  page for [403] already registered.
>   at 
> org.ops4j.pax.web.service.spi.model.ServiceModel.addErrorPageModel(ServiceModel.java:315)
>   at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerErrorPage(HttpServiceStarted.java:961)
>   at 
> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerErrorPage(HttpServiceProxy.java:343)
>   at 
> org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:107)
>   at 
> org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElement(WebApplication.java:392)
>
>
> Is it possible that this is due to race condition in scr?
>
> Thai
>
> On Tuesday, August 6, 2019 at 1:28:13 PM UTC-4, Nhut Thai Le wrote:
>>
>> Hello,
>>
>> I have a few error page servlets to handle 403, 404 and 500 errors. They
>> are annotated according to osgi cmpn R6  as  follow:
>> @Component(
>> service = Servlet.class,
>> enabled=true,
>> property = {
>> "osgi.http.whiteboard.servlet.errorPage=403",
>> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
>> =WebviewerServletContextHelper)"
>> },
>> scope = ServiceScope.PROTOTYPE
>> )
>> public final class Error403Servlet extends HttpServlet {...}
>>
>> @Component(
>> service = Servlet.class,
>> enabled=true,
>> property = {
>> "osgi.http.whiteboard.servlet.errorPage=404",
>> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
>> =WebviewerServletContextHelper)"
>> },
>> scope = ServiceScope.PROTOTYPE
>> )
>> public final class Error404Servlet extends HttpServlet {..}
>>
>> @Component(
>> service = Servlet.class,
>> enabled=true,
>> property = {
>> "osgi.http.whiteboard.servlet.errorPage=500",
>> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
>> =WebviewerServletContextHelper)"
>> },
>> scope = ServiceScope.PROTOTYPE
>> )
>> public final class Error500Servlet extends HttpServlet {..}
>>
>> When i start the server, i got this error:
>> 13:13:53.716 [paxweb-config-1-thread-1] ERROR
>> o.o.p.w.e.w.i.WebApplication - Registration skipped for
>> [ServletWebElement{mapping=DefaultServletMapping{httpContextId=WebviewerServletContextHelper,urlPatterns=null,initParams={},servlet=com.castortech.iris.ba.webviewer.internal.Error500Servlet@1399c32a,
>> alias=/errorServlet, servletNameError500Servlet}}] due to error during
>> registration
>> org.osgi.service.http.NamespaceException: alias: '/errorServlet' is
>> already in use in this or another context
>> at
>> org.ops4j.pax.web.service.spi.model.ServerModel.addServletModel(ServerModel.java:124)
>> at
>> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:243)
>> at
>> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:223)
>> at
>> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:207)
>> at
>> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerServlet(HttpServiceProxy.java:69)
>> at
>> org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:88)
>> Tracing the code to the ServletWebElement.register(), i see that all my
>> error page servlets above have the same alias (/errorServlet) which cause
>> pax.web to throw exception and skip registration when it encounter the 2nd
>> error page servlet. Is this a known bug and how do I get around this?
>> I am using pax-web-extender-whiteboard 7.2.4
>>
>> Thai Le
>>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/be34dfba-9b9b-4051-9f48-547322ab5ce2%40googlegroups.com
> 
> .
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion 

Re: alias: '/errorServlet' is already in use in this or another context when register more than one errorPage servlet

2019-09-10 Thread Nhut Thai Le
Thank you Grzegorz,

I did what you said and the error does go away but from time to time i got 
this:

java.lang.IllegalArgumentException 
:
 Error 

 page for [403] already registered.
at 
org.ops4j.pax.web.service.spi.model.ServiceModel.addErrorPageModel(ServiceModel.java:315)
at 
org.ops4j.pax.web.service.internal.HttpServiceStarted.registerErrorPage(HttpServiceStarted.java:961)
at 
org.ops4j.pax.web.service.internal.HttpServiceProxy.registerErrorPage(HttpServiceProxy.java:343)
at 
org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:107)
at 
org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElement(WebApplication.java:392)


Is it possible that this is due to race condition in scr?

Thai

On Tuesday, August 6, 2019 at 1:28:13 PM UTC-4, Nhut Thai Le wrote:
>
> Hello,
>
> I have a few error page servlets to handle 403, 404 and 500 errors. They 
> are annotated according to osgi cmpn R6  as  follow:
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=403",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error403Servlet extends HttpServlet {...}
>
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=404",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error404Servlet extends HttpServlet {..}
>
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=500",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error500Servlet extends HttpServlet {..}
>
> When i start the server, i got this error:
> 13:13:53.716 [paxweb-config-1-thread-1] ERROR o.o.p.w.e.w.i.WebApplication 
> - Registration skipped for 
> [ServletWebElement{mapping=DefaultServletMapping{httpContextId=WebviewerServletContextHelper,urlPatterns=null,initParams={},servlet=com.castortech.iris.ba.webviewer.internal.Error500Servlet@1399c32a,
>  
> alias=/errorServlet, servletNameError500Servlet}}] due to error during 
> registration
> org.osgi.service.http.NamespaceException: alias: '/errorServlet' is 
> already in use in this or another context
> at 
> org.ops4j.pax.web.service.spi.model.ServerModel.addServletModel(ServerModel.java:124)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:243)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:223)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:207)
> at 
> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerServlet(HttpServiceProxy.java:69)
> at 
> org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:88)
> Tracing the code to the ServletWebElement.register(), i see that all my 
> error page servlets above have the same alias (/errorServlet) which cause 
> pax.web to throw exception and skip registration when it encounter the 2nd 
> error page servlet. Is this a known bug and how do I get around this?
> I am using pax-web-extender-whiteboard 7.2.4
>
> Thai Le
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/be34dfba-9b9b-4051-9f48-547322ab5ce2%40googlegroups.com.


Re: [PAX-LOGGING] Preparing to release pax-logging 2.0.0 with R7 support

2019-09-10 Thread 'Achim Nierbeck' via OPS4J
Hi,

how about doing it as with Pax-Web ... get as close as possible and proceed
from there on.
So a 2.0.1 will be more or fully compliant?

regards, Achim


Am Di., 10. Sept. 2019 um 11:31 Uhr schrieb Grzegorz Grzybek <
gr.grzy...@gmail.com>:

> Hello
>
> Current master branch of pax-logging Github repository (2.0.0-SNAPSHOT)
> already has https://ops4j1.jira.com/browse/PAXLOGGING-269 issue fixed.
>
> This means that new (from OSGi CMPN R7):
>  – org.osgi.service.log.LoggerFactory
>  – org.osgi.service.log.Logger
>
> interfaces are implemented by pax-logging itself and
> "org.osgi.service.log" is (re)exported at version 1.4.
>
> Complete R7 implementation would require implementation of additional
> packages:
>  – org.osgi.service.log.admin
>  – org.osgi.service.log.stream
>
> but I didn't have time yet to do it.
>
> LoggerFactory and Logger interfaces are however fully implemented in 3
> backends (log4j1, log4j2 and logback). New integration tests are added that
> show how these new interfaces can be used.
>
> What do you think about releasing pax-logging 2.0.0 (or e.g., 2.0.0.CR1)
> before fully implementing R7 specification in, say, pax-logging 2.1.0?
>
> regards
> Grzegorz Grzybek
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/CAAdXmhqcCn6GDEgTiSfDEsgSvrBP2-h4c7C7cE6QjCNRTMtJGw%40mail.gmail.com
> 
> .
>


-- 

Apache Member
Apache Karaf  Committer & PMC
OPS4J Pax Web  Committer &
Project Lead
blog 
Co-Author of Apache Karaf Cookbook 

Software Architect / Project Manager / Scrum Master

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAD0r13cNuSdXzLK-Z43xYErQy11Xvu4hOL8R--0MDgWe9FQJmg%40mail.gmail.com.


[PAX-LOGGING] Preparing to release pax-logging 2.0.0 with R7 support

2019-09-10 Thread Grzegorz Grzybek
Hello

Current master branch of pax-logging Github repository (2.0.0-SNAPSHOT)
already has https://ops4j1.jira.com/browse/PAXLOGGING-269 issue fixed.

This means that new (from OSGi CMPN R7):
 – org.osgi.service.log.LoggerFactory
 – org.osgi.service.log.Logger

interfaces are implemented by pax-logging itself and "org.osgi.service.log"
is (re)exported at version 1.4.

Complete R7 implementation would require implementation of additional
packages:
 – org.osgi.service.log.admin
 – org.osgi.service.log.stream

but I didn't have time yet to do it.

LoggerFactory and Logger interfaces are however fully implemented in 3
backends (log4j1, log4j2 and logback). New integration tests are added that
show how these new interfaces can be used.

What do you think about releasing pax-logging 2.0.0 (or e.g., 2.0.0.CR1)
before fully implementing R7 specification in, say, pax-logging 2.1.0?

regards
Grzegorz Grzybek

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhqcCn6GDEgTiSfDEsgSvrBP2-h4c7C7cE6QjCNRTMtJGw%40mail.gmail.com.


Re: how does osgi.http.whiteboard.filter.regex got passed to servlet container?

2019-09-10 Thread Grzegorz Grzybek
Hello

czw., 15 sie 2019 o 15:58 Nhut Thai Le  napisał(a):

> Hello,
>
> In section 140.5 of the osgi cmpn r7, it states that either
> osgi.http.whiteboard.filter.pattern, osgi.http.whiteboard.filter.regex or
> osgi.http.whiteboard.filter.servlet need to be specified. As far as I
> remember, when i was using web.xml to register servlet filters, i can only
> either specify a url-pattern or a servlet in the filter-mapping element.
> These correspond to the osgi.http.whiteboard.filter.pattern and
> osgi.http.whiteboard.filter.servlet attribute so my take is that the
> whiteboard implementation pass the values of these attributes to the
> servlet container as is. What about the osgi.http.whiteboard.filter.regex?
> Since the servlet spec does not have this, would the whiteboard impl need
> to convert the regex to some filter pattern before passing it to the
> servlet container? Does paxweb support registering servlet filter with
> osgi.http.whiteboard.filter.regex?
>

Probably we should involve some creativity here. OSGi CMPN R7 is not yet
implemented in PAX-WEB (see https://ops4j1.jira.com/browse/PAXWEB-1181 and
https://ops4j1.jira.com/browse/PAXWEB-1190). Even R6 still needs some
polishing (with respect to contexts and selectors for example).

As Camel developers say - we love contributions ;)

regards
Grzegorz Grzybek


>
> Thai
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/15b9ec46-a1e0-435f-a031-2c1657cf33b9%40googlegroups.com
> 
> .
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhr5icZQ_b7Yg%2BU85TCZC%2BXT0wUrAQ-5Rar-jGu81ui6xA%40mail.gmail.com.


Re: [PAX-WEB] In Karaf using Jetty 9.3 and Pax-Web, is there a way to override the default SessionManager for ALL?

2019-09-10 Thread Grzegorz Grzybek
Hello

Sorry for late answer.

org.ops4j.pax.web.service.jetty.internal.HttpServiceContext (extension of
org.eclipse.jetty.servlet.ServletContextHandler), when created uses
"SESSIONS | SECURITY".
Session handler is created as:

   - 
org.ops4j.pax.web.service.jetty.internal.LateInvalidatingHashSessionManager,
   or
   - org.eclipse.jetty.server.session.JDBCSessionManager

(that's hardcoded in
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext#newSessionHandler()).

The chosen session manager depends on what's returned by
org.eclipse.jetty.server.Server#getSessionIdManager().
LateInvalidatingHashSessionManager is chosen by default, without explicit
configuration. The JDBCSessionManager is chosen if SessionIDManager is
org.eclipse.jetty.server.session.JDBCSessionIdManager.

I believe JDBCSessionIdManager can be configured in etc/jetty.xml as in
https://www.eclipse.org/jetty/documentation/9.3.27.v20190418/session-clustering-jdbc.html

regards
Grzegorz Grzybek

czw., 22 sie 2019 o 00:59 Peter Berkman 
napisał(a):

> In Karaf using Jetty 9.3 and Pax-Web, is there a way to override the
> default SessionManager for ALL?
>
> I don't have access to all of the web.xml or bundles.  I've searched for
> hours and cannot find anything...  I'm hoping someone here will have an
> idea!  Thank YOU!
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/927a810f-91ee-409e-95f2-819e1d9faa53%40googlegroups.com
> 
> .
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhrLs8DaMc12sq%2B2ZGnNyzpJPjW80t9GJWcqpzYA0gwZHw%40mail.gmail.com.


Re: pax-web-undertow support for proxy-address-forwarding and checkForwardedHeaders

2019-09-10 Thread Hannes Holtzhausen
Great!  Looking forward to the Redhat Fuse 7.5 updates.


On Tue, Sep 10, 2019 at 10:28 AM Grzegorz Grzybek 
wrote:

> Thanks Hannes for the patch!
>
> https://ops4j1.jira.com/browse/PAXWEB-1233 is fixed now.
>
> regards
> Grzegorz Grzybek
>
> wt., 10 wrz 2019 o 10:09 Grzegorz Grzybek 
> napisał(a):
>
>> Hello
>>
>> I created https://ops4j1.jira.com/browse/PAXWEB-1233 to track this.
>> Should be fixed with pax-web 7.3.4.
>>
>> regards
>> Grzegorz Grzybek
>>
>> czw., 22 sie 2019 o 08:19 Hannes Holtzhausen <
>> hannes.holtzhau...@gmail.com> napisał(a):
>>
>>> Good day
>>>
>>> Pax-web-undertow 7.3.3 ignores the proxy-address-forwarding attribute
>>> and org.osgi.service.http.checkForwardedHeaders property.
>>>
>>> As a result non of the X-Forwarded headers are applied to the http
>>> request in scenarios where SSL is offloaded using a load balancer.
>>> This in turn causes the java keycloak adapter to formulate incorrect
>>> redirect_uri's and breaks the standard OIDC flow.
>>>
>>> We are running pax-web-undertow as part of the Redhat JBoss Fuse 7.4.0
>>> distribution.
>>>
>>> I applied a fix to the web-7.3.3 tag and have tested it successfully in
>>> our environment. Find attached my changes for possible inclusion in
>>> an upcoming 7.3.x release.
>>>
>>> Hannes
>>>
>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>>
>>> ---
>>> 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 ops4j+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ops4j/f380a9e8-e944-4c4c-b959-a1c43c77f5d1%40googlegroups.com
>>> 
>>> .
>>>
>> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/CAAdXmhpX6Ok1K%3DhrA6Xr7nzersxrD1gVm993wc%2BOMbHzY8TRDA%40mail.gmail.com
> 
> .
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAP2cffrp-kGknmdxri_4FXfPg9L1f-2niGO8z0zKHXNCorLbA%40mail.gmail.com.


Re: pax-web-undertow support for proxy-address-forwarding and checkForwardedHeaders

2019-09-10 Thread Grzegorz Grzybek
Thanks Hannes for the patch!

https://ops4j1.jira.com/browse/PAXWEB-1233 is fixed now.

regards
Grzegorz Grzybek

wt., 10 wrz 2019 o 10:09 Grzegorz Grzybek  napisał(a):

> Hello
>
> I created https://ops4j1.jira.com/browse/PAXWEB-1233 to track this.
> Should be fixed with pax-web 7.3.4.
>
> regards
> Grzegorz Grzybek
>
> czw., 22 sie 2019 o 08:19 Hannes Holtzhausen 
> napisał(a):
>
>> Good day
>>
>> Pax-web-undertow 7.3.3 ignores the proxy-address-forwarding attribute and 
>> org.osgi.service.http.checkForwardedHeaders
>> property.
>>
>> As a result non of the X-Forwarded headers are applied to the http
>> request in scenarios where SSL is offloaded using a load balancer.
>> This in turn causes the java keycloak adapter to formulate incorrect
>> redirect_uri's and breaks the standard OIDC flow.
>>
>> We are running pax-web-undertow as part of the Redhat JBoss Fuse 7.4.0
>> distribution.
>>
>> I applied a fix to the web-7.3.3 tag and have tested it successfully in
>> our environment. Find attached my changes for possible inclusion in
>> an upcoming 7.3.x release.
>>
>> Hannes
>>
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> 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 ops4j+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ops4j/f380a9e8-e944-4c4c-b959-a1c43c77f5d1%40googlegroups.com
>> 
>> .
>>
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhpX6Ok1K%3DhrA6Xr7nzersxrD1gVm993wc%2BOMbHzY8TRDA%40mail.gmail.com.


Re: pax-web-undertow support for proxy-address-forwarding and checkForwardedHeaders

2019-09-10 Thread Grzegorz Grzybek
Hello

I created https://ops4j1.jira.com/browse/PAXWEB-1233 to track this. Should
be fixed with pax-web 7.3.4.

regards
Grzegorz Grzybek

czw., 22 sie 2019 o 08:19 Hannes Holtzhausen 
napisał(a):

> Good day
>
> Pax-web-undertow 7.3.3 ignores the proxy-address-forwarding attribute and 
> org.osgi.service.http.checkForwardedHeaders
> property.
>
> As a result non of the X-Forwarded headers are applied to the http
> request in scenarios where SSL is offloaded using a load balancer.
> This in turn causes the java keycloak adapter to formulate incorrect
> redirect_uri's and breaks the standard OIDC flow.
>
> We are running pax-web-undertow as part of the Redhat JBoss Fuse 7.4.0
> distribution.
>
> I applied a fix to the web-7.3.3 tag and have tested it successfully in
> our environment. Find attached my changes for possible inclusion in
> an upcoming 7.3.x release.
>
> Hannes
>
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/f380a9e8-e944-4c4c-b959-a1c43c77f5d1%40googlegroups.com
> 
> .
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhq7Z0JYrZuXYnyue-M1uw%2BratKyE8z3KnGny91izqbtqA%40mail.gmail.com.


Re: error page servlet register twice

2019-09-10 Thread Grzegorz Grzybek
Hello

We have:
 –
org.ops4j.pax.web.itest.undertow.WhiteboardR6IntegrationTest#testErrorServlet
 –
org.ops4j.pax.web.itest.jetty.WhiteboardR6IntegrationTest#testErrorServlet
 –
org.ops4j.pax.web.itest.tomcat.WhiteboardR6IntegrationTest#testErrorServlet

which tests servlet with "osgi.http.whiteboard.servlet.errorPage = [ "404",
"442", "5xx", "java.io.IOException" ]". This test never failed with such
exception...

Questions:
 – did you try debugging and checking what's passed in
org.ops4j.pax.web.service.spi.model.ServiceModel#addErrorPageModel? (e.g.,
value of org.ops4j.pax.web.service.spi.model.ContextModel#classLoader)
inside ErrorModel?
 – why do you use scope = prototype?

regards
Grzegorz Grzybek

wt., 3 wrz 2019 o 16:46 Nhut Thai Le  napisał(a):

> Hello,
>
> We are using pax-web-extender-whiteboard 7.2.4 on equinox and I have a few
> error page servlet annotated as followed:
> @Component(
> service = Servlet.class,
> property = {
> HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME + "=Error403Servlet",
> "alias=/error403",
> "osgi.http.whiteboard.servlet.errorPage=403",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error403Servlet extends HttpServlet {...}
>
> However, sometimes when we start the server, we got this error:
>
> java.lang.IllegalArgumentException 
> :
>  Error 
> 
>  page for [403] already registered.
>   at 
> org.ops4j.pax.web.service.spi.model.ServiceModel.addErrorPageModel(ServiceModel.java:315)
>   at 
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerErrorPage(HttpServiceStarted.java:961)
>   at 
> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerErrorPage(HttpServiceProxy.java:343)
>   at 
> org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:107)
>   at 
> org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.registerWebElement(WebApplication.java:392)
>   at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
>   at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
>   at java.util.ArrayList 
> $ArrayListSpliterator.forEachRemaining(Unknown
>  Source)
>   at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
>   at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
>   at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown 
> Source)
>   at 
> java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
>   at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
>   at java.util.stream.ReferencePipeline.forEach(Unknown Source)
>   at 
> org.ops4j.pax.web.extender.whiteboard.internal.WebApplication.addWebElement(WebApplication.java:170)
>   at 
> org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractTracker.addingService(AbstractTracker.java:193)
>   at 
> org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractTracker.addingService(AbstractTracker.java:46)
>   at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>   at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
>   at 
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>   at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
>   at 
> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
>   at 
> org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
>   at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:920)
>   at 
> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
>   at 
> org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
>   at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
>   at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
>   at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
>   at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
>   at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469)
>   at 
> 

Re: alias: '/errorServlet' is already in use in this or another context when register more than one errorPage servlet

2019-09-10 Thread Grzegorz Grzybek
Hello

The error is correct - you didn't specify the patterns for error servlets,
thus "/errorServlet" was assumed.

You have two options:

1. add @javax.servlet.annotation.WebServlet annotation and use "value" or
"urlPatterns" params of this annotation - these will be used instead of
"/errorServlet"
2. use "alias" or "urlPatterns" service properties on @Component annotation

I hope this helps.
regards
Grzegorz Grzybek

wt., 6 sie 2019 o 19:28 Nhut Thai Le  napisał(a):

> Hello,
>
> I have a few error page servlets to handle 403, 404 and 500 errors. They
> are annotated according to osgi cmpn R6  as  follow:
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=403",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error403Servlet extends HttpServlet {...}
>
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=404",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error404Servlet extends HttpServlet {..}
>
> @Component(
> service = Servlet.class,
> enabled=true,
> property = {
> "osgi.http.whiteboard.servlet.errorPage=500",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)"
> },
> scope = ServiceScope.PROTOTYPE
> )
> public final class Error500Servlet extends HttpServlet {..}
>
> When i start the server, i got this error:
> 13:13:53.716 [paxweb-config-1-thread-1] ERROR o.o.p.w.e.w.i.WebApplication
> - Registration skipped for
> [ServletWebElement{mapping=DefaultServletMapping{httpContextId=WebviewerServletContextHelper,urlPatterns=null,initParams={},servlet=com.castortech.iris.ba.webviewer.internal.Error500Servlet@1399c32a,
> alias=/errorServlet, servletNameError500Servlet}}] due to error during
> registration
> org.osgi.service.http.NamespaceException: alias: '/errorServlet' is
> already in use in this or another context
> at
> org.ops4j.pax.web.service.spi.model.ServerModel.addServletModel(ServerModel.java:124)
> at
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:243)
> at
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:223)
> at
> org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:207)
> at
> org.ops4j.pax.web.service.internal.HttpServiceProxy.registerServlet(HttpServiceProxy.java:69)
> at
> org.ops4j.pax.web.extender.whiteboard.internal.element.ServletWebElement.register(ServletWebElement.java:88)
> Tracing the code to the ServletWebElement.register(), i see that all my
> error page servlets above have the same alias (/errorServlet) which cause
> pax.web to throw exception and skip registration when it encounter the 2nd
> error page servlet. Is this a known bug and how do I get around this?
> I am using pax-web-extender-whiteboard 7.2.4
>
> Thai Le
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/b5bf8863-4c95-4471-a46d-5ed004c2491f%40googlegroups.com
> 
> .
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhpBzVV6VGYAqP8rtZ8%3DkVL%3DfAuB%3DNtQbsyX-1uwcMBo6g%40mail.gmail.com.