OSGi web application not running -
i'm trying figure out how implement web application bundle. in order created small sample following instructions in this tutorial. war-file can deployed , started i'm not able call url.
structure of war file;
+meta-inf
manifest.mf
+web-inf
classes/
fancyfoods/web/sayhello.class
web.xml
index.html
tried call
localhost:8080/
localhost:8080/fancyfoods.web/index.html
localhost:8080/fancyfoods.web/sayhello
"http error 404"
have no idea what's wrong. need more bundles run web application?
best regard
cut
hello again,
thank replies , sorry confusion misplaced answer (i'm new stack overflow). started new wab-example scratch , still doesn't work. in order test if http services work in general first implemented bundle (not wab) containing servlet , osgi-component registers servlet , static resources. , works! i'm able call html , servlet.
now problem wab. since non-wab example works assume war file not ok. invested more time provide necessary information (i hope so).
the structure of war-file is:
¦---index.html ¦ +---meta-inf ¦-------manifest.mf ¦ +---web-inf ¦ web.xml ¦ +---classes +---org +---osgi +---helloworld +---wab helloworldwab.class helloworldwabactivator.class helloworldwabcomponent.class helloworldwabservlet.class
manifest.mf:
manifest-version: 1.0 ant-version: apache ant 1.8.3 created-by: 1.7.0_09-b05 (oracle corporation) bundle-manifestversion: 2 bundle-name: org.osgi.helloworld.wab bundle-symbolicname: org.osgi.helloworld.wab bundle-version: 1.0.0.qualifier bundle-requiredexecutionenvironment: javase-1.7 bundle-activator: org.osgi.helloworld.wab.helloworldwabactivator bundle-classpath: web-inf/classes import-package: javax.servlet, javax.servlet.http, org.osgi.framework, org.osgi.service.component, org.osgi.service.http, org.osgi.util.tra cker export-package: org.osgi.helloworld.wab web-contextpath: /helloworld webapp-context: /helloworld
when start & stop bundle methods of helloworldwabactivator invoked aspected.
web.xml:
<web-app> <!-- welcome file mapping --> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <servlet> <servlet-name>helloworldwabservlet</servlet-name> <servlet-class>org.osgi.helloworld.wab.helloworldwabservletxxx</servlet-class> </servlet> <servlet-mapping> <servlet-name>helloworldwabservlet</servlet-name> <url-pattern>/helloworldwabservlet</url-pattern> </servlet-mapping> </web-app>
osgi server:
start level 1 id|state |level|name 0|active | 0|system bundle (4.2.1) 1|active | 1|apache commons fileupload (1.2.2.v20111214-1400) 2|active | 1|apache commons io (1.4.0.v20081110-1000) 3|active | 1|apache felix bundle repository (1.6.6) 4|active | 1|apache felix configuration admin service (1.6.0) 5|active | 1|apache felix eventadmin (1.3.2) 6|active | 1|apache felix file install (3.2.6) 7|active | 1|apache felix gogo command (0.12.0) 8|active | 1|apache felix gogo runtime (0.10.0) 9|active | 1|apache felix gogo shell (0.10.0) 10|active | 1|apache felix http api (2.2.0) 11|active | 1|apache felix http base (2.2.0) 12|active | 1|apache felix http bridge (2.2.0) 13|active | 1|apache felix http bundle (2.2.0) 14|active | 1|apache felix http jetty (2.2.0) 15|active | 1|apache felix http proxy (2.2.0) 16|active | 1|apache felix http whiteboard (2.2.0) 17|active | 1|apache felix log service (1.0.1) 18|active | 1|apache felix preferences service (1.0.4) 19|active | 1|apache felix declarative services (1.6.2) 20|active | 1|apache felix web management console (4.0.0) 21|active | 1|json implementation java (1.0.0.v201011060100) 22|active | 1|org.osgi.helloworld.wab (1.0.0.qualifier) 23|active | 1|org.osgi.helloworld.servlet (1.0.0.qualifier)
thank support
did specify web-contextpath in manifest file?
http://www.javabeat.net/2011/11/writing-an-osgi-web-application/
ideally should specify web.xml file in web-inf folder too.
Comments
Post a Comment