You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Thomas Driessen <th...@gmail.com> on 2019/02/04 08:48:35 UTC
ServletContextListener not working?
Hi,
I've already asked on the general OSGi Dev mailing list, but I think
this might be a more appropriate place to ask:
I just tried to get a ServletContextListener to work, but did not
succeed, although everything is done as defined by the spec.
Here you can find a minimal example of my setup
https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
The Servlet I'm registering is working fine, but the
ServletContextListener that I registered too is never called.
Even if I call getServletContext() from within the Servlet, my Listener
is never called.
I would have expected the ServletContextListener to be called at least
once, after a DefaultServletContext has been created by the
ServletContainer, or am I wrong with this assumption?
Kind regards,
Thomas
Re[7]: ServletContextListener not working?
Posted by Thomas Driessen <th...@gmail.com>.
For all of you who are having the same issue in felix.http 4.0.6:
Change the ServletContextListener component from this
@Component
@HttpWhiteboardListener
public class MySCL implements ServletContextListener
to this:
@Component(property= {HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER +
"=true"})
public class MySCL implements ServletContextListener
The version of felix.http affected is 4.0.6. Hopefully this will be
fixed in 4.0.8
An explanation can be found here:
https://issues.apache.org/jira/browse/FELIX-6049
------ Originalnachricht ------
Von: "Thomas Driessen" <th...@gmail.com>
An: "felix users" <us...@felix.apache.org>
Gesendet: 05.02.2019 14:02:55
Betreff: Re[6]: ServletContextListener not working?
>Today I tried to get my listener working with a specific context and
>added a ServletContextHelper and added a corresponding
>@HttpWhiteboardContextSelect annotation to my SCL. Did not work either.
>
>I also tried to change the type to a ServletRequestListener instead of
>a ServletContextListener. Still didn't work.
>
>Is there anybody who can help me on this issue?
>I'm pretty clueless right now :(
>
>Again this is my setup, maybe someone spots an error in it:
>
>Bundles in runtime:
>
>START LEVEL 1
> ID|State |Level|Name
> 0|Active | 0|OSGi System Bundle
>(3.13.100.v20180827-1536)|3.13.100.v20180827-1536
> 1|Active | 1|osgi.possiblebugs.scl.impl
>(0.0.1.201902051255)|0.0.1.201902051255
> 2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3
> 3|Active | 1|Apache Commons IO (2.6.0)|2.6.0
> 4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
> 5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
> 6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
> 7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6Li
> 8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2
> 9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4
> 10|Active | 1|Apache Felix Declarative Services
>(2.1.10)|2.1.10
> 11|Active | 1|Apache Felix Web Management Console
>(4.3.4)|4.3.4
> 12|Active | 1|Apache Felix Web Console Service Component
>Runtime/Declarative Services Plugin (2.0.8)|2.0.8
> 13|Active | 1|org.osgi:org.osgi.util.function
>(1.1.0.201802012106)|1.1.0.201802012106
>g!
>
>List of components:
>
>io.jatoms.osgi.possiblebugs.scl.MyServlet in bundle 1
>(io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258) enabled, 1
>instance.
> Id: 1, State:ACTIVE
>io.jatoms.osgi.possiblebugs.scl.MySCL in bundle 1
>(io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258) enabled, 1
>instance.
> Id: 0, State:SATISFIED
>
>Info for MySCL:
>
>Class: io.jatoms.osgi.possiblebugs.scl.MySCL
>Bundle: 1
>(io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258)
>Enabled: true
>Immediate: false
>Services: [javax.servlet.ServletContextListener]
>Scope: singleton
>Config PID(s): [io.jatoms.osgi.possiblebugs.scl.MySCL], Policy:
>optional
>Base Props: (1 entry)
> osgi.http.whiteboard.listener<Boolean> = true
>
>Component Configuration Id: 0
>-----------------------------
>State: SATISFIED
>Service: 50 [javax.servlet.ServletContextListener]
>Config Props: (3 entries)
> component.id<Long> = 0
> component.name<String> = io.jatoms.osgi.possiblebugs.scl.MySCL
> osgi.http.whiteboard.listener<Boolean> = true
>References: (total 0)
>
>The MySCL class:
>
>@Component
>@HttpWhiteboardListener
>public class MySCL implements ServletContextListener {
>
> @Override
> public void contextDestroyed(ServletContextEvent arg0) {
> System.out.println("Bye World");
> }
>
> @Override
> public void contextInitialized(ServletContextEvent arg0) {
> System.out.println("Hello World");
> }
>}
>
> And Apache Felix Web Console still lists my ServletContextListener
>under "Failed Listeners" with reason "Invalid".
>
>Is there anybody who knows what this "invalid" means?
>
>Kind regards,
>Thomas
>
>
>------ Originalnachricht ------
>Von: "Thomas Driessen" <th...@gmail.com>
>An: "Raymond Auge" <ra...@liferay.com>; "felix users"
><us...@felix.apache.org>
>Cc: "David Bosschaert" <da...@gmail.com>
>Gesendet: 04.02.2019 18:38:29
>Betreff: Re[5]: ServletContextListener not working?
>
>>Hi Ray,
>>
>>yes the annotation is processed. At least Apache Felix Webconsole is
>>showing me this output for my SCL component:
>>
>>Bundle io.jatoms.osgi.possiblebugs.scl.impl (1)
>> Implementationsklasse io.jatoms.osgi.possiblebugs.scl.MySCL
>> Default Status enabled
>> Aktivierung delayed
>> Konfigurations Policy optional
>> Dienst Typ singleton
>> Dienste javax.servlet.ServletContextListener
>> PID io.jatoms.osgi.possiblebugs.scl.MySCL
>> Eigenschaften component.id = 9
>> component.name = io.jatoms.osgi.possiblebugs.scl.MySCL
>> osgi.http.whiteboard.listener = true
>>
>>Sorry, the names are in german. "Eigenschaften" is the properties
>>section ;)
>>
>>Kind regards,
>>Thomas
>>
>>------ Originalnachricht ------
>>Von: "Raymond Auge" <ra...@liferay.com>
>>An: "felix users" <us...@felix.apache.org>; "Thomas Driessen"
>><th...@gmail.com>
>>Cc: "David Bosschaert" <da...@gmail.com>
>>Gesendet: 04.02.2019 18:28:13
>>Betreff: Re: Re[3]: ServletContextListener not working?
>>
>>>Thomas did you check that your tool chain processed the annotation
>>>`@HttpWhiteboardListener` into the appropriate service property?
>>>
>>>- Ray
>>>
>>>On Mon, Feb 4, 2019 at 10:05 AM Thomas Driessen
>>><th...@gmail.com> wrote:
>>>>BTW the version of felix http is 4.0.6 and the other bundles
>>>>installed and active are:
>>>>
>>>> START LEVEL 1
>>>> ID|State |Level|Name
>>>> 0|Active | 0|OSGi System Bundle
>>>>(3.13.100.v20180827-1536)|3.13.100.v20180827-1536
>>>> 1|Active | 1|osgi.possiblebugs.scl.impl
>>>>(0.0.1.201902041434)|0.0.1.201902041434
>>>> 2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3
>>>> 3|Active | 1|Apache Commons IO (2.6.0)|2.6.0
>>>> 4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
>>>> 5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
>>>> 6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
>>>> 7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6
>>>> 8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2
>>>> 9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4
>>>> 10|Active | 1|Apache Felix Declarative Services
>>>>(2.1.10)|2.1.10
>>>> 11|Active | 1|Apache Felix Web Management Console
>>>>(4.3.4)|4.3.4
>>>> 12|Active | 1|Apache Felix Web Console Service Component
>>>>Runtime/Declarative Services Plugin (2.0.8)|2.0.8
>>>> 13|Active | 1|org.osgi:org.osgi.util.function
>>>>(1.1.0.201802012106)|1.1.0.201802012106
>>>>
>>>>Any idea what might be missing?
>>>>
>>>>Kind regards,
>>>>Thomas
>>>>
>>>>------ Originalnachricht ------
>>>>Von: "Thomas Driessen" <th...@gmail.com>
>>>>An: "David Bosschaert" <da...@gmail.com>;
>>>>users@felix.apache.org
>>>>Gesendet: 04.02.2019 16:03:25
>>>>Betreff: Re[2]: ServletContextListener not working?
>>>>
>>>>>Hi David,
>>>>>
>>>>>yes this is done via tha @HttpWhiteboardListener annotation. The
>>>>>webconsole shows me this output for the MySCL component:
>>>>>
>>>>>
>>>>>------ Originalnachricht ------
>>>>>Von: "David Bosschaert" <da...@gmail.com>
>>>>>An: users@felix.apache.org; "Thomas Driessen"
>>>>><th...@gmail.com>
>>>>>Gesendet: 04.02.2019 15:44:52
>>>>>Betreff: Re: ServletContextListener not working?
>>>>>
>>>>>>Hi Thomas,
>>>>>>
>>>>>>The spec states in section 140.7 [1]
>>>>>>"Events are sent to listeners registered in the Service Registry
>>>>>>with the osgi.http.whiteboard.listener service property set to
>>>>>>true"
>>>>>>
>>>>>>Did you set this service property?
>>>>>>There is a constant for it in
>>>>>>org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]
>>>>>>
>>>>>>Hope this helps,
>>>>>>
>>>>>>David
>>>>>>
>>>>>>[1]
>>>>>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
>>>>>>[2]
>>>>>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants
>>>>>>
>>>>>>On Mon, 4 Feb 2019 at 06:38, Thomas Driessen
>>>>>><th...@gmail.com> wrote:
>>>>>>>I've investigated this further and in the Apache Felix Web
>>>>>>>Console my
>>>>>>>listener is listed under the "Failed Listeners". As reason
>>>>>>>"Invalid" is
>>>>>>>shown.
>>>>>>>
>>>>>>>I do not know what I'm doing wrong :(
>>>>>>>
>>>>>>>This is my ServletContextListener:
>>>>>>>
>>>>>>> @Component
>>>>>>>@HttpWhiteboardListener
>>>>>>>public class MySCL implements ServletContextListener {
>>>>>>>
>>>>>>> @Override
>>>>>>> public void contextDestroyed(ServletContextEvent arg0) {
>>>>>>> System.out.println("Destroyed");
>>>>>>> }
>>>>>>>
>>>>>>> @Override
>>>>>>> public void contextInitialized(ServletContextEvent arg0) {
>>>>>>> System.out.println("Initialized");
>>>>>>> }
>>>>>>>
>>>>>>>}
>>>>>>>
>>>>>>>Any idea what I'm missing?
>>>>>>>
>>>>>>>Kind regards,
>>>>>>>thomas
>>>>>>>
>>>>>>>------ Originalnachricht ------
>>>>>>>Von: "Thomas Driessen" <th...@gmail.com>
>>>>>>>An: "users@felix.apache.org" <us...@felix.apache.org>
>>>>>>>Gesendet: 04.02.2019 09:48:35
>>>>>>>Betreff: ServletContextListener not working?
>>>>>>>
>>>>>>> >Hi,
>>>>>>> >
>>>>>>> >I've already asked on the general OSGi Dev mailing list, but I
>>>>>>>think
>>>>>>> >this might be a more appropriate place to ask:
>>>>>>> >
>>>>>>> >I just tried to get a ServletContextListener to work, but did
>>>>>>>not
>>>>>>> >succeed, although everything is done as defined by the spec.
>>>>>>> >
>>>>>>> >Here you can find a minimal example of my setup
>>>>>>> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
>>>>>>> >
>>>>>>> >The Servlet I'm registering is working fine, but the
>>>>>>> >ServletContextListener that I registered too is never called.
>>>>>>> >Even if I call getServletContext() from within the Servlet, my
>>>>>>>Listener
>>>>>>> >is never called.
>>>>>>> >
>>>>>>> >I would have expected the ServletContextListener to be called at
>>>>>>>least
>>>>>>> >once, after a DefaultServletContext has been created by the
>>>>>>> >ServletContainer, or am I wrong with this assumption?
>>>>>>> >
>>>>>>> >Kind regards,
>>>>>>> >Thomas
>>>
>>>
>>>--
>>>Raymond Augé <http://www.liferay.com/web/raymond.auge/profile>
>>>(@rotty3000)
>>>Senior Software Architect Liferay, Inc. <http://www.liferay.com>
>>>(@Liferay)
>>>Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
>>>(@OSGiAlliance)
Re[6]: ServletContextListener not working?
Posted by Thomas Driessen <th...@gmail.com>.
Today I tried to get my listener working with a specific context and
added a ServletContextHelper and added a corresponding
@HttpWhiteboardContextSelect annotation to my SCL. Did not work either.
I also tried to change the type to a ServletRequestListener instead of a
ServletContextListener. Still didn't work.
Is there anybody who can help me on this issue?
I'm pretty clueless right now :(
Again this is my setup, maybe someone spots an error in it:
Bundles in runtime:
START LEVEL 1
ID|State |Level|Name
0|Active | 0|OSGi System Bundle
(3.13.100.v20180827-1536)|3.13.100.v20180827-1536
1|Active | 1|osgi.possiblebugs.scl.impl
(0.0.1.201902051255)|0.0.1.201902051255
2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3
3|Active | 1|Apache Commons IO (2.6.0)|2.6.0
4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6Li
8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2
9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4
10|Active | 1|Apache Felix Declarative Services
(2.1.10)|2.1.10
11|Active | 1|Apache Felix Web Management Console
(4.3.4)|4.3.4
12|Active | 1|Apache Felix Web Console Service Component
Runtime/Declarative Services Plugin (2.0.8)|2.0.8
13|Active | 1|org.osgi:org.osgi.util.function
(1.1.0.201802012106)|1.1.0.201802012106
g!
List of components:
io.jatoms.osgi.possiblebugs.scl.MyServlet in bundle 1
(io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258) enabled, 1
instance.
Id: 1, State:ACTIVE
io.jatoms.osgi.possiblebugs.scl.MySCL in bundle 1
(io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258) enabled, 1
instance.
Id: 0, State:SATISFIED
Info for MySCL:
Class: io.jatoms.osgi.possiblebugs.scl.MySCL
Bundle: 1
(io.jatoms.osgi.possiblebugs.scl.impl:0.0.1.201902051258)
Enabled: true
Immediate: false
Services: [javax.servlet.ServletContextListener]
Scope: singleton
Config PID(s): [io.jatoms.osgi.possiblebugs.scl.MySCL], Policy: optional
Base Props: (1 entry)
osgi.http.whiteboard.listener<Boolean> = true
Component Configuration Id: 0
-----------------------------
State: SATISFIED
Service: 50 [javax.servlet.ServletContextListener]
Config Props: (3 entries)
component.id<Long> = 0
component.name<String> = io.jatoms.osgi.possiblebugs.scl.MySCL
osgi.http.whiteboard.listener<Boolean> = true
References: (total 0)
The MySCL class:
@Component
@HttpWhiteboardListener
public class MySCL implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("Bye World");
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
System.out.println("Hello World");
}
}
And Apache Felix Web Console still lists my ServletContextListener
under "Failed Listeners" with reason "Invalid".
Is there anybody who knows what this "invalid" means?
Kind regards,
Thomas
------ Originalnachricht ------
Von: "Thomas Driessen" <th...@gmail.com>
An: "Raymond Auge" <ra...@liferay.com>; "felix users"
<us...@felix.apache.org>
Cc: "David Bosschaert" <da...@gmail.com>
Gesendet: 04.02.2019 18:38:29
Betreff: Re[5]: ServletContextListener not working?
>Hi Ray,
>
>yes the annotation is processed. At least Apache Felix Webconsole is
>showing me this output for my SCL component:
>
>Bundle io.jatoms.osgi.possiblebugs.scl.impl (1)
> Implementationsklasse io.jatoms.osgi.possiblebugs.scl.MySCL
> Default Status enabled
> Aktivierung delayed
> Konfigurations Policy optional
> Dienst Typ singleton
> Dienste javax.servlet.ServletContextListener
> PID io.jatoms.osgi.possiblebugs.scl.MySCL
> Eigenschaften component.id = 9
> component.name = io.jatoms.osgi.possiblebugs.scl.MySCL
> osgi.http.whiteboard.listener = true
>
>Sorry, the names are in german. "Eigenschaften" is the properties
>section ;)
>
>Kind regards,
>Thomas
>
>------ Originalnachricht ------
>Von: "Raymond Auge" <ra...@liferay.com>
>An: "felix users" <us...@felix.apache.org>; "Thomas Driessen"
><th...@gmail.com>
>Cc: "David Bosschaert" <da...@gmail.com>
>Gesendet: 04.02.2019 18:28:13
>Betreff: Re: Re[3]: ServletContextListener not working?
>
>>Thomas did you check that your tool chain processed the annotation
>>`@HttpWhiteboardListener` into the appropriate service property?
>>
>>- Ray
>>
>>On Mon, Feb 4, 2019 at 10:05 AM Thomas Driessen
>><th...@gmail.com> wrote:
>>>BTW the version of felix http is 4.0.6 and the other bundles
>>>installed and active are:
>>>
>>> START LEVEL 1
>>> ID|State |Level|Name
>>> 0|Active | 0|OSGi System Bundle
>>>(3.13.100.v20180827-1536)|3.13.100.v20180827-1536
>>> 1|Active | 1|osgi.possiblebugs.scl.impl
>>>(0.0.1.201902041434)|0.0.1.201902041434
>>> 2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3
>>> 3|Active | 1|Apache Commons IO (2.6.0)|2.6.0
>>> 4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
>>> 5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
>>> 6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
>>> 7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6
>>> 8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2
>>> 9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4
>>> 10|Active | 1|Apache Felix Declarative Services
>>>(2.1.10)|2.1.10
>>> 11|Active | 1|Apache Felix Web Management Console
>>>(4.3.4)|4.3.4
>>> 12|Active | 1|Apache Felix Web Console Service Component
>>>Runtime/Declarative Services Plugin (2.0.8)|2.0.8
>>> 13|Active | 1|org.osgi:org.osgi.util.function
>>>(1.1.0.201802012106)|1.1.0.201802012106
>>>
>>>Any idea what might be missing?
>>>
>>>Kind regards,
>>>Thomas
>>>
>>>------ Originalnachricht ------
>>>Von: "Thomas Driessen" <th...@gmail.com>
>>>An: "David Bosschaert" <da...@gmail.com>;
>>>users@felix.apache.org
>>>Gesendet: 04.02.2019 16:03:25
>>>Betreff: Re[2]: ServletContextListener not working?
>>>
>>>>Hi David,
>>>>
>>>>yes this is done via tha @HttpWhiteboardListener annotation. The
>>>>webconsole shows me this output for the MySCL component:
>>>>
>>>>
>>>>------ Originalnachricht ------
>>>>Von: "David Bosschaert" <da...@gmail.com>
>>>>An: users@felix.apache.org; "Thomas Driessen"
>>>><th...@gmail.com>
>>>>Gesendet: 04.02.2019 15:44:52
>>>>Betreff: Re: ServletContextListener not working?
>>>>
>>>>>Hi Thomas,
>>>>>
>>>>>The spec states in section 140.7 [1]
>>>>>"Events are sent to listeners registered in the Service Registry
>>>>>with the osgi.http.whiteboard.listener service property set to
>>>>>true"
>>>>>
>>>>>Did you set this service property?
>>>>>There is a constant for it in
>>>>>org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]
>>>>>
>>>>>Hope this helps,
>>>>>
>>>>>David
>>>>>
>>>>>[1]
>>>>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
>>>>>[2]
>>>>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants
>>>>>
>>>>>On Mon, 4 Feb 2019 at 06:38, Thomas Driessen
>>>>><th...@gmail.com> wrote:
>>>>>>I've investigated this further and in the Apache Felix Web Console
>>>>>>my
>>>>>>listener is listed under the "Failed Listeners". As reason
>>>>>>"Invalid" is
>>>>>>shown.
>>>>>>
>>>>>>I do not know what I'm doing wrong :(
>>>>>>
>>>>>>This is my ServletContextListener:
>>>>>>
>>>>>> @Component
>>>>>>@HttpWhiteboardListener
>>>>>>public class MySCL implements ServletContextListener {
>>>>>>
>>>>>> @Override
>>>>>> public void contextDestroyed(ServletContextEvent arg0) {
>>>>>> System.out.println("Destroyed");
>>>>>> }
>>>>>>
>>>>>> @Override
>>>>>> public void contextInitialized(ServletContextEvent arg0) {
>>>>>> System.out.println("Initialized");
>>>>>> }
>>>>>>
>>>>>>}
>>>>>>
>>>>>>Any idea what I'm missing?
>>>>>>
>>>>>>Kind regards,
>>>>>>thomas
>>>>>>
>>>>>>------ Originalnachricht ------
>>>>>>Von: "Thomas Driessen" <th...@gmail.com>
>>>>>>An: "users@felix.apache.org" <us...@felix.apache.org>
>>>>>>Gesendet: 04.02.2019 09:48:35
>>>>>>Betreff: ServletContextListener not working?
>>>>>>
>>>>>> >Hi,
>>>>>> >
>>>>>> >I've already asked on the general OSGi Dev mailing list, but I
>>>>>>think
>>>>>> >this might be a more appropriate place to ask:
>>>>>> >
>>>>>> >I just tried to get a ServletContextListener to work, but did not
>>>>>> >succeed, although everything is done as defined by the spec.
>>>>>> >
>>>>>> >Here you can find a minimal example of my setup
>>>>>> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
>>>>>> >
>>>>>> >The Servlet I'm registering is working fine, but the
>>>>>> >ServletContextListener that I registered too is never called.
>>>>>> >Even if I call getServletContext() from within the Servlet, my
>>>>>>Listener
>>>>>> >is never called.
>>>>>> >
>>>>>> >I would have expected the ServletContextListener to be called at
>>>>>>least
>>>>>> >once, after a DefaultServletContext has been created by the
>>>>>> >ServletContainer, or am I wrong with this assumption?
>>>>>> >
>>>>>> >Kind regards,
>>>>>> >Thomas
>>
>>
>>--
>>Raymond Augé <http://www.liferay.com/web/raymond.auge/profile>
>>(@rotty3000)
>>Senior Software Architect Liferay, Inc. <http://www.liferay.com>
>>(@Liferay)
>>Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
>>(@OSGiAlliance)
Re[5]: ServletContextListener not working?
Posted by Thomas Driessen <th...@gmail.com>.
Hi Ray,
yes the annotation is processed. At least Apache Felix Webconsole is
showing me this output for my SCL component:
Bundle io.jatoms.osgi.possiblebugs.scl.impl (1)
Implementationsklasse io.jatoms.osgi.possiblebugs.scl.MySCL
Default Status enabled
Aktivierung delayed
Konfigurations Policy optional
Dienst Typ singleton
Dienste javax.servlet.ServletContextListener
PID io.jatoms.osgi.possiblebugs.scl.MySCL
Eigenschaften component.id = 9
component.name = io.jatoms.osgi.possiblebugs.scl.MySCL
osgi.http.whiteboard.listener = true
Sorry, the names are in german. "Eigenschaften" is the properties
section ;)
Kind regards,
Thomas
------ Originalnachricht ------
Von: "Raymond Auge" <ra...@liferay.com>
An: "felix users" <us...@felix.apache.org>; "Thomas Driessen"
<th...@gmail.com>
Cc: "David Bosschaert" <da...@gmail.com>
Gesendet: 04.02.2019 18:28:13
Betreff: Re: Re[3]: ServletContextListener not working?
>Thomas did you check that your tool chain processed the annotation
>`@HttpWhiteboardListener` into the appropriate service property?
>
>- Ray
>
>On Mon, Feb 4, 2019 at 10:05 AM Thomas Driessen
><th...@gmail.com> wrote:
>>BTW the version of felix http is 4.0.6 and the other bundles installed
>>and active are:
>>
>> START LEVEL 1
>> ID|State |Level|Name
>> 0|Active | 0|OSGi System Bundle
>>(3.13.100.v20180827-1536)|3.13.100.v20180827-1536
>> 1|Active | 1|osgi.possiblebugs.scl.impl
>>(0.0.1.201902041434)|0.0.1.201902041434
>> 2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3
>> 3|Active | 1|Apache Commons IO (2.6.0)|2.6.0
>> 4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
>> 5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
>> 6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
>> 7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6
>> 8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2
>> 9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4
>> 10|Active | 1|Apache Felix Declarative Services
>>(2.1.10)|2.1.10
>> 11|Active | 1|Apache Felix Web Management Console
>>(4.3.4)|4.3.4
>> 12|Active | 1|Apache Felix Web Console Service Component
>>Runtime/Declarative Services Plugin (2.0.8)|2.0.8
>> 13|Active | 1|org.osgi:org.osgi.util.function
>>(1.1.0.201802012106)|1.1.0.201802012106
>>
>>Any idea what might be missing?
>>
>>Kind regards,
>>Thomas
>>
>>------ Originalnachricht ------
>>Von: "Thomas Driessen" <th...@gmail.com>
>>An: "David Bosschaert" <da...@gmail.com>;
>>users@felix.apache.org
>>Gesendet: 04.02.2019 16:03:25
>>Betreff: Re[2]: ServletContextListener not working?
>>
>>>Hi David,
>>>
>>>yes this is done via tha @HttpWhiteboardListener annotation. The
>>>webconsole shows me this output for the MySCL component:
>>>
>>>
>>>------ Originalnachricht ------
>>>Von: "David Bosschaert" <da...@gmail.com>
>>>An: users@felix.apache.org; "Thomas Driessen"
>>><th...@gmail.com>
>>>Gesendet: 04.02.2019 15:44:52
>>>Betreff: Re: ServletContextListener not working?
>>>
>>>>Hi Thomas,
>>>>
>>>>The spec states in section 140.7 [1]
>>>>"Events are sent to listeners registered in the Service Registry
>>>>with the osgi.http.whiteboard.listener service property set to true"
>>>>
>>>>Did you set this service property?
>>>>There is a constant for it in
>>>>org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]
>>>>
>>>>Hope this helps,
>>>>
>>>>David
>>>>
>>>>[1]
>>>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
>>>>[2]
>>>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants
>>>>
>>>>On Mon, 4 Feb 2019 at 06:38, Thomas Driessen
>>>><th...@gmail.com> wrote:
>>>>>I've investigated this further and in the Apache Felix Web Console
>>>>>my
>>>>>listener is listed under the "Failed Listeners". As reason
>>>>>"Invalid" is
>>>>>shown.
>>>>>
>>>>>I do not know what I'm doing wrong :(
>>>>>
>>>>>This is my ServletContextListener:
>>>>>
>>>>> @Component
>>>>>@HttpWhiteboardListener
>>>>>public class MySCL implements ServletContextListener {
>>>>>
>>>>> @Override
>>>>> public void contextDestroyed(ServletContextEvent arg0) {
>>>>> System.out.println("Destroyed");
>>>>> }
>>>>>
>>>>> @Override
>>>>> public void contextInitialized(ServletContextEvent arg0) {
>>>>> System.out.println("Initialized");
>>>>> }
>>>>>
>>>>>}
>>>>>
>>>>>Any idea what I'm missing?
>>>>>
>>>>>Kind regards,
>>>>>thomas
>>>>>
>>>>>------ Originalnachricht ------
>>>>>Von: "Thomas Driessen" <th...@gmail.com>
>>>>>An: "users@felix.apache.org" <us...@felix.apache.org>
>>>>>Gesendet: 04.02.2019 09:48:35
>>>>>Betreff: ServletContextListener not working?
>>>>>
>>>>> >Hi,
>>>>> >
>>>>> >I've already asked on the general OSGi Dev mailing list, but I
>>>>>think
>>>>> >this might be a more appropriate place to ask:
>>>>> >
>>>>> >I just tried to get a ServletContextListener to work, but did not
>>>>> >succeed, although everything is done as defined by the spec.
>>>>> >
>>>>> >Here you can find a minimal example of my setup
>>>>> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
>>>>> >
>>>>> >The Servlet I'm registering is working fine, but the
>>>>> >ServletContextListener that I registered too is never called.
>>>>> >Even if I call getServletContext() from within the Servlet, my
>>>>>Listener
>>>>> >is never called.
>>>>> >
>>>>> >I would have expected the ServletContextListener to be called at
>>>>>least
>>>>> >once, after a DefaultServletContext has been created by the
>>>>> >ServletContainer, or am I wrong with this assumption?
>>>>> >
>>>>> >Kind regards,
>>>>> >Thomas
>
>
>--
>Raymond Augé <http://www.liferay.com/web/raymond.auge/profile>
>(@rotty3000)
>Senior Software Architect Liferay, Inc. <http://www.liferay.com>
>(@Liferay)
>Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
>(@OSGiAlliance)
Re: Re[3]: ServletContextListener not working?
Posted by Raymond Auge <ra...@liferay.com>.
Thomas did you check that your tool chain processed the annotation
`@HttpWhiteboardListener` into the appropriate service property?
- Ray
On Mon, Feb 4, 2019 at 10:05 AM Thomas Driessen <
thomas.driessen.td@gmail.com> wrote:
> BTW the version of felix http is 4.0.6 and the other bundles installed and
> active are:
>
> START LEVEL 1
> ID|State |Level|Name
> 0|Active | 0|OSGi System Bundle
> (3.13.100.v20180827-1536)|3.13.100.v20180827-1536
> 1|Active | 1|osgi.possiblebugs.scl.impl
> (0.0.1.201902041434)|0.0.1.201902041434
> 2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3
> 3|Active | 1|Apache Commons IO (2.6.0)|2.6.0
> 4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
> 5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
> 6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
> 7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6
> 8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2
> 9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4
> 10|Active | 1|Apache Felix Declarative Services (2.1.10)|2.1.10
> 11|Active | 1|Apache Felix Web Management Console (4.3.4)|4.3.4
> 12|Active | 1|Apache Felix Web Console Service Component
> Runtime/Declarative Services Plugin (2.0.8)|2.0.8
> 13|Active | 1|org.osgi:org.osgi.util.function
> (1.1.0.201802012106)|1.1.0.201802012106
>
> Any idea what might be missing?
>
> Kind regards,
> Thomas
>
> ------ Originalnachricht ------
> Von: "Thomas Driessen" <th...@gmail.com>
> An: "David Bosschaert" <da...@gmail.com>;
> users@felix.apache.org
> Gesendet: 04.02.2019 16:03:25
> Betreff: Re[2]: ServletContextListener not working?
>
> Hi David,
>
> yes this is done via tha @HttpWhiteboardListener annotation. The
> webconsole shows me this output for the MySCL component:
>
>
> ------ Originalnachricht ------
> Von: "David Bosschaert" <da...@gmail.com>
> An: users@felix.apache.org; "Thomas Driessen" <
> thomas.driessen.td@gmail.com>
> Gesendet: 04.02.2019 15:44:52
> Betreff: Re: ServletContextListener not working?
>
> Hi Thomas,
>
> The spec states in section 140.7 [1]
> "Events are sent to listeners registered in the Service Registry with the
> osgi.http.whiteboard.listener service property set to true"
>
> Did you set this service property?
> There is a constant for it in
> org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]
>
> Hope this helps,
>
> David
>
> [1]
> https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
> [2]
> https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants
>
> On Mon, 4 Feb 2019 at 06:38, Thomas Driessen <th...@gmail.com>
> wrote:
>
>> I've investigated this further and in the Apache Felix Web Console my
>> listener is listed under the "Failed Listeners". As reason "Invalid" is
>> shown.
>>
>> I do not know what I'm doing wrong :(
>>
>> This is my ServletContextListener:
>>
>> @Component
>> @HttpWhiteboardListener
>> public class MySCL implements ServletContextListener {
>>
>> @Override
>> public void contextDestroyed(ServletContextEvent arg0) {
>> System.out.println("Destroyed");
>> }
>>
>> @Override
>> public void contextInitialized(ServletContextEvent arg0) {
>> System.out.println("Initialized");
>> }
>>
>> }
>>
>> Any idea what I'm missing?
>>
>> Kind regards,
>> thomas
>>
>> ------ Originalnachricht ------
>> Von: "Thomas Driessen" <th...@gmail.com>
>> An: "users@felix.apache.org" <us...@felix.apache.org>
>> Gesendet: 04.02.2019 09:48:35
>> Betreff: ServletContextListener not working?
>>
>> >Hi,
>> >
>> >I've already asked on the general OSGi Dev mailing list, but I think
>> >this might be a more appropriate place to ask:
>> >
>> >I just tried to get a ServletContextListener to work, but did not
>> >succeed, although everything is done as defined by the spec.
>> >
>> >Here you can find a minimal example of my setup
>> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
>> >
>> >The Servlet I'm registering is working fine, but the
>> >ServletContextListener that I registered too is never called.
>> >Even if I call getServletContext() from within the Servlet, my Listener
>> >is never called.
>> >
>> >I would have expected the ServletContextListener to be called at least
>> >once, after a DefaultServletContext has been created by the
>> >ServletContainer, or am I wrong with this assumption?
>> >
>> >Kind regards,
>> >Thomas
>
>
--
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
(@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
(@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)
Re[3]: ServletContextListener not working?
Posted by Thomas Driessen <th...@gmail.com>.
BTW the version of felix http is 4.0.6 and the other bundles installed
and active are:
START LEVEL 1
ID|State |Level|Name
0|Active | 0|OSGi System Bundle
(3.13.100.v20180827-1536)|3.13.100.v20180827-1536
1|Active | 1|osgi.possiblebugs.scl.impl
(0.0.1.201902041434)|0.0.1.201902041434
2|Active | 1|Apache Commons FileUpload (1.3.3)|1.3.3
3|Active | 1|Apache Commons IO (2.6.0)|2.6.0
4|Active | 1|Apache Felix Gogo Command (1.0.2)|1.0.2
5|Active | 1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
6|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
7|Active | 1|Apache Felix Http Jetty (4.0.6)|4.0.6
8|Active | 1|Apache Felix Servlet API (1.1.2)|1.1.2
9|Active | 1|Apache Felix Inventory (1.0.4)|1.0.4
10|Active | 1|Apache Felix Declarative Services
(2.1.10)|2.1.10
11|Active | 1|Apache Felix Web Management Console
(4.3.4)|4.3.4
12|Active | 1|Apache Felix Web Console Service Component
Runtime/Declarative Services Plugin (2.0.8)|2.0.8
13|Active | 1|org.osgi:org.osgi.util.function
(1.1.0.201802012106)|1.1.0.201802012106
Any idea what might be missing?
Kind regards,
Thomas
------ Originalnachricht ------
Von: "Thomas Driessen" <th...@gmail.com>
An: "David Bosschaert" <da...@gmail.com>;
users@felix.apache.org
Gesendet: 04.02.2019 16:03:25
Betreff: Re[2]: ServletContextListener not working?
>Hi David,
>
>yes this is done via tha @HttpWhiteboardListener annotation. The
>webconsole shows me this output for the MySCL component:
>
>
>------ Originalnachricht ------
>Von: "David Bosschaert" <da...@gmail.com>
>An: users@felix.apache.org; "Thomas Driessen"
><th...@gmail.com>
>Gesendet: 04.02.2019 15:44:52
>Betreff: Re: ServletContextListener not working?
>
>>Hi Thomas,
>>
>>The spec states in section 140.7 [1]
>>"Events are sent to listeners registered in the Service Registry with
>>the osgi.http.whiteboard.listener service property set to true"
>>
>>Did you set this service property?
>>There is a constant for it in
>>org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]
>>
>>Hope this helps,
>>
>>David
>>
>>[1]
>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
>>[2]
>>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants
>>
>>On Mon, 4 Feb 2019 at 06:38, Thomas Driessen
>><th...@gmail.com> wrote:
>>>I've investigated this further and in the Apache Felix Web Console my
>>>listener is listed under the "Failed Listeners". As reason "Invalid"
>>>is
>>>shown.
>>>
>>>I do not know what I'm doing wrong :(
>>>
>>>This is my ServletContextListener:
>>>
>>> @Component
>>>@HttpWhiteboardListener
>>>public class MySCL implements ServletContextListener {
>>>
>>> @Override
>>> public void contextDestroyed(ServletContextEvent arg0) {
>>> System.out.println("Destroyed");
>>> }
>>>
>>> @Override
>>> public void contextInitialized(ServletContextEvent arg0) {
>>> System.out.println("Initialized");
>>> }
>>>
>>>}
>>>
>>>Any idea what I'm missing?
>>>
>>>Kind regards,
>>>thomas
>>>
>>>------ Originalnachricht ------
>>>Von: "Thomas Driessen" <th...@gmail.com>
>>>An: "users@felix.apache.org" <us...@felix.apache.org>
>>>Gesendet: 04.02.2019 09:48:35
>>>Betreff: ServletContextListener not working?
>>>
>>> >Hi,
>>> >
>>> >I've already asked on the general OSGi Dev mailing list, but I think
>>> >this might be a more appropriate place to ask:
>>> >
>>> >I just tried to get a ServletContextListener to work, but did not
>>> >succeed, although everything is done as defined by the spec.
>>> >
>>> >Here you can find a minimal example of my setup
>>> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
>>> >
>>> >The Servlet I'm registering is working fine, but the
>>> >ServletContextListener that I registered too is never called.
>>> >Even if I call getServletContext() from within the Servlet, my
>>>Listener
>>> >is never called.
>>> >
>>> >I would have expected the ServletContextListener to be called at
>>>least
>>> >once, after a DefaultServletContext has been created by the
>>> >ServletContainer, or am I wrong with this assumption?
>>> >
>>> >Kind regards,
>>> >Thomas
Re[2]: ServletContextListener not working?
Posted by Thomas Driessen <th...@gmail.com>.
Hi David,
yes this is done via tha @HttpWhiteboardListener annotation. The
webconsole shows me this output for the MySCL component:
------ Originalnachricht ------
Von: "David Bosschaert" <da...@gmail.com>
An: users@felix.apache.org; "Thomas Driessen"
<th...@gmail.com>
Gesendet: 04.02.2019 15:44:52
Betreff: Re: ServletContextListener not working?
>Hi Thomas,
>
>The spec states in section 140.7 [1]
>"Events are sent to listeners registered in the Service Registry with
>the osgi.http.whiteboard.listener service property set to true"
>
>Did you set this service property?
>There is a constant for it in
>org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]
>
>Hope this helps,
>
>David
>
>[1]
>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
>[2]
>https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants
>
>On Mon, 4 Feb 2019 at 06:38, Thomas Driessen
><th...@gmail.com> wrote:
>>I've investigated this further and in the Apache Felix Web Console my
>>listener is listed under the "Failed Listeners". As reason "Invalid"
>>is
>>shown.
>>
>>I do not know what I'm doing wrong :(
>>
>>This is my ServletContextListener:
>>
>> @Component
>>@HttpWhiteboardListener
>>public class MySCL implements ServletContextListener {
>>
>> @Override
>> public void contextDestroyed(ServletContextEvent arg0) {
>> System.out.println("Destroyed");
>> }
>>
>> @Override
>> public void contextInitialized(ServletContextEvent arg0) {
>> System.out.println("Initialized");
>> }
>>
>>}
>>
>>Any idea what I'm missing?
>>
>>Kind regards,
>>thomas
>>
>>------ Originalnachricht ------
>>Von: "Thomas Driessen" <th...@gmail.com>
>>An: "users@felix.apache.org" <us...@felix.apache.org>
>>Gesendet: 04.02.2019 09:48:35
>>Betreff: ServletContextListener not working?
>>
>> >Hi,
>> >
>> >I've already asked on the general OSGi Dev mailing list, but I think
>> >this might be a more appropriate place to ask:
>> >
>> >I just tried to get a ServletContextListener to work, but did not
>> >succeed, although everything is done as defined by the spec.
>> >
>> >Here you can find a minimal example of my setup
>> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
>> >
>> >The Servlet I'm registering is working fine, but the
>> >ServletContextListener that I registered too is never called.
>> >Even if I call getServletContext() from within the Servlet, my
>>Listener
>> >is never called.
>> >
>> >I would have expected the ServletContextListener to be called at
>>least
>> >once, after a DefaultServletContext has been created by the
>> >ServletContainer, or am I wrong with this assumption?
>> >
>> >Kind regards,
>> >Thomas
Re: ServletContextListener not working?
Posted by David Bosschaert <da...@gmail.com>.
Hi Thomas,
The spec states in section 140.7 [1]
"Events are sent to listeners registered in the Service Registry with the
osgi.http.whiteboard.listener service property set to true"
Did you set this service property?
There is a constant for it in
org.osgi.service.http.whiteboard.HttpWhiteboardConstants [2]
Hope this helps,
David
[1]
https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#d0e75952
[2]
https://osgi.org/specification/osgi.enterprise/7.0.0/service.http.whiteboard.html#org.osgi.service.http.whiteboard.HttpWhiteboardConstants
On Mon, 4 Feb 2019 at 06:38, Thomas Driessen <th...@gmail.com>
wrote:
> I've investigated this further and in the Apache Felix Web Console my
> listener is listed under the "Failed Listeners". As reason "Invalid" is
> shown.
>
> I do not know what I'm doing wrong :(
>
> This is my ServletContextListener:
>
> @Component
> @HttpWhiteboardListener
> public class MySCL implements ServletContextListener {
>
> @Override
> public void contextDestroyed(ServletContextEvent arg0) {
> System.out.println("Destroyed");
> }
>
> @Override
> public void contextInitialized(ServletContextEvent arg0) {
> System.out.println("Initialized");
> }
>
> }
>
> Any idea what I'm missing?
>
> Kind regards,
> thomas
>
> ------ Originalnachricht ------
> Von: "Thomas Driessen" <th...@gmail.com>
> An: "users@felix.apache.org" <us...@felix.apache.org>
> Gesendet: 04.02.2019 09:48:35
> Betreff: ServletContextListener not working?
>
> >Hi,
> >
> >I've already asked on the general OSGi Dev mailing list, but I think
> >this might be a more appropriate place to ask:
> >
> >I just tried to get a ServletContextListener to work, but did not
> >succeed, although everything is done as defined by the spec.
> >
> >Here you can find a minimal example of my setup
> >https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
> >
> >The Servlet I'm registering is working fine, but the
> >ServletContextListener that I registered too is never called.
> >Even if I call getServletContext() from within the Servlet, my Listener
> >is never called.
> >
> >I would have expected the ServletContextListener to be called at least
> >once, after a DefaultServletContext has been created by the
> >ServletContainer, or am I wrong with this assumption?
> >
> >Kind regards,
> >Thomas
Re: ServletContextListener not working?
Posted by Thomas Driessen <th...@gmail.com>.
I've investigated this further and in the Apache Felix Web Console my
listener is listed under the "Failed Listeners". As reason "Invalid" is
shown.
I do not know what I'm doing wrong :(
This is my ServletContextListener:
@Component
@HttpWhiteboardListener
public class MySCL implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("Destroyed");
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
System.out.println("Initialized");
}
}
Any idea what I'm missing?
Kind regards,
thomas
------ Originalnachricht ------
Von: "Thomas Driessen" <th...@gmail.com>
An: "users@felix.apache.org" <us...@felix.apache.org>
Gesendet: 04.02.2019 09:48:35
Betreff: ServletContextListener not working?
>Hi,
>
>I've already asked on the general OSGi Dev mailing list, but I think
>this might be a more appropriate place to ask:
>
>I just tried to get a ServletContextListener to work, but did not
>succeed, although everything is done as defined by the spec.
>
>Here you can find a minimal example of my setup
>https://github.com/Sandared/io.jatoms.osgi.possiblebugs.scl
>
>The Servlet I'm registering is working fine, but the
>ServletContextListener that I registered too is never called.
>Even if I call getServletContext() from within the Servlet, my Listener
>is never called.
>
>I would have expected the ServletContextListener to be called at least
>once, after a DefaultServletContext has been created by the
>ServletContainer, or am I wrong with this assumption?
>
>Kind regards,
>Thomas