2016-02-05 7 views
0

У меня возникла большая проблема, когда я попытался запустить приложение EJB + CDI + JSF на Wildfly 9.2 (также я попытался 10.0) в автономном кластерном режиме.Проблема с сериализацией CDI Beans на кластере

Проблема происходит, когда мой кластер контейнер пытается десериализации моего сеанса области действия CDI бобов, он бросает следующее исключение:

2016-02-06 02:17:22,650 ERROR [io.undertow.request] (default task-9) UT005071: Undertow request failed HttpServerExchange{ GET /login.xhtml request {Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8], Accept-Language=[en-US,en;q=0.8], Cache-Control=[max-age=0], Accept-Encoding=[gzip, deflate, sdch], User-Agent=[Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36], Connection=[keep-alive], Cookie=[__utma=111872281.273659443.1454265274.1454265274.1454265274.1; __utmz=111872281.1454265274.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); JSESSIONID=oiC7sg_tinxBz6BWghg5PQ2urzCMw4Kh5oPqPRqU.ahmed-pc], Upgrade-Insecure-Requests=[1], Host=[localhost:8180]} response {Connection=[keep-alive], Content-Type=[text/html;charset=UTF-8], Content-Length=[12371], Date=[Fri, 05 Feb 2016 23:17:22 GMT]}}: org.jboss.weld.exceptions.IllegalStateException: WELD-001122: Failed to deserialize annotated type identified with AnnotatedTypeIdentifier [contextId=EAR-1.0.0.ear, bdaId=/C:/Web Server/wildfly-10.0.0.Final/standalone/deployments/EAR-1.0.0.ear/MySystemView-1.0.0.war/WEB-INF/lib/MySystemController-1.0.0.jar, className=com.sh.controller.MySystemController, suffix=null, modified=false] 
at org.jboss.weld.annotated.slim.SlimAnnotatedType$SerializationProxy.readResolve(SlimAnnotatedType.java:60) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:497) 
at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:413) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1286) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:224) 
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1745) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1658) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1606) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:224) 
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1745) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1658) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:224) 
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1745) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1658) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:224) 
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1745) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1658) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1606) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:224) 
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1745) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1658) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:224) 
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1745) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1658) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149) 
at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135) 
at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:53) 
at org.jboss.marshalling.river.RiverObjectInputStream.readObjectOverride(RiverObjectInputStream.java:307) 
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:365) 
at java.util.HashMap.readObject(HashMap.java:1396) 
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:497) 
at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:307) 
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1637) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276) 
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209) 
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41) 
at org.wildfly.clustering.marshalling.jboss.SimpleMarshalledValue.get(SimpleMarshalledValue.java:101) 
at org.wildfly.clustering.marshalling.jboss.SimpleMarshalledValue.get(SimpleMarshalledValue.java:44) 
at org.wildfly.clustering.marshalling.jboss.MarshalledValueMarshaller.read(MarshalledValueMarshaller.java:45) 
at org.wildfly.clustering.marshalling.jboss.MarshalledValueMarshaller.read(MarshalledValueMarshaller.java:32) 
at org.wildfly.clustering.web.infinispan.session.coarse.CoarseSessionAttributesFactory.findValue(CoarseSessionAttributesFactory.java:84) 
at org.wildfly.clustering.web.infinispan.session.coarse.CoarseSessionAttributesFactory.findValue(CoarseSessionAttributesFactory.java:48) 
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionFactory.findValue(InfinispanSessionFactory.java:63) 
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionFactory.findValue(InfinispanSessionFactory.java:40) 
at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findSession(InfinispanSessionManager.java:234) 
at org.wildfly.clustering.web.undertow.session.DistributableSessionManager.getSession(DistributableSessionManager.java:140) 
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:726) 
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:756) 
at io.undertow.servlet.spec.ServletContextImpl.updateSessionAccessTime(ServletContextImpl.java:760) 
at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:557) 
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:331) 
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263) 
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) 
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174) 
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) 
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745) 
Caused by: an exception which occurred: 
in object of type org.jboss.weld.annotated.slim.SlimAnnotatedType$SerializationProxy 
in field type 
in object of type org.jboss.weld.annotated.slim.backed.BackedAnnotatedField$SerializationProxy 
in field field 
in object of type org.jboss.weld.injection.attributes.InferringFieldInjectionPointAttributes 
in field attributes 
in object of type org.jboss.weld.injection.FieldInjectionPoint 
in field injectionPoint 
in object of type org.jboss.weld.event.EventImpl$SerializationProxy 
in field events 
in object of type com.sh.controller.MySystemController 
in field instance 
in object of type org.jboss.weld.context.SerializableContextualInstanceImpl 
in object of type java.util.HashMap 

Я нашел этот вопрос здесь, на StackOverflow и говорил, что я не должен отметить мой CDI вводил beans как переходный, чтобы пропустить сериализацию, так где же проблема? мне нужно прервать ввезенные бобы?

Исходный код класса составляет более 2500 строк кода, я справляюсь здесь операторы класса:

