felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre De Rop <pierre.de...@gmail.com>
Subject Re: ServletContextListener
Date Tue, 12 May 2015 15:30:45 GMT
Thomas,

I suggest to not include the api bundles in the runtime (osgi.enterprise,
and osgi.residential), which should only be used at build time, not at
runtime.

so, can you please remove them and also add event admin, metatype, and log
service, like this:

    1|Active     |    1|Apache Felix Bundle Repository (2.0.4)
    2|Active     |    1|Apache Felix Configuration Admin Service (1.8.4)
    3|Active     |    1|Apache Felix Gogo Command (0.14.0)
    4|Active     |    1|Apache Felix Gogo Runtime (0.16.2)
    5|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    6|Active     |    1|Apache Felix Http Api (3.0.0.SNAPSHOT)
    7|Active     |    1|Apache Felix Http Jetty (3.0.3.SNAPSHOT)
    8|Active     |    1|Apache Felix Servlet API (1.1.1.SNAPSHOT)
    9|Active     |    1|Apache Felix Metatype Service (1.0.12)
   10|Active     |    1|Apache Felix EventAdmin (1.4.2)
   11|Active     |    1|Apache Felix Log Service (1.0.1)

(by the way, the  integration tests are failing when building jetty, and I
had to use -Dmaven.test.skip=true in order to build Http Jetty).


cheers;
/Pierre


On Tue, May 12, 2015 at 4:56 PM, Thomas Driessen <thomas.driessen@ds-lab.org
> wrote:

