MyFaces and WebSphere Liberty Profile (ClassNotFoundException)

谁都会走 提交于 2019-12-11 04:14:11

问题


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)

JSF 2.2 is enabled in server.xml:

<feature>jsf-2.2</feature>

And the class exists in:

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

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

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

What do I need to change to make this work?


回答1:


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.




回答2:


Hi you should be able to implement your own Renderers by using a combination of the RendererWrapper and the RenderKitWrapper. These classes allow you to add specialized behavior to existing Renderer and RenderKit instances.



来源:https://stackoverflow.com/questions/40584059/myfaces-and-websphere-liberty-profile-classnotfoundexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!