Apache Http & Clustered Java EE Приложение с Wildyfly 10.1 - PullRequest
0 голосов
/ 30 января 2020

Я пытаюсь запустить кластер с 2 узлами wildyfly 10.1, работающими в автономном режиме. xml Автономный режим с 3 развернутыми модулями в каждом:

  1. EJB_EAR.ear, Singleton_EJB_EAR.ear, Web_EAR.ear развернуты с двумя узлами

, и у меня есть еще один модуль с именем Web_Resources.war, развернутый в Apache24Http.

UserSessionBean не распределяется между двумя узлы, когда я выхожу из одного узла, другой узел не продолжает обслуживать пользователя, и когда я удаляю веб-EAR из развертывания или выключаю любой узел, я получаю следующее исключение

ERROR [io.undertow.request] (default task-17) UT005023: Exception handling request to /royal/underwriting/property/fire/find/edit: org.jboss.weld.exceptions.WeldException: WELD-001500: Fa
iled to deserialize proxy object with beanId WELD%ManagedBean%Insurance_Web_EAR.ear|/D:/Servers/wildfly-10.1.0.Final_node2/bin/content/Insurance_Web_EAR.ear/Insurance_Web.war|com.asset.insurance.web.s
ession.UserSessionBean|null|false
        at org.jboss.weld.bean.proxy.util.SerializableClientProxy.readResolve(SerializableClientProxy.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:498)
        at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:415)
        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.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:425)
        at java.util.HashMap.readObject(HashMap.java:1412)
        at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:309)
        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:79)
        at org.wildfly.clustering.web.infinispan.session.coarse.CoarseSessionAttributesFactory.findValue(CoarseSessionAttributesFactory.java:48)
        at org.wildfly.clustering.web.infinispan.session.InfinispanSessionFactory.findValue(InfinispanSessionFactory.java:61)
        at org.wildfly.clustering.web.infinispan.session.InfinispanSessionFactory.findValue(InfinispanSessionFactory.java:38)
        at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findSession(InfinispanSessionManager.java:233)
        at org.wildfly.clustering.web.undertow.session.DistributableSessionManager.getSession(DistributableSessionManager.java:148)
        at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:772)
        at io.undertow.servlet.spec.HttpServletRequestImpl.getSession(HttpServletRequestImpl.java:370)
        at org.jboss.weld.servlet.SessionHolder.requestInitialized(SessionHolder.java:47)
        at org.jboss.weld.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:234)
        at org.jboss.weld.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:152)
        at io.undertow.servlet.core.ApplicationListeners.requestInitialized(ApplicationListeners.java:246)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:291)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: an exception which occurred:
        in object of type org.jboss.weld.bean.proxy.util.SerializableClientProxy
        in field userSessionBean
        in object of type com.asset.insurance.web.session.UserSessionBean
        in field instance
        in object of type org.jboss.weld.context.SerializableContextualInstanceImpl
        in object of type java.util.HashMap

My UserSessionBean:

    package com.asset.insurance.web.session;

import java.io.Serializable;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

import javax.annotation.PreDestroy;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

import com.asset.insurance.calculations.InsuranceBigDecimal;
import com.asset.insurance.logging.Log;
import com.asset.insurance.pojos.admin.InsuranceModule;
import com.asset.insurance.pojos.admin.MenuItem;
import com.asset.insurance.pojos.admin.User;
import com.asset.insurance.vo.admin.LimitVO;
import com.asset.insurance.vo.admin.UserAccessRightsVO;
import com.asset.insurance.web.common.BaseBean;
import com.asset.insurance.web.common.delegate.CommonBusinessDelegate;
import com.asset.insurance.web.constants.WebConstants;

@Named("userSessionBean")
@SessionScoped
public class UserSessionBean extends BaseBean implements Serializable {

    private static final long serialVersionUID = 1L;

    private transient ResourceBundle commonErrorsBundle;
    private transient ResourceBundle commonWarningBundle;
    private transient ResourceBundle commonSuccessBundle;

    private transient ResourceBundle moduleErrorsBundle;
    private transient ResourceBundle moduleWarningBundle;
    private transient ResourceBundle moduleSuccessBundle;

    private Locale locale = new Locale(WebConstants.DEFAULT_LANGUAGE);

    /* Menu and modules part */
    private User user;

    private Long currentMenuItemId;
    private Long currentParentMenuItemId;
    private InsuranceModule currentModule;

    private MenuItem currentMenuItem;

    private List<InsuranceModule> userModules;
    /* End of menu and modules part */

    private UserAccessRightsVO userAccessRights;

    private List<String> breadCrumb;