> Hey,
>
> First: Thanks for all your advices.
>
> I tried the Property as Pierre mentioned, but still my setup is not
> recognizing my SCL.
> I'll copy my console printout so maybe you can spot something wrong with my
> setup:
>
>
> 2015-05-12 16:32:38.153:INFO::main: Logging initialized @998ms
> 2015-05-12 16:32:38.193:INFO:oejs.Server:main: jetty-9.2.9.v20150224
> ____________________________
> Welcome to Apache Felix Gogo
>
> g! 2015-05-12 16:32:38.254:INFO:oejsh.ContextHandler:main: Started
> o.e.j.s.ServletContextHandler@7c417213{/,null,AVAILABLE}
> 2015-05-12 16:32:38.254:INFO:oejs.Server:main: Started @1092ms
> 2015-05-12 16:32:38.325:INFO:oejs.ServerConnector:main: Started
> ServerConnector@7b355613{HTTP/1.1}{0.0.0.0:8080}
> [INFO] Started Jetty 9.2.9.v20150224 at port(s) HTTP:8080 on context path /
> Hello
> lb
> START LEVEL 1
>    ID|State      |Level|Name
>     0|Active     |    0|System Bundle (5.1.0.SNAPSHOT)
>     1|Active     |    1|Apache Felix Configuration Admin Service (1.8.0)
>     2|Active     |    1|Apache Felix Dependency Manager (4.0.1)
>     3|Active     |    1|Apache Felix Dependency Manager Runtime (4.0.1)
>     4|Active     |    1|Apache Felix Dependency Manager Shell (4.0.1)
>     5|Active     |    1|Apache Felix Gogo Command (0.14.0)
>     6|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
>     7|Active     |    1|Apache Felix Gogo Shell (0.10.0)
>     8|Active     |    1|Apache Felix Http Api (3.0.0.SNAPSHOT)
>     9|Active     |    1|Apache Felix Http Jetty (3.0.3.SNAPSHOT)
>    10|Active     |    1|Apache Felix Servlet API (1.1.0)
>    11|Active     |    1|osgi.enterprise (4.2.0.201003190513)
>    12|Active     |    1|osgi.residential (4.3.0.201111022239)
>    13|Active     |    1|testit.test (0.0.0.201505121432)
> g! dm
> [3] org.apache.felix.dependencymanager.runtime
>  [0] org.apache.felix.dm.runtime.DependencyManagerRuntime registered
>     active (DependencyManager-Component=*) bundle optional available
>     org.osgi.service.packageadmin.PackageAdmin service required available
>     org.osgi.service.log.LogService service optional unavailable
> [13] testit.test
>  [1]
> javax.servlet.ServletContextListener(osgi.http.whiteboard.listener=true)
> registered
>
> Bundle [13] is merely my SCL:
>
> @Component(properties =
> @Property(name="osgi.http.whiteboard.listener",value="true"))
> public class MyContextListener implements ServletContextListener {
>
> @Override
> public void contextDestroyed(ServletContextEvent arg0) {
> // TODO Auto-generated method stub
> System.out.println("MyContextListener.contextDestroyed()");
> }
>
> @Override
> public void contextInitialized(ServletContextEvent arg0) {
> // TODO Auto-generated method stub
> System.out.println("MyContextListener.contextInitialized()");
> }
>  @Start
> public void start(){
> System.out.println("Hello");
> }
> }
>
>
> I tried the same Setup with http.whiteboard and http.basic explicitly added
> to my runrequirements, but neihter of those worked.
>
>
> Two small notes:
> 1) the mentioned property "osgi.http.whiteboard.listener" is never
> mentioned in RFC-189 -> should it be mentioned?
> 2) Two dependency chains of http.jetty.3.0.3.SNAPSHOT leads to two jetty
> bundles being automatically resolved by bndtools.
>
> The 1st chain is: jetty.3.0.3 -> org.osgi.metatype.1.1.0 ->
> osgi.enterprise.4.2.0 ->  felix.http.jetty.2.2.2
> The 2nd chain is: jetty.3.0.3 -> org.osgi.useradmin.1.1.0 ->
> osgi.enterprise.4.2.0 ->  felix.http.jetty.2.2.2
>
> Is this an intended behaviour?
>
> Best regards ant thanks for your patience,
> Thomas
>
> 2015-05-12 15:43 GMT+02:00 Pierre De Rop <pierre.derop@gmail.com>:
>
> > Hello Thomas,
> >
> > if you are using DM annotations, you can try to add the service property
> > mentioned by Raymond using the following:
> >
> > @Component(properties = @Property(name = "osgi.http.whiteboard.listener",
> > value = "true"))
> > public class MyContextListener implements ServletContextListener {
> > ...
> > }
> >
> > And if your component also depends on other services, you might also need
> > to check proper activation of your component using the "dm" shell
> > command,like "dm b <bundle id>".
> >
> > hope this helps;
> > /Pierre
> >
> > On Tue, May 12, 2015 at 3:09 PM, Raymond Auge <raymond.auge@liferay.com>
> > wrote:
> >
> > > You are missing the required service property
> > > "osgi.http.whiteboard.listener=true" on your SCL.
> > >
> > > Sincerely,
> > > - Ray
> > >
> > > On Tue, May 12, 2015 at 6:51 AM, Thomas Driessen <
> > > thomas.driessen@ds-lab.org
> > > > wrote:
> > >
> > > > Hi Carsten,
> > > >
> > > > forget my last question, I still used felix 4.4.1 as my OSGI
> > Framework. I
> > > > switched this to 5.1.0.SNAPSHOT and everything got resolved as
> > expected.
> > > >
> > > > But still my ServletContextListener seems not to be invoked, as i get
> > no
> > > > outputs on contextInitialized.
> > > >
> > > > This is my ServletContextListener:
> > > >
> > > > @Component(provides=ServletContextListener.class)
> > > > public class MyContextListener implements ServletContextListener {
> > > >
> > > > @Override
> > > > public void contextDestroyed(ServletContextEvent arg0) {
> > > > // TODO Auto-generated method stub
> > > > System.out.println("MyContextListener.contextDestroyed()");
> > > > }
> > > >
> > > > @Override
> > > > public void contextInitialized(ServletContextEvent arg0) {
> > > > // TODO Auto-generated method stub
> > > > System.out.println("MyContextListener.contextInitialized()");
> > > > }
> > > > }
> > > >
> > > > Might it be that the DM-Annotations are not working? Or do I have to
> > add
> > > > some attributes?
> > > > Sorry for all those questions but right now I'm pretty confused :(
> > > >
> > > > Thanks for all your advice :)
> > > >
> > > > Thomas
> > > >
> > > > 2015-05-12 12:08 GMT+02:00 Thomas Driessen <
> thomas.driessen@ds-lab.org
> > >:
> > > >
> > > > > Hi Carsten,
> > > > >
> > > > > I added http.jetty (3.0.3.SNAPSHOT) and http.api (3.0.0.SNAPSHOT)
> to
> > my
> > > > > runrequirements but now it says it is missing the package
> > org.osgi.dto
> > > ?
> > > > > I tried to add org.osgi.core (6.0.0) but that didn't help.
> > > > >
> > > > > Do I have to add some other bundles on which http.jetty and
> http.api
> > > are
> > > > > relying?
> > > > >
> > > > > Thomas
> > > > >
> > > > > 2015-05-11 19:20 GMT+02:00 Carsten Ziegeler <cziegeler@apache.org
> >:
> > > > >
> > > > >> Am 11.05.15 um 18:51 schrieb Scott Lewis:
> > > > >> > On 5/11/2015 9:45 AM, Carsten Ziegeler wrote:
> > > > >> >> <stuff deleted>
> > > > >> >> Is there a release scheduled that will include all the
http
> > service
> > > > >> >> changes for R6 final?
> > > > >> >>
> > > > >> >> Yes, once there is an official final R6 version, we
can do a
> > > release.
> > > > >> >
> > > > >> > Any schedule around such a release?   I know that the R6
spec is
> > not
> > > > >> > done/approved/frozen, etc., but I'm just asking what plans
> exist.
> > > > >> >
> > > > >> I assume somewhere in Q3
> > > > >>
> > > > >> Carsten
> > > > >>
> > > > >>
> > > > >> --
> > > > >> Carsten Ziegeler
> > > > >> Adobe Research Switzerland
> > > > >> cziegeler@apache.org
> > > > >>
> > > > >>
> > ---------------------------------------------------------------------
> > > > >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > > >> For additional commands, e-mail: users-help@felix.apache.org
> > > > >>
> > > > >>
> > > > >
> > > > >
> > > > > --
> > > > > M.Sc. Thomas Driessen
> > > > > Software Methodologies for Distributed Systems
> > > > > Institute of Computer Science
> > > > > University of Augsburg
> > > > > Universitätsstr. 6a
> > > > > 86135 Augsburg, Germany
> > > > >
> > > > > Tel:    +49 821 598-2486
> > > > > email: thomas.driessen@informatik.uni-augsburg.de
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > M.Sc. Thomas Driessen
> > > > Software Methodologies for Distributed Systems
> > > > Institute of Computer Science
> > > > University of Augsburg
> > > > Universitätsstr. 6a
> > > > 86135 Augsburg, Germany
> > > >
> > > > Tel:    +49 821 598-2486
> > > > email: thomas.driessen@informatik.uni-augsburg.de
> > > >
> > >
> > >
> > >
> > > --
> > > *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)
> > >
> >
>
>
>
> --
> M.Sc. Thomas Driessen
> Software Methodologies for Distributed Systems
> Institute of Computer Science
> University of Augsburg
> Universitätsstr. 6a
> 86135 Augsburg, Germany
>
> Tel:    +49 821 598-2486
> email: thomas.driessen@informatik.uni-augsburg.de
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message