Websphere 7 和 JSF 1.2 - 应用程序在启动时未正确初始化,无法找到 Factory
在我的例子中,JSF 1.1 和 websphere 6.1 工作正常。将其部署到 websphere 7 服务器后,我收到以下错误 -
Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactoryat javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
不确定这意味着什么,我已在 RAD 中启用 JSF1.2 作为项目方面,但仍然收到上述错误消息,并且我的 jsf 文件都不起作用。
编辑
遵循BalusC的评论后,我看到代码查找了以下目录(这是url.getPath()的o/p),
/C:/IBM/SDP/runtimes/base_v7/profiles/AppSrv01/properties/
/C:/IBM/SDP/runtimes/base_v7/properties/
/
/C:/IBM/SDP/runtimes/base_v7/java/lib/
/C:/IBM/SDP/runtimes/base_v7/lib/
/C:/IBM/SDP/runtimes/base_v7/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime/
/C:/IBM/SDP/runtimes/base_v7/installedConnectors/sib.api.jmsra.rar/
/C:/IBM/SDP/runtimes/base_v7/installedConnectors/wmq.jmsra.rar/
/C:/DETSphere10/DET_FALL9.0/DETEJB/classes/
/C:/DETSphere10/DET_FALL9.0/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/DETWEB/
这些目录中没有jsf impl。现在我更困惑了,因为原始库应该存在于 c:\IBM\SDP\runtimes\base_v7\plugins 下!
JSF 1.1 and websphere 6.1 was working properly in my case. Once I deployed that to a websphere 7 server, I received the following error -
Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactoryat javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
Not sure what it means, I have enabled JSF1.2 as project facet in the RAD but still keep getting the above error message and none of my jsf files are working.
EDIT
After following BalusC's comment, I see the following directories are lookup by the code (this is the o/p of url.getPath())
/C:/IBM/SDP/runtimes/base_v7/profiles/AppSrv01/properties/
/C:/IBM/SDP/runtimes/base_v7/properties/
/
/C:/IBM/SDP/runtimes/base_v7/java/lib/
/C:/IBM/SDP/runtimes/base_v7/lib/
/C:/IBM/SDP/runtimes/base_v7/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime/
/C:/IBM/SDP/runtimes/base_v7/installedConnectors/sib.api.jmsra.rar/
/C:/IBM/SDP/runtimes/base_v7/installedConnectors/wmq.jmsra.rar/
/C:/DETSphere10/DET_FALL9.0/DETEJB/classes/
/C:/DETSphere10/DET_FALL9.0/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/DETWEB/
There is no jsf impl in among these directories. Now I am more confused as the original lib should be present under c:\IBM\SDP\runtimes\base_v7\plugins !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当类路径中存在多个不同版本的 JSF 库时,这是一个典型错误。 Websphere 附带内置 JSF 库。如果您想使用 webapp 提供的 JSF 库,那么您需要在部署后将类加载策略设置为
module
。这通常默认为application
这意味着 webapp 库由主类加载器加载。主类加载器可能碰巧加载了 JSF API 库。当它的版本与Web应用程序中的JSF IMPL库不同时,您可能会收到此类错误。更新以帮助更好地确定根本原因,这里有 2 个建议:
您可以显示本地磁盘文件系统上所有使用的类路径根,如下所示:
在
ServletContextListener#contextInitialized()
中执行此操作。(最终发现这一点后),安装WinRAR,将其与 JAR 文件类型关联并使用其文件搜索工具,用于搜索 JSF 特定文件,例如
FacesContext.class
和FacesContextImpl.class
,以便您可以找到包含 JSF API/impl 的所有 JAR。您可以通过提取 JAR 并读取 MANIFEST 文件来找到确切的 JSF 版本。This is a typical error when there are multiple different versioned JSF libraries in the classpath. Websphere ships with builtin JSF libraries. If you'd like to use the webapp-supplied JSF libraries, then you need to set the classloading policy to
module
after deploying. This usually defaults toapplication
which means that the webapp libraries are loaded by the main classloader. The main classloader may happen to have loaded the JSF API library. When its version is different from the JSF IMPL library in the webapp, then you may receive this kind of errors.Update to help with nailing down the root cause better here are 2 suggestions:
You can reveal all used classpath roots on the local disk file system as follows:
Execute this in
ServletContextListener#contextInitialized()
or so.(eventually after finding that out), install WinRAR, associate it with JAR file type and use its file-search facility to search for a JSF specific file like
FacesContext.class
andFacesContextImpl.class
so that you can find all JAR's which contains the JSF API/impl. You can find out the exact JSF version by extracting the JAR and reading the MANIFEST file.您需要将 JSF JAR(如果您使用 IBM 的组件库,则为
icu4j.jar
和jsf-ibm.jar
)保留在/WEB-INF/lib 中
文件夹。You need to keep the JSF JAR's (
icu4j.jar
andjsf-ibm.jar
if you are using IBM's component library) in your/WEB-INF/lib
folder.