Hi,

i want to write a HelloWorld-Servlet using Felixes HttpServie.
The setup is to embedd Felix and the HelloWorldServlet in a war-file and deploy 
this on Tomcat6.

The BundleActivator for the HelloWorldServletBundle checks whether a HttpServie 
is available a prints out an error message if that's not the case:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    @Override
    public void start(BundleContext context) throws Exception
    {
        ServiceReference sRef = 
context.getServiceReference(HttpService.class.getName());
        if (sRef != null)
        {
            HttpService service = (HttpService) context.getService(sRef);
            service.registerServlet(ALIAS, new HelloWorldServlet(), null, null);
        }else{
            System.out.println("no HttpService found to register Servlet for 
"+ALIAS);
        }
    }
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

and sadly this is exectly what happens when deploying the war-file on Tomcat6:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Connected to server
[2013-03-14 12:34:42,775] Artifact felix-bridge:war exploded: Artifact is being 
deployed, please wait...
starting OSGi
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.http.bridge-2.2.0.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.gogo.runtime_0.10.0.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.webconsole-3.1.8.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.http.base-2.2.0.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.bundlerepository-1.6.6.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.gogo.shell_0.10.0.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.http.api-2.2.0.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/systemBundles/org.apache.felix.gogo.command_0.12.0.jar]
Installing bundle 
[jndi:/localhost/WEB-INF/applicationBundles/HelloWorldServletEmbedded-1.0-SNAPSHOT.jar]
Starting bundle [org.apache.felix.http.bridge]
[INFO] Started bridged http service
Starting bundle [org.apache.felix.gogo.runtime]
Starting bundle [org.apache.felix.webconsole]
Starting bundle [org.apache.felix.http.base]
Starting bundle [org.apache.felix.bundlerepository]
Starting bundle [org.apache.felix.gogo.shell]
Starting bundle [org.apache.felix.http.api]
Starting bundle [org.apache.felix.gogo.command]
Starting bundle [com.mobenga.HelloWorldServletEmbedded]
no HttpService found to register Servlet for /hello                    <---no 
HttpService!
OSGi startet
[2013-03-14 12:34:43,176] Artifact felix-bridge:war exploded: Artifact is 
deployed successfully
____________________________
Welcome to Apache Felix Gogo

g! Mar 14, 2013 12:34:52 PM org.apache.catalina.startup.HostConfig 
deployDirectory
INFO: Deploying web application directory manager
lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.0.2)
    1|Active     |    1|Apache Felix Http Bridge (2.2.0)
    2|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    3|Active     |    1|Apache Felix Web Management Console (3.1.8)
    4|Active     |    1|Apache Felix Http Base (2.2.0)
    5|Active     |    1|Apache Felix Bundle Repository (1.6.6)
    6|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    7|Active     |    1|Apache Felix Http Api (2.2.0)
    8|Active     |    1|Apache Felix Gogo Command (0.12.0)
    9|Active     |    1|HelloWorldServletEmbedded (1.0.0.SNAPSHOT)
g!
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Because all bundles are active i assume i forgot some needed bundle or 
configuration?
(I assume i don't need an embedded Jetty because this runs on top of Tomcat!?)

If you need more information here is the whole maven project as a zip:
https://docs.google.com/file/d/0BwYlZDH_xJugamxJQ2QzaWJULVU/edit?usp=sharing

Regards,
Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to