我在Websphere Liberty 16.0.0.4中运行JSF 2.2应用程序。
它使用了JSF的Myfaces 2.2实现,捆绑在com.ibm.ws.jsf.2.2_1.0.15.jar中。我正在为org.apache.myfaces.renderkit.MyfacesResponseStateManager获取ClassNotFoundException。
同样的JSF页面在WAS 9 Classic中运行良好,它也使用了Myfaces 2.2。
欢迎任何帮助。请参阅下面的堆栈跟踪。
谢谢,Sanjay
[9/28/17 14:53:57:669 EDT] 0000002a id= org.apache.myfaces.shared.util.ClassUtils
E null java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:670)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:542)
at org.apache.myfaces.config.FacesConfigurator.configureRenderKits(FacesConfigurator.java:1317)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:607)
at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:421)
at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:177)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2420)
at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.notifyServletContextCreated(WebApp31.java:505)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1064)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6562)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1004)
at com.ibm.ws.webcontainer.osgi.WebContainer.startModule(WebContainer.java:825)
at com.ibm.ws.app.manager.module.internal.ModuleHandlerBase.deployModule(ModuleHandlerBase.java:100)
at com.ibm.ws.app.manager.module.internal.DeployedModuleInfoImpl.installModule(DeployedModuleInfoImpl.java:50)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModules(DeployedAppInfoBase.java:420)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:406)
at com.ibm.ws.app.manager.ear.internal.EARApplicationHandlerImpl.install(EARApplicationHandlerImpl.java:84)
at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:141)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1191)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:804)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
Caused by: java.lang.IllegalStateException: Could not initialize MyFacesFlowResponseStateManager
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:58)
at org.springframework.faces.webflow.FlowRenderKit.<init>(FlowRenderKit.java:43)
... 31 more
Caused by: java.lang.NoClassDefFoundError: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:346)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:335)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:310)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:53)
... 32 more
Caused by: java.lang.ClassNotFoundException: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:499)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:294)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
... 43 more
[9/28/17 14:53:57:676 EDT] 0000002a id= org.apache.myfaces.webapp.AbstractFacesInitializer E An error occured while initializing MyFaces: java.lang.reflect.InvocationTargetException
javax.faces.FacesException: java.lang.reflect.InvocationTargetException
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:697)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:542)
at org.apache.myfaces.config.FacesConfigurator.configureRenderKits(FacesConfigurator.java:1317)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:607)
at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:421)
at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:177)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2420)
at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.notifyServletContextCreated(WebApp31.java:505)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1064)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6562)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1004)
at com.ibm.ws.webcontainer.osgi.WebContainer.startModule(WebContainer.java:825)
at com.ibm.ws.app.manager.module.internal.ModuleHandlerBase.deployModule(ModuleHandlerBase.java:100)
at com.ibm.ws.app.manager.module.internal.DeployedModuleInfoImpl.installModule(DeployedModuleInfoImpl.java:50)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModules(DeployedAppInfoBase.java:420)
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:406)
at com.ibm.ws.app.manager.ear.internal.EARApplicationHandlerImpl.install(EARApplicationHandlerImpl.java:84)
at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:141)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1191)
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:804)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.apache.myfaces.shared.util.ClassUtils.buildApplicationObject(ClassUtils.java:670)
... 26 more
Caused by: java.lang.IllegalStateException: Could not initialize MyFacesFlowResponseStateManager
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:58)
at org.springframework.faces.webflow.FlowRenderKit.<init>(FlowRenderKit.java:43)
... 31 more
Caused by: java.lang.NoClassDefFoundError: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:346)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:335)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:310)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.faces.webflow.FlowRenderKit.initResponseStateManager(FlowRenderKit.java:53)
... 32 more
Caused by: java.lang.ClassNotFoundException: org.apache.myfaces.renderkit.MyfacesResponseStateManager
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:499)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:294)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846)
at java.lang.ClassLoader.loadClass(ClassLoader.java:825)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)
... 43 more
答案 0 :(得分:0)
jsf-2.2 Liberty功能不公开MyFaces实现类,而WebSphere Traditional profile(经典)允许访问这些内部类。在您的场景中,Spring类org.springframework.faces.webflow.FlowRenderKit
正在尝试通过org.apache.myfaces.renderkit.MyfacesResponseStateManager
加载内部类ClassUtils.forName
,class Debounce extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
state = {
searchTerm: '',
};
setSearchTerm = debounce((searchTerm) => this.setState({ searchTerm }), 1000);
handleChange(e) {
this.setSearchTerm(e.target.value);
}
render() {
return (
<div>
<input type="text" onChange={this.handleChange} />
<div>Search Value 2: {this.state.searchTerm}</div>
</div>
);
}
}
不会在Liberty上工作,而且通常不是很好的做法。
如果您不需要与应用程序进行CDI集成,则直接捆绑MyFaces - 而不是使用Liberty jsf-2.2功能 - 应该允许此方案生效。
上提出问题可能是值得的相关答案:MyFaces and WebSphere Liberty Profile (ClassNotFoundException)