可以在一个类加载器中加载多个 jsf wars 吗?
我有 3 个安装了 JSF 的 war 文件,3 个面孔配置,当我将它们全部加载到作为 EAR 一部分的一个类加载器中时,它会因初始化错误而失败。像下面这样。似乎 JSF 不喜欢在一个类加载器中加载多次,有人尝试过吗?加载 EAR 3 个 JSF 战争?
java.lang.NullPointerException
at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:241)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:108)
i have 3 war files with JSF installed, 3 faces config, when i make them all load into one class loader that is part of the EAR, it fails on initialization errors. like below. seems like JSF does not like to load multiple times in one classloader, has anyone tried this? to load a EAR with 3 JSF wars?
java.lang.NullPointerException
at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:241)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:108)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此特定异常可能是由于类路径中缺少
jsf-api.jar
文件或类路径中版本不同的jsf-api.jar
(与WAR 的jsf-impl.jar
,可能是应用服务器提供的。理论上有 3 种方法可以解决此问题:jsf-api.jar
和jsf-impl.jar
)并依赖应用程序服务器提供的 JSF 库。另一个原因可能是 WAR 包含特定于应用程序服务器的库,而这些库又包含 JSF 类,例如 Glassfish 的
javaee.jar
。所有这些特定于应用程序服务器的库也需要从所有 WAR 和 EAR 中删除。重点是:保持类路径干净。
This particular exception can be caused by either a missing
jsf-api.jar
file in the classpath, or a different versionedjsf-api.jar
in the classpath as opposed to the WAR'sjsf-impl.jar
, possibly the appserver-provided one. In theory there are 3 ways to fix this problem:jsf-api.jar
andjsf-impl.jar
) in the WAR's and rely on the JSF libraries provided by the appserver.Another cause can be that the WAR's include appserver-specific libraries which in turn contain the JSF classes, such as Glassfish's
javaee.jar
. All of those appserver-specific libraries needs to be removed from all WAR's and EAR's as well.To the point: keep the classpath clean.