我正在尝试使用Converters Features
的{{1}}。我的开发环境如下:
Omnifaces
此环境正常,没有配置错误。当我向-primefaces 3.5
-jsf 2.0
-spring 3.5
-Jboss Seam 2.3
添加新omnifaces-1.6.3.jar
时,无法部署应用程序..
WEB-INF\lib
....
14:14:59,563 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] (MSC service thread 1-2) Loaded JDBC driver: com.mysql.jdbc.Driver
14:14:59,565 INFO [org.springframework.web.context.ContextLoader] (MSC service thread 1-2) Root WebApplicationContext: initialization completed in 98 ms
14:14:59,595 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-2) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/cycfm'
14:15:00,215 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-2) Critical error during deployment: : com.sun.faces.config.ConfigurationExcept
ion:
Source Document: vfs:/C:/java/JBoss-7.1.1/standalone/deployments/cycfm.war/WEB-INF/lib/omnifaces-1.6.3.jar/META-INF/faces-config.xml
Cause: Unable to create a new instance of 'org.omnifaces.eventlistener.InvokeActionEventListener': java.lang.UnsupportedOperationException
at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:293) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.processor.LifecycleConfigProcessor.addPhaseListeners(LifecycleConfigProcessor.java:132) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:111) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:222) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:361) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225) [jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_25]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_25]
Caused by: java.lang.UnsupportedOperationException
at javax.faces.application.Application.subscribeToEvent(Application.java:1812) [jboss-jsf-api_2.1_spec-2.0.5.Final.jar:2.0.5.Final]
at javax.faces.application.ApplicationWrapper.subscribeToEvent(ApplicationWrapper.java:709) [jboss-jsf-api_2.1_spec-2.0.5.Final.jar:2.0.5.Final]
at org.omnifaces.util.Events.subscribeToEvent(Events.java:180) [omnifaces-1.6.3.jar:1.6.3]
at org.omnifaces.eventlistener.InvokeActionEventListener.<init>(InvokeActionEventListener.java:65) [omnifaces-1.6.3.jar:1.6.3]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_25]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.6.0_25]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.6.0_25]
at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance0(Unknown Source) [rt.jar:1.6.0_25]
at java.lang.Class.newInstance(Unknown Source) [rt.jar:1.6.0_25]
at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:268) [jsf-impl-2.1.7-jbossorg-2.jar:]
... 14 more
14:15:00,227 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cycfm]] (MSC service thread 1-2) Exception sending context initialized event to liste
ner instance of class com.sun.faces.config.ConfigureListener: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException:
Source Document: vfs:/C:/java/JBoss-7.1.1/standalone/deployments/cycfm.war/WEB-INF/lib/omnifaces-1.6.3.jar/META-INF/faces-config.xml
Cause: Unable to create a new instance of 'org.omnifaces.eventlistener.InvokeActionEventListener': java.lang.UnsupportedOperationException
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292) [jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_25]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_25]
...
或web.xml
中的配置是否使用faces-config.xml
。我认为,我的页面和支持bean没有问题。
mypage.xhtml
Ominifaces
ChartBean.java
<h:form>
<p>
<b>Last selected item:</b> <h:outputText id="selected_item" value="#{ChartBean.selectedEntity.value}" />
</p>
<h:panelGrid columns="2">
<h:outputLabel for="iterator" value="Items with iterator: " />
<h:selectOneMenu id="iterator" value="#{ChartBean.selectedEntity}" converter="omnifaces.SelectItemsIndexConverter">
<f:selectItem itemValue="#{null}" itemLabel="Choose item" noSelectionOption="true" />
<f:selectItems value="#{ChartBean.exampleEntities}" var="entity" itemLabel="#{entity.value}" itemValue="#{entity}" />
<f:ajax render="selected_item" />
</h:selectOneMenu>
</h:panelGrid>
<p>
<b>Selected items</b>:
<ui:fragment rendered="#{not empty ChartBean.selectedEntity}">
<ui:repeat value="#{ChartBean.selectedEntity}" var="entity" varStatus="loop">
#{entity.value}#{loop.last ? '' : ', '}
</ui:repeat>
</ui:fragment>
<h:outputText value="[no selection made]" rendered="#{empty ChartBean.selected}"/>
</p>
<p>
<b>Choose a city, then press Select</b>:
<p:pickList value="#{ChartBean.dualListModel}" var="entity" itemValue="#{entity}" itemLabel="#{entity.value}">
<o:converter converterId="omnifaces.ListIndexConverter" list="#{ChartBean.exampleEntities}" />
</p:pickList>
</p>
<p>
<h:commandButton value="Select">
<f:ajax execute="@form" render="@form"/>
</h:commandButton>
</p>
</h:form>
更新:
我有一点,当我使用@Name("ChartBean")
public class ChartBean implements Serializable {
private List<ExampleEntity> exampleEntities;
private DualListModel<ExampleEntity> dualListModel;
private ExampleEntity selectedEntity;
@PostConstruct
public void init() {
exampleEntities = new ArrayList<ExampleEntity>();
exampleEntities.add(new ExampleEntity(1L, "Amsterdam"));
exampleEntities.add(new ExampleEntity(2L, "Frankfurt"));
exampleEntities.add(new ExampleEntity(3L, "London"));
dualListModel = new DualListModel<ExampleEntity>(exampleEntities, new ArrayList<ExampleEntity>());
}
public List<ExampleEntity> getExampleEntities() {
return exampleEntities;
}
public ExampleEntity getSelectedEntity() {
return selectedEntity;
}
public void setSelectedEntity(ExampleEntity selectedEntity) {
this.selectedEntity = selectedEntity;
}
public DualListModel<ExampleEntity> getDualListModel() {
return dualListModel;
}
public void setDualListModel(DualListModel<ExampleEntity> dualListModel) {
this.dualListModel = dualListModel;
}
public List<ExampleEntity> getSelectedModel() {
return dualListModel.getTarget();
}
}
时,没有部署错误。但我无法使用omnifaces-1.4.1.jar
。
更新:新的Jar文件omnifaces.ListIndexConverter
omnifaces-1.7-20131127.003718-16.jar