2014-12-22 4 views
2

Я хотел бы использовать OmniFaces ListConverter как мой конвертер на PrimeFaces автозаполнение. К сожалению, следующее исключение появляется, когда я пытался.java.io.NotSerializableException: org.omnifaces.taghandler.Converter

Насколько я знаю, JSF-преобразователи не обязаны реализовывать интерфейс Serializable. Я прочитал учебник java ee 6 и не смог найти такое утверждение.

Ссылки Ссылки:

У меня было ощущение, что MyFaces пытается десериализируются любой объект, используемый на моей странице. Как я могу справиться с этой ситуацией?


среда

  • WebSphere Application Server 8.5.5.2
  • Apache MyFaces 2.0.2
  • OmniFaces 1,7
  • PrimeFaces 5.0

Managed Bean:

import javax.inject.Named; 
import org.omnifaces.cdi.ViewScoped; 

@Named 
@ViewScoped 
public class MovimentacaoOperacionalVolumeBean implements Serializable { 

автозаполнения код реализации:

<p:autoComplete value="#{movimentacaoOperacionalVolume.listaFiltroVolumes}" 
       scrollHeight="200" 
       scrollable="true" 
       multiple="true" 
       id="listaNrVolume" 
       var="estoque" 
       completeMethod="#{movimentacaoVolumeBean.completarSugestoesNrVolume}" 
       forceSelection="true" 
       itemLabel="#{estoque.nrVolume}" 
       itemValue="#{estoque}" 
       placeholder="#{msg['hint.btn.busca.nrVolume']}" 
       minQueryLength="6" 
       emptyMessage="#{msg['msg.tabela.semregistros']}" 
       styleClass="larguraFiltroAutoComplete" 
       queryDelay="500" > 
    <o:converter converterId="omnifaces.ListConverter" 
       list="#{movimentacaoOperacionalVolume.listaNumerosVolumeOpcionais}"/> 

WebSphere трассировки стека:

[22/12/14 11:12:50:078 BRST] 0000006e JspStateManag E Exiting serializeView - Could not serialize state: org.omnifaces.taghandler.Converter 
java.io.NotSerializableException: org.omnifaces.taghandler.Converter 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1185) 
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1555) 
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1516) 
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) 
    at java.util.ArrayList.writeObject(ArrayList.java:720) 
    at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1020) 
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) 
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) 
    at java.util.ArrayList.writeObject(ArrayList.java:720) 
    at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1020) 
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) 
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) 
    at java.util.ArrayList.writeObject(ArrayList.java:720) 
    at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1020) 
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) 
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) 
    at java.util.ArrayList.writeObject(ArrayList.java:720) 
    at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1020) 
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) 
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) 
    at java.util.ArrayList.writeObject(ArrayList.java:720) 
    at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1020) 
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) 
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179) 
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379) 
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) 
    at org.apache.myfaces.application.jsp.JspStateManagerImpl.serializeView(JspStateManagerImpl.java:814) 
    at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedViewInServletSession(JspStateManagerImpl.java:699) 
    at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:497) 
    at javax.faces.application.StateManager.saveView(StateManager.java:114) 
    at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveView(JspStateManagerImpl.java:460) 
    at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1379) 
    at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:263) 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59) 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59) 
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59) 
    at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85) 
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:240) 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97) 
    at org.omnifaces.filter.FacesExceptionFilter.doFilter(FacesExceptionFilter.java:56) 
    at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:77) 
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) 
    at su.comum.web.util.filter.MenuPrimefacesFilter.doFilter(MenuPrimefacesFilter.java:106) 
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064) 
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3837) 
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) 
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981) 
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) 
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) 
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) 
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864) 
+1

http://stackoverflow.com/q/18713264/1391249 – Tiny

ответ

2

Это ошибка в MyFaces. Я не могу сказать, какая версия MyFaces точно содержит исправление, но я могу сказать, что эта конструкция отлично работает, по крайней мере, в MyFaces 2.1.12. Однако обновление MyFaces в WebSphere может быть не тривиальной задачей (технически и бюрократией).

Лучше всего сказать, что MyFaces не сериализует все состояние просмотра в сеансе, а вместо этого сохраняет его в памяти и удерживает ссылку (например, как по умолчанию Mojarra). Вы можете сделать это с помощью следующего контекста паров в web.xml:

<context-param> 
    <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param‌​-name> 
    <param-value>false</param-value> 
</context-param>