【发布时间】:2011-11-14 12:25:11
【问题描述】:
更新:已解决。我不得不使用实用程序包在 OSGI 中自动加载 Vaadin 应用程序。见http://dev.vaadin.com/wiki/Arvue/OSGi 我使用的包:org.vaadin.osgi、org.vaadin.osgi.staticres
===
我创建了一个示例 Vaadin 项目,使用 Maven + BND 将其构建为 OSGI 包。
使用我的“webui-1.0.jar”包及其依赖的“vaadin-6.6.6.jar”启动 Apache Felix。 我可以访问 localhost:8080,但是 localhost:8080/webui 显示 “访问 /webui 时出现问题。原因:NOT_FOUND”。
“webui-1.0.jar”包含:
com -- java classes
META-INF/MANIFEST.MF
VAADIN -- empty now, but will contain Vaadin widgetsets and other resources
WEB-INF/web.xml
我的 web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>webui</display-name>
<context-param>
<description>
Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>Vaadin1 Application</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<description>
Vaadin application class to start</description>
<param-name>application</param-name>
<param-value>com.mywebtest.MyVaadinApplication</param-value>
</init-param>
<init-param>
<description>
Application widgetset</description>
<param-name>widgetset</param-name>
<param-value>com.mywebtest.widgetset.Vaadin1Widgetset</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Vaadin1 Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
我的 MANIFEST.MF 文件由 Maven + BND 生成:
Manifest-Version: 1
Bnd-LastModified: 1315684875698
Build-Jdk: 1.6.0_26
Built-By: ask
Bundle-ManifestVersion: 2
Bundle-Name: webui
Bundle-SymbolicName: webui
Bundle-Version: 1.0.0
Class-Path:
Created-By: Apache Maven Bundle Plugin
Export-Package: com.mywebtest;uses:="com.vaadin,com.vaadin.ui";version="
1.0.0"
Import-Package: com.vaadin,com.vaadin.ui
Tool: Bnd-1.43.0
运行包:
g! lb
START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (3.2.2)
1|Active | 1|Apache Felix Bundle Repository (1.6.6)
2|Active | 1|Apache Felix Configuration Admin Service (1.2.8)
3|Active | 1|Apache Felix Dependency Manager (3.0.0)
4|Active | 1|Apache Felix Gogo Command (0.8.0)
5|Active | 1|Apache Felix Gogo Runtime (0.8.0)
6|Active | 1|Apache Felix Gogo Shell (0.8.0)
7|Active | 1|Apache Felix Http Api (2.2.0)
8|Active | 1|Apache Felix Http Jetty (2.2.0)
9|Active | 1|Apache Felix Metatype Service (1.0.4)
10|Active | 1|Apache Felix Declarative Services (1.6.0)
11|Active | 1|Apache Felix Web Management Console (3.1.8)
12|Active | 1|Vaadin (6.6.6)
13|Active | 1|webui (1.0.0)
【问题讨论】:
-
还有哪些捆绑软件正在运行?为什么您甚至期望在
/webui别名下出现任何内容? -
我将捆绑包列表添加到原始消息中。我以为“webui-1.0”捆绑包中的网络应用程序会自动部署,我从互联网上的一些文章中得到了这个印象......
-
我将有问题的包 (1.1 Mb) 上传到了这个临时位置:hostedredmine.com/documents/617
-
好的,我找到了一个实用程序包,可以将 Vaadin 应用程序自动加载到 OSGI。这个问题解决了。该应用程序可以部署并(几乎)显示在浏览器中。我需要想办法将 Vaadin 小部件集放入 Maven+BND 创建的 Bundle 中,但这是一个单独的问题。