ClassNotFoundException

ClassNotFoundException

本文介绍了MyFaces和WebSphere Liberty概要文件(ClassNotFoundException)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在WebSphere Liberty Profile(16.0.0.3)上成功部署了我的应用程序,但是当我尝试使用它时,出现以下异常:

I've successfully deployed my app on WebSphere Liberty Profile (16.0.0.3), but when I try to use it, I get the following exception:

java.lang.ClassNotFoundException: org.apache.myfaces.renderkit.html.HtmlFormRenderer
    at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:488)
    at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:271)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:466)
    at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:438)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at pt.sibs.epms.ecc.renderer.HtmlFormRenderer.getRenderer(HtmlFormRenderer.java:54)

在server.xml中启用了JSF 2.2:

JSF 2.2 is enabled in server.xml:

<feature>jsf-2.2</feature>

该类存在于:

wlp/lib/com.ibm.ws.jsf.2.2_1.0.14.jar

关于API类型的可见性,我的共享库和应用程序都具有spec,ibm-api,api,third-party.

Regarding API type visibilty, both my shared library and application have spec,ibm-api,api,third-party.

如果我尝试配置MyFaces的另一个实现,则会开始获取ClassCastException.

If I try to configure another implementation of MyFaces, I start getting ClassCastException.

要进行这项工作,我需要更改什么?

What do I need to change to make this work?

推荐答案

jsf-2.2功能不会将MyFaces实现类公开为任何类型的api,这就是为什么尝试Class.forName不能正常工作的原因

The jsf-2.2 feature doesn't expose the MyFaces implementation classes as api of any kind which is why the attempt to do a Class.forName isn't working.

这篇关于MyFaces和WebSphere Liberty概要文件(ClassNotFoundException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 08:37