BndTools を使用してサーブレットを構築しようとしています。このチュートリアルに従いました: http://www.ralfebert.de/archive/java/osgi_server/
しかし..サーブレットを動作させることができません:(。問題は、apache felix ホワイトボード バンドルがデバッグ メッセージを表示することです: Ignoring Servlet Service [javax.servlet.Servlet], alias is missing or empty
何時間もグーグルで検索しましたが、この問題に対する答えが得られません。localhost:8080 にアクセスしようとすると、次のメッセージが表示されます。
/ へのアクセスに問題があります。理由:
NOT_FOUND
私のサーブレットのコードは次のとおりです。
package com.example.helloworld;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
import aQute.bnd.annotation.component.Component;
@Component(provide=Servlet.class, properties = { "alias=/" })
public class HelloWorldServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.getWriter().append("Hello World!");
}
}
私は何が欠けているか、何か間違っていますか??
私の bnd.bnd ファイルのソースは次のとおりです。
-buildpath: osgi.core,\
osgi.cmpn,\
biz.aQute.bnd.annotation,\
junit.osgi,\
org.apache.felix.http.jetty
-sub: *.bnd
-runfw: org.apache.felix.framework;version='[4.0.3,4.0.3]'
また、BndTools の新しいバージョンを使用しているため、.bnd ファイル内のすべてを管理できなくなりました。したがって、ここに私の run.runbnd ファイルのソースもあります。
-runfw: org.apache.felix.framework;version='[4,5)'
-runee: JavaSE-1.6
-runsystemcapabilities: ${native_capability}
-resolve.effective: active
-runrequires: osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.runtime)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.http.jetty)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.http.whiteboard)'
-runbundles: org.apache.felix.gogo.command,\
org.apache.felix.gogo.runtime,\
org.apache.felix.gogo.shell,\
osgi.cmpn,\
org.apache.felix.http.jetty,\
org.apache.felix.http.whiteboard,\
com.example.helloworld.org.example;version=latest