@Named("sysControl") 
@SessionScoped 
public class MySystemController extends VenusAbstractBean implements 

BundleFiles,Serializable { 
    private static final long serialVersionUID = 9021710761540108681L; 

    private Ticket ticket; 
    private Logger log = LoggerFactory.getLogger(this.getClass()); 
    private TicketData data; 
    @Inject 
    private transient TicketingSubject subject; 
    @Inject 
    private TicketListController ticketListCont; 
    @EJB 
    private SMSHandler smsHandler; 
    @EJB 
    private TypeFacade typeFacade; 
    @EJB 
    private UsersFacade usersFacade; 
    @EJB 
    private StatusFacade statusFacade; 
    @EJB 
    private TicketFacade ticketFacade; 
    @EJB 
    private AttachmentsFacade attachementFacade; 
    @EJB 
    private SourceChannelFacade sourceFacade; 
    @EJB 
    private TicketDataFacade dataFacade; 
    @EJB 
    private LockFacade lockFacade; 
    @EJB 
    private UsersAssignedTicketsFacade ticketAssignFacade; 
    @EJB 
    private TicketHistoryFacade historyFacade; 
    @EJB 
    private UsersAssignedTicketsFacade assignedFacade; 
    @EJB 
    private EmailHandler emailHandlerFacade; 
    @EJB 
    private GlobalConfigurationFacade globalConfigFacade; 
    @EJB 
    private EscalationHistoryFacade escalationHistoryFacade; 
    @EJB 
    private EmailMessageFacade emailMessageFacade; 
    @EJB 
    private TicketDataFacade ticketDataFacade; 
    @EJB 
    private CalendarFacade calFacade; 
    @EJB 
    private EmailHistoryFacade emailHistoryFacade; 
    private boolean enableLastReplyEdit = false; 
    private MainCategory cat; 
    private SubCategory sub; 
    private Topic topic; 
    private TicketHistory history; 
    private byte[] attachment; 
    private List<String> uploadedFile; 
    private String reply; 
    private String reassignNote; 
    private Lock myLock; 
    private Status status; 
    private String mimeType; 
    private boolean enableReopen; 
    private TicketData selectedData; 
    private Long lockSeconds; 
    private boolean canbeReopened; 
    private List<Integer> reopenStatusList; 

    private Users selectedUser; 
    private String changeDeptCaller; 
    private Integer viewMode; 
    private boolean printContent; 
    private boolean printReplies; 
    private boolean printEscalation; 
    private List<Attachments> attachmentsList; 
    private List<Attachments> uploadAttachementsList;; 
    private boolean displayTimeoutMessage; 
    private List<Ticketactions> actions; 
    private Ticketactions selectedAction; 
    private TicketHoldReason holdReason; 
    private boolean skip; 
    private int assign_changeDept; 
    private boolean canSetOnHold; 
    private boolean lockRequired; 
    private List<Ticket> selectedTickets; 
    private boolean editLastRowMode; 
    private List<TicketData> ticketDataList; 

    @Inject 
    private Event<TicketEvent> events; 
    @EJB 
    private TicketEventObserver listener; 

    @EJB 
    private SLATimeCalculator slaCalc; 
    @EJB 
    private SlaFacade slaFacade; 

    @EJB 
    private EJBUtils ejbUtils; 
    private Date dueDate; 

    private Long dueDateRemainingSec; 
    } 

TicketEvent Класс

import java.util.EventObject; 

import com.sh.entity.Ticket; 

public class TicketEvent extends EventObject { 

    private static final long serialVersionUID = 1L; 
    private Ticket ticket; 
    private Object[] values; 

    public TicketEvent(Object source, Ticket ticket, Object... values) { 
     super(source); 
     this.ticket = ticket; 
     this.values = values; 
    } 

    public Ticket getTicket() { 
     return ticket; 
    } 

    public void setTicket(Ticket ticket) { 
     this.ticket = ticket; 
    } 

    public Object[] getValues() { 
     return values; 
    } 

    public void setValues(Object[] values) { 
     this.values = values; 
    } 

} 
+2

Показать код. Хрустальные шарики стоят дорого в эти дни. –

+0

@ CássioMazzochiMolin Я добавил моментальный снимок кода, класс содержит более 2500 строк кода. –

+0

AFAIK, так как Java EE 6, вы можете использовать '@ Inject' вместо' @ EJB'. Если у вас возникли проблемы с сериализацией, добавьте модификатор «переходный» к члену класса, который не может быть введен. –

ответ

0

В принципе, вы можете сделать следующее:

  • Сделайте свою фасоль опцией Serializable.

  • Добавить модификатор transient классам, которые не используют Serializable.


AFAIK, так как Java EE 6, вы можете использовать @Inject вместо @EJB при закачке CDI управляемых компонентов.

+0

Все мои классы уже реализуют сериализуемое значение, и проблема не идет с введенными классами по «коду» @ EJB, это происходит с классами, введенными «кодом» @ Inject –