使用 Jboss 的模块化 JSF 应用程序
我们正在尝试构建一个模块化的 jsf 应用程序。该应用程序由一个 war 文件和几个 jar 文件组成。每个 jar 文件包含 .xhtml 页面、关联的 beans 和配置文件,如 faces-config.xml、web-fragment.xml 和 Pretty-config.xml。当这些 jar 文件放置在 WEB-INF/lib 中时,一切正常。
然而,我们需要独立于 war 来部署 jar 文件(就像插件系统一样)。
在 jboss 6 中,我们尝试将 jar 文件放在部署文件夹中。我们能够查看位于 jar 内的 .xhtml 页面(所有部署的应用程序共享相同的类加载域)。但是,未扫描 jar 中的 jsf 注释,并且 FacesContext 未正确初始化。
我们还尝试在 jboss 7 中使用类似的配置来部署应用程序,但遇到了其他问题。位于 jar 中的属性文件未加载,并且由于某种原因,CDI bean 始终解析为 null。
如果我们可以创建一个由未打包在 war 中的可重用模块组成的 Web 应用程序,那就太好了。
欢迎任何建议。
先感谢您。
We are trying to build a modular jsf application. The application consists of a war file and several jar files. Each jar file contains .xhtml pages , associated beans and configuration files like faces-config.xml, web-fragment.xml and pretty-config.xml. When those jar files are placed inside WEB-INF/lib everything works fine.
However, we need to deploy the jar files independently of the war (like a plugin system).
In jboss 6, we tried placing the jar files in the deploy folder. We were able to view the .xhtml pages that were located inside the jar (all the deployed applications share the same classloading domain). However, the jar was not scanned for jsf annotations and the FacesContext was not properly initialized.
We also tried to deploy our application with a similar configuration in jboss 7 but we ran into other issues. The properties files that are located in the jar were not loaded and for some reason the CDI beans resolved always to null.
It would be nice if we could create a web application composed of reusable modules that are not packaged inside the war.
Any suggestions are welcome.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的应用程序有自己的类加载器吗?看起来您确实需要告诉 Java 如何找到 JAR 才能完成此任务,这意味着要么使用 OSGi,要么使用其他类型的自定义类加载器安排。
顺便说一句,这并不是一个罕见的问题,并且自定义类加载器插件系统有多种实现。您可能想阅读现有的实现,例如 https://developer.atlassian.com/显示/PLUGINFRAMEWORK/插件+框架
Does your application have its own class loader? It really seems like you'd need to tell Java how to find the JARs in order to accomplish this, which means either going OSGi or some other variety of custom class loader arrangement.
This isn't an uncommon problem incidentally, and there are several implementations of custom class loader plugin systems. You might want to read up on existing implementations such as https://developer.atlassian.com/display/PLUGINFRAMEWORK/Plugin+Framework