简体   繁体   English

Apache Felix + Java EE + OSGi网络应用

[英]Apache Felix + Java EE + OSGi Web-App

I am building an OSGi application with some Java EE features. 我正在构建具有某些Java EE功能的OSGi应用程序。 The thing is that I am looking for a way to package the application along with all its dependencies so a user only executes the jar file and executes the OSGi framework along with osgi app and dependencies. 问题是,我正在寻找一种将应用程序及其所有依赖项打包的方法,以便用户仅执行jar文件,并与osgi应用程序和依赖项一起执行OSGi框架。 Then the user only goes to web-browser and open the application. 然后,用户仅转到Web浏览器并打开应用程序。

The first problem I've found is to execute a Java-EE application in an OSGi framework (Apache Felix) to just execute it. 我发现的第一个问题是在OSGi框架(Apache Felix)中执行Java-EE应用程序以仅执行它。 Which dependencies should I import into Felix to enable Java-EE applications? 我应将哪些依赖项导入Felix以启用Java-EE应用程序? I have tried some other approaches like: 我尝试了其他一些方法,例如:

And still has not managed to get a simple Java-EE Application with JSF, work under OSGi. 而且仍无法通过JSF获得一个简单的Java-EE应用程序,可以在OSGi下工作。 There is a sort of dependency nightmare going on between OSGi and Java-EE that only Glassfish has managed to accomplish. OSGi和Java-EE之间发生了某种依赖关系的噩梦,只有Glassfish才能解决。

Does any body knows how to get a simple Java-EE application to work in Apache Felix? 有谁知道如何使一个简单的Java-EE应用程序在Apache Felix中工作? Once we gt this working embedding all this components in one Jar may not be so complicated and Apache Maven Assembly Plugin can help with that. 一旦我们完成了将所有这些组件嵌入到一个Jar中的工作,可能就不会那么复杂了, Apache Maven Assembly Plugin可以为您提供帮助。

What you are trying to do is execute something like a traditional WAR file inside OSGi? 您想做的是在OSGi中执行类似传统WAR文件的操作? Technically what you need to do is actually create a 'wab', a web application bundle. 从技术上讲,您实际上需要创建一个“ wab”(Web应用程序捆绑包)。 To do this you use the maven-bundle-plugin the same way you would to create any other bundle, but you specify that it's a 'wab' (see elsewhere). 为此,您可以使用maven-bundle-plugin来创建其他捆绑软件,但是您要指定它是一个“ wab”(请参见其他地方)。

Then you need to deploy it into felix in such a way that it uses a 'servlet bridge'. 然后,您需要使用“ servlet桥”将其部署到felix中。 You can do this in vanilla felix, but it's not easy. 您可以在香草费利克斯中做到这一点,但这并不容易。

Try Apache Karaf. 尝试Apache Karaf。 Karaf is a wrapper for Felix that provides neat ways to install sets of libraries that implement 'features'. Karaf是Felix的包装,它提供了巧妙的方法来安装实现“功能”的库集。 The feature you need is the 'war' feature, which installs various things including jetty etc. 您需要的功能是“战争”功能,该功能可以安装各种设备,包括码头等。

So at the karaf command line you would do 'features install war' Then drop your wab bundle into the deploy folder and cross your fingers. 因此,在karaf命令行上,您将执行“功能安装战争”,然后将wab捆绑包放到deploy文件夹中,然后用手指交叉。

Better than that, you can use the karaf-maven-plugin to create your own 'features.xml' file that determines other features, and dependencies your bundle uses, then drop that features.xml file into the deploy folder of Karaf. 更好的是,您可以使用karaf-maven-plugin创建自己的“ features.xml”文件来确定其他功能以及捆绑软件使用的依赖项,然后将features.xml文件放入Karaf的deploy文件夹中。

If you have any specific questions about that, just let me know. 如果您对此有任何疑问,请告诉我。 I have examples for just about all of it, but you're on a fairly steep learning curve I'm afraid :( 我有所有例子,但恐怕您的学习曲线相当陡峭:(

Check Wisdom Framework . 检查Wisdom框架
The documentation is not very good, but it's a nice framework. 文档不是很好,但是它是一个不错的框架。
I recommend and will use in my next project. 我建议并在下一个项目中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM