Vaadin 资源未加载到 OSGI 中

发布于 2024-12-04 17:55:13 字数 1738 浏览 0 评论 0原文

我有一组使用 Maven + BND 创建的捆绑包。其中一个捆绑包包含我的 Vaadin“应用程序”,其他捆绑包包含一些实用程序和其他编辑器。

我可以在 Tomat 服务器上运行这个应用程序 - 一切正常。然后我尝试在 OSGI (Apache Felix) 中运行。在解决了许多问题之后,我终于成功运行了 OSGI 运行时,并正确加载和激活了所有包。 我什至可以使用“localhost:8080/bat”访问第一页 - 它不再显示“404 not found”。

问题是:起始页仅显示我的应用程序中的一些未格式化的文本

应用程序无法加载其 Vaadin 资源(CSS,可能是 widgetset 等)。 调试框架显示:

Starting Vaadin client side engine. Widgetset: com.vaadin.terminal.gwt.DefaultWidgetSet
Widget set is built on version: 6.6.6
Warning: widgetset version 6.6.6 does not seem to match theme version
Starting application bat-97301
Vaadin application servlet version: 6.6.6
Application version: 0.0.1
inserting load indicator
Making UIDL Request with params: init
Server visit took 9ms
...
Assuming CSS loading is not complete, postponing render phase. (.v-loading-indicator height == 0)
Assuming CSS loading is not complete, postponing render phase. (.v-loading-indicator height == 0)
....
CSS files may have not loaded properly.

看起来无法加载 Vaadin 资源。

所以,问题是: 打包为 OSGI 包的 Vaadin 应用程序的正确结构是什么?

这是我的 OSGI 包结构(使用 Maven + BND 创建): (我跳过了一些 Vaadin Reindeer 主题文件夹,因为这些文件夹并不重要)

├───com
│   └───my
│       ├───demomodules
│       ├───preferences
│       ├───widgetset
│       └───workspaces
├───META-INF
├───VAADIN
│   ├───icons
│   ├───themes
│   │   ├───mytheme
│   │   └───reindeer
│   │       ├───a-sprite-definitions
│   └───widgetsets
│       ├───com.my.widgetset.Vaadin1Widgetset
│       │   └───ie6pngfix
│       └───WEB-INF
│           └───deploy
│               └───com.my.widgetset.Vaadin1Widgetset
│                   ├───rpcPolicyManifest
│                   └───symbolMaps
└───WEB-INF

I have a set of bundles I created with Maven + BND. One of the bundles contains my Vaadin "Application", the others have some utilities and additional editors.

I can run this app on a Tomat server - everything is OK. Then I tried running in OSGI (Apache Felix). After many solved problems I finally managed to run the OSGI runtime and have all the bundles loaded and activated correctly.
I can even access the 1st page with "localhost:8080/bat" - it does not show "404 not found" anymore.

The problem is: The start page only shows some unformatted text from my app.

the app can't load its Vaadin resources (CSS, maybe widgetset, etc).
the debug frame says:

Starting Vaadin client side engine. Widgetset: com.vaadin.terminal.gwt.DefaultWidgetSet
Widget set is built on version: 6.6.6
Warning: widgetset version 6.6.6 does not seem to match theme version
Starting application bat-97301
Vaadin application servlet version: 6.6.6
Application version: 0.0.1
inserting load indicator
Making UIDL Request with params: init
Server visit took 9ms
...
Assuming CSS loading is not complete, postponing render phase. (.v-loading-indicator height == 0)
Assuming CSS loading is not complete, postponing render phase. (.v-loading-indicator height == 0)
....
CSS files may have not loaded properly.

looks like Vaadin resources can't be loaded.

so, the question is:
what's a proper structure for a Vaadin application packed as an OSGI bundle?

here's my OSGI bundle structure (created with Maven + BND):
(I skipped some Vaadin Reindeer theme folders as not important)

├───com
│   └───my
│       ├───demomodules
│       ├───preferences
│       ├───widgetset
│       └───workspaces
├───META-INF
├───VAADIN
│   ├───icons
│   ├───themes
│   │   ├───mytheme
│   │   └───reindeer
│   │       ├───a-sprite-definitions
│   └───widgetsets
│       ├───com.my.widgetset.Vaadin1Widgetset
│       │   └───ie6pngfix
│       └───WEB-INF
│           └───deploy
│               └───com.my.widgetset.Vaadin1Widgetset
│                   ├───rpcPolicyManifest
│                   └───symbolMaps
└───WEB-INF

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一杆小烟枪 2024-12-11 17:55:13

我最近刚刚做了这个练习。谷歌搜索 vaadin 和 OSGi 显示,对于如何集成以及在哪个级别(例如组件或应用程序)进行集成有不同的看法。然而,关键的“实现点”是您必须对其进行安排,以便客户端可以访问 VAADIN 资源,即可以作为您的“servlet”的资源。我认为这样的包结构不会对您有帮助,您必须处理 Http 服务并为其提供有关如何提供服务的说明。

查看 neil bartlett 的 vaadin 示例,网址为 https://github.com/njbartlett/VaadinOSGi,特别是 Vaadinbridge 项目。这帮助我理解了这些问题。

另一种方法可能是将捆绑包部署在理解 WAR 的 OSGi 容器上,例如 Virgo。但这只是一个猜测。

I just recently did this exercise. Googling on vaadin and OSGi reveals that there are different takes on how to integrate and on which level, e.g. component or application. However, the key "realization point" is that you must arrange it so that the VAADIN resources are accessible from the client, i.e. can be served as resources from your "servlet". I don't think the bundle structure as such will help you here, you must deal with the Http Service and give it instructions on how to serve the stuff.

Take a look at the vaadin examples by neil bartlett at https://github.com/njbartlett/VaadinOSGi, specifcially the vaadinbridge project. That helped me in understanding the issues.

Another approach might be to deploy the bundle on an OSGi continer that understands WARs, such as Virgo. But that is just a guess.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文