    private CommonBusinessDelegate commonBusinessDelegate = new CommonBusinessDelegate();

    @PreDestroy
    public void sessionDestroyed() {

        try {

            // Audit logout Asynchronous
            CompletableFuture.supplyAsync((Supplier<?>) () -> {

                try {

                    commonBusinessDelegate.auditLogout(user);

                } catch (Exception e) {
                    Log.error(e.toString(), e);
                }

                return null;
            });

        } catch (Exception ex) {
            Log.error(ex.toString(), ex);
        }

    }

    public InsuranceBigDecimal getLimitAmount(LimitVO limitVO) {

        return userAccessRights.getLimits().get(limitVO);
    }

    public Locale getLocale() {

        return locale;
    }

    public void setLocale(Locale locale) {

        this.locale = locale;
    }

    public ResourceBundle getCommonErrorsBundle() {

        if (commonErrorsBundle == null) {
            commonErrorsBundle = ResourceBundle.getBundle(WebConstants.ERROR_MSGS, getLocale());
        }

        return commonErrorsBundle;
    }

    public ResourceBundle getCommonWarningBundle() {

        if (commonWarningBundle == null) {
            commonWarningBundle = ResourceBundle.getBundle(WebConstants.WARNING_MSGS, getLocale());
        }

        return commonWarningBundle;
    }

    public ResourceBundle getCommonSuccessBundle() {

        if (commonSuccessBundle == null) {
            commonSuccessBundle = ResourceBundle.getBundle(WebConstants.SUCCESS_MSGS, getLocale());
        }

        return commonSuccessBundle;
    }

    public ResourceBundle getModuleErrorBundle() {

        if (moduleErrorsBundle == null) {
            loadModuleBundle(WebConstants.ERROR_BUNDLE);
        }

        return moduleErrorsBundle;
    }

    public ResourceBundle getModuleSuccessBundle() {

        if (moduleSuccessBundle == null) {
            loadModuleBundle(WebConstants.SUCCESS_BUNDLE);
        }

        return moduleSuccessBundle;
    }

    public ResourceBundle getModuleWarningBundle() {

        if (moduleWarningBundle == null) {
            loadModuleBundle(WebConstants.WARNING_BUNDLE);
        }

        return moduleWarningBundle;
    }

    /**
     * @return the currentMenuItemId
     */
    public Long getCurrentMenuItemId() {

        return currentMenuItemId;
    }

    /**
     * @param currentMenuItemId
     *            the currentMenuItemId to set
     */
    public void setCurrentMenuItemId(Long currentMenuItemId) {

        this.currentMenuItemId = currentMenuItemId;
    }

    public InsuranceModule getCurrentModule() {

        return currentModule;
    }

    public void setCurrentModule(InsuranceModule currentModule) {

        this.currentModule = currentModule;

        moduleErrorsBundle = null;
        moduleSuccessBundle = null;
        moduleWarningBundle = null;
    }

    public List<InsuranceModule> getUserModules() {

        return userModules;
    }

    public void setUserModules(List<InsuranceModule> userModules) {

        this.userModules = userModules;
    }

    public User getUser() {

        return user;
    }

    public void setUser(User user) {

        this.user = user;
    }

    /**
     * @return the currentParentMenuItemId
     */
    public Long getCurrentParentMenuItemId() {

        return currentParentMenuItemId;
    }

    /**
     * @param currentParentMenuItemId
     *            the currentParentMenuItemId to set
     */
    public void setCurrentParentMenuItemId(Long currentParentMenuItemId) {

        this.currentParentMenuItemId = currentParentMenuItemId;
    }

    public List<String> getBreadCrumb() {

        return breadCrumb;
    }

    public void setBreadCrumb(List<String> breadCrumb) {

        this.breadCrumb = breadCrumb;
    }

    /**
     * @return the userAccessRights
     */
    public UserAccessRightsVO getUserAccessRights() {

        return userAccessRights;
    }

    /**
     * @param userAccessRights
     *            the userAccessRights to set
     */
    public void setUserAccessRights(UserAccessRightsVO userAccessRights) {

        this.userAccessRights = userAccessRights;
    }

    /**
     * @return the currentMenuItem
     */
    public MenuItem getCurrentMenuItem() {

        return currentMenuItem;
    }

    /**
     * @param currentMenuItem
     *            the currentMenuItem to set
     */
    public void setCurrentMenuItem(MenuItem currentMenuItem) {

        this.currentMenuItem = currentMenuItem;
    }

    private void loadModuleBundle(String bundleType) {

        if (currentModule.getId() == InsuranceModule.UNDERWRITING_MODULE) {

            switch (bundleType) {
            case WebConstants.ERROR_BUNDLE:
                moduleErrorsBundle = ResourceBundle.getBundle(WebConstants.UNDERWRITING_ERROR_MSGS, getLocale());
                break;

            case WebConstants.SUCCESS_BUNDLE:
                moduleSuccessBundle = ResourceBundle.getBundle(WebConstants.UNDERWRITING_SUCCESS_MSGS, getLocale());
                break;

            case WebConstants.WARNING_BUNDLE:
                moduleWarningBundle = ResourceBundle.getBundle(WebConstants.UNDERWRITING_WARNING_MSGS, getLocale());
                break;

            default:
                break;
            }

        } else if (currentModule.getId() == InsuranceModule.CLAIMS_MODULE) {

            switch (bundleType) {
            case WebConstants.ERROR_BUNDLE:
                moduleErrorsBundle = ResourceBundle.getBundle(WebConstants.CLAIMS_ERROR_MSGS, getLocale());
                break;

            case WebConstants.SUCCESS_BUNDLE:
                moduleSuccessBundle = ResourceBundle.getBundle(WebConstants.CLAIMS_SUCCESS_MSGS, getLocale());
                break;

            case WebConstants.WARNING_BUNDLE:
                moduleWarningBundle = ResourceBundle.getBundle(WebConstants.CLAIMS_WARNING_MSGS, getLocale());
                break;

            default:
                break;
            }

        } else if (currentModule.getId() == InsuranceModule.Quotation_MODULE) {

            switch (bundleType) {
            case WebConstants.ERROR_BUNDLE:
                moduleErrorsBundle = ResourceBundle.getBundle(WebConstants.Quotation_ERROR_MSGS, getLocale());
                break;

            case WebConstants.SUCCESS_BUNDLE:
                moduleSuccessBundle = ResourceBundle.getBundle(WebConstants.Quotation_SUCCESS_MSGS, getLocale());
                break;

            case WebConstants.WARNING_BUNDLE:
                moduleWarningBundle = ResourceBundle.getBundle(WebConstants.Qoutation_WARNING_MSGS, getLocale());
                break;

            default:
                break;
            }

        } else if (currentModule.getId() == InsuranceModule.ACCOUNTING_MODULE) {

            switch (bundleType) {
                case WebConstants.ERROR_BUNDLE:
                    moduleErrorsBundle = ResourceBundle.getBundle(WebConstants.ACCOUNTING_ERROR_MSGS, getLocale());
                    break;

                case WebConstants.SUCCESS_BUNDLE:
                    moduleSuccessBundle = ResourceBundle.getBundle(WebConstants.ACCOUNTING_SUCCESS_MSGS, getLocale());
                    break;

                case WebConstants.WARNING_BUNDLE:
                    moduleWarningBundle = ResourceBundle.getBundle(WebConstants.ACCOUNTING_WARNING_MSGS, getLocale());
                    break;

                default:
                    break;
            }
        } else if (currentModule.getId() == InsuranceModule.REINSURANCE_MODULE) {

            switch (bundleType) {
            case WebConstants.ERROR_BUNDLE:
                moduleErrorsBundle = ResourceBundle.getBundle(WebConstants.REINSURANCE_ERROR_MSGS, getLocale());
                break;

            case WebConstants.SUCCESS_BUNDLE:
                moduleSuccessBundle = ResourceBundle.getBundle(WebConstants.REINSURANCE_SUCCESS_MSGS, getLocale());
                break;

            case WebConstants.WARNING_BUNDLE:
                moduleWarningBundle = ResourceBundle.getBundle(WebConstants.REINSURANCE_WARNING_MSGS, getLocale());
                break;

            default:
                break;
            }

        } else if (currentModule.getId() == InsuranceModule.ADMINISTRATION_MODULE) {

            switch (bundleType) {
            case WebConstants.ERROR_BUNDLE:
                moduleErrorsBundle = ResourceBundle.getBundle(WebConstants.ADMINISTRATION_ERROR_MSGS, getLocale());
                break;

            case WebConstants.SUCCESS_BUNDLE:
                moduleSuccessBundle = ResourceBundle.getBundle(WebConstants.ADMINISTRATION_SUCCESS_MSGS, getLocale());
                break;

            case WebConstants.WARNING_BUNDLE:
                moduleWarningBundle = ResourceBundle.getBundle(WebConstants.ADMINISTRATION_WARNING_MSGS, getLocale());
                break;

            default:
                break;
            }
        }
    }
}

Кто-нибудь может помочь или поделиться любой идеей?

...