Интеграция гобеленов 5.3.8 и JBoss 7.2 - PullRequest
0 голосов
/ 21 февраля 2020

Я использую сейчас JBoss 7.1 и Tapestry 5.3.8, но мне нужно обновить JBoss с 7.1 до 7.2. Проект работает очень хорошо в JBoss 7.1. Когда я запускаю проект из Eclipse, я получаю следующую ошибку на самой начальной странице (логин):

"ОШИБКА 2020-02-20 09: 19: 00,021 [default task-1] [org. apache. tapestry5.io c .Registry] | Метод net .atos.wlp.olw. gui .pages.user.Login.login () ссылается на идентификатор компонента 'loginForm', который не существует. ОШИБКА 2020-02- 20 09: 19: 00,022 [задание по умолчанию-1] [орг. apache .tapestry5.io c .Registry] | Трассировка операций: ОШИБКА 2020-02-20 09: 19: 00,022 [задание-1 по умолчанию] [ org. apache .tapestry5.io c .Registry] | [1] Создание экземпляра класса страницы net .atos.wlp.olw. gui .pages.user.Login ERROR 2020-02-20 09 : 19: 00,022 [задание по умолчанию-1] [com.awl.tapestry.ow asp .services.internal.TapestryOverrides.owaspRequestExceptionHandler] | Ow asp Обработчик исключений: произошло неожиданное исключение org. apache .tapestry5 .io c .internal.OperationException: метод net .atos.wlp.olw. gui .pages.user.Login.login () ссылается на идентификатор компонента 'loginForm', который не существует. в org. apache .tapestry5.i o c .internal.OperationTrackerImpl.logAndRethrow (OperationTrackerImpl. java: 121) в орг. apache .tapestry5.io c .internal.OperationTrackerImpl.invoke (OperationTrackerImpl. java: 88) в орг. apache .tapestry5.io c .internal.PerThreadOperationTracker.invoke (PerThreadOperationTracker. java: 87) в орг. apache .tapestry5.io c .internal.RegistryImpl.invoke (RegistryImpl. java) : 1124) at or. PageSourceImpl.getPage (PageSourceImpl. java: 104) по адресу $ PageSource_31e1f6e1f94.getPage (Неизвестный источник) по адресу org. apache .tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get (NonPoolingReefee) get (Неизвестный источник) "

Мой логин. java

package net.atos.wlp.olw.gui.pages.user;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.Response;
import org.apache.tapestry5.services.Session;

import net.atos.wlp.olw.config.ConfigAccessor;
import net.atos.wlp.olw.datamodel.rmolw.RmOLWException;
import net.atos.wlp.olw.datamodel.rmolw.RmOlwManager;
import net.atos.wlp.olw.gui.Debug;
import net.atos.wlp.olw.gui.Info;
import net.atos.wlp.olw.gui.utils.AuditGuiMessages;
import net.atos.wlp.olw.gui.utils.PciSessionHandler;
import net.atos.xa.audit.AuditService;
import net.atos.xa.audit.AuditServiceProvider;
import net.atos.xa.rm.api.RMMaintainer;
import net.atos.xa.rm.api.user.UserSelector;
import net.atos.xa.rm.app.feature.accountstate.LockedByAdminException;
import net.atos.xa.rm.app.feature.calendar.AccessCalendarException;
import net.atos.xa.rm.app.feature.counter.BurntAuthenticationException;
import net.atos.xa.rm.app.feature.counter.CounterConfForUser;
import net.atos.xa.rm.app.feature.otp.OtpExpiredException;
import net.atos.xa.rm.app.feature.periodicchange.CredentialExpiredException;

@Import(stylesheet = "classpath:styles/Login.css")
public class Login {

    @SessionState(create = false)
    @Property
    private String loginmessage;

    @Property
    private String loginMessageOutput;

    @Inject
    private Messages messages;

    @Inject
    private Request request;

    @Inject
    private Response response;

    @Inject
    private org.apache.tapestry5.services.Cookies cookie;

    private Subject currentUser;

    private RMMaintainer rm;

    /**
     * Use to store the current user login
     */
    @Property
    @Persist
    @Validate("required")
    private String userName;

    @Inject
    private RmOlwManager rmOLWManager;
    /**
     * Use to store the password of the current user
     */
    @Property
    @Validate("required")
    private String password;

    @Inject
    private HttpServletRequest httpRequest;

    @AfterRender
    void afterRender() {
        // we force a new session after each login
        // see also discussion
        // http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/change-session-id-after-login-td3217239.html
        final Session session = request.getSession(false);
        if (session != null) {
            session.invalidate();
        }

        // I think this never worked - in the Jira it is described to use
        // the configuration of tomcat!
        final String jSessionId = cookie.readCookieValue("JSESSIONID");
        // cookie.removeCookieValue("JSESSIONID");
        final String path = request.getContextPath();
        response.setHeader("SET-COOKIE", "JSESSIONID=" + jSessionId + "; path=" + path + "/; SECURE; HttpOnly");
    }

    public String getInstallInfo() {
        // read the 'InstallationInfo' from the configuration file 'wlp-olw.xml'
        return ConfigAccessor.getInstance().getConfig().getGeneral().getInstance().getInstallationInfo();
    }

    public String getVersionInfo() {
        // read the 'showVersion' from the configuration file 'wlp-olw.xml'
        final boolean showVersion = ConfigAccessor.getInstance().getConfig().getGeneral().getInstance().isShowVersion();
        if (showVersion) {
            return messages.get("common.version.text");
        } else {
            return "";
        }
    }

    @OnEvent(value = EventConstants.SUCCESS, component = "loginForm")
    Object login() {

        /* Gets a non secured RMMaintainer */
        rm = new RMMaintainer(false);

        if (Debug.isDebugEnabled()) {
            Debug.DEFAULT.format(this, "Login data are submitted...");
        }

        Class nextPage = null;

        currentUser = SecurityUtils.getSubject();

        final AuditService auditService = AuditServiceProvider.getAuditService();

        final AuditGuiMessages auditMessages = auditService.getAuditor(AuditGuiMessages.class);

        if (currentUser != null && !currentUser.isAuthenticated()) {

            try {

                final UserSelector userSelector = rm.user().select().withName(userName);

                if (userSelector.get() != null) {

                    boolean isLockedByCounter = false;

                    final CounterConfForUser conf = userSelector.counter();
                    if (conf != null) {
                        final Integer counter = rm.user().select().withName(userName).counter().getCounter();
                        if (counter != null) {
                            isLockedByCounter = counter <= 0;
                        }
                    }

                    if (isLockedByCounter) {
                        throw new BurntAuthenticationException("Locked by counter");
                    }

                    if (rm.user().select().withName(userName).accountState().getAccountState()) {
                        throw new LockedByAdminException("User locked by admin");
                    }

                    final UsernamePasswordToken token = new UsernamePasswordToken(userName, password);

                    final org.apache.shiro.mgt.SecurityManager sm = SecurityUtils.getSecurityManager();

                    // currentUser.getSession().getId()
                    currentUser.login(token); 
                    if (currentUser.isAuthenticated()) {
                        /* Attention: Here the API is not consistent (or I did not find the correct entry point)
                         * We can get the principal which is a unique identifier for the user but only as an Object.
                         * At other places in the API we get an Principal object and the call the UUID method.
                         * It seems that we are here always getting the String of the UUID as return object. 
                         */                     
                        String prnUuid = (String) currentUser.getPrincipal();
                        try {
                            rmOLWManager.updateLastLogin(prnUuid, request.getRemoteHost());
                        } catch (RmOLWException e) {
                            net.atos.wlp.olw.gui.Error.E0064.format(this, prnUuid, e);
                        }

                        nextPage = net.atos.wlp.olw.gui.pages.Index.class;
                        if (userSelector.otp().isOtp()) {
                            loginmessage = "Your password is valid only for this session. Please change it immediately.";
                            nextPage = net.atos.wlp.olw.gui.pages.user.ChangePassword.class;
                        } else if (userSelector.periodicChangeCredential().getPrewarnDay() != null) {
                            if (userSelector.periodicChangeCredential().getPrewarnDay() < 1) {
                                loginmessage = "Your password is expired. Please change it immediately.";
                                nextPage = net.atos.wlp.olw.gui.pages.user.ChangePassword.class;
                            } else {
                                loginmessage = "Your password will expire in "
                                        + userSelector.periodicChangeCredential().getPrewarnDay() + " days";
                            }
                        }
                    }
                } else {
                    Info.I0030.format(this, userName, httpRequest.getRemoteAddr());
                    throw new AuthenticationException("User not found.");                   
                }
            } catch (final LockedByAdminException e) {
                loginmessage = "The account for this user name has been locked. Please contact the administration of this system.";
                auditMessages.loginDenied(userName, new Date(), e.getLocalizedMessage());
                Info.I0022.format(this, userName,httpRequest.getRemoteAddr());
            } catch (final OtpExpiredException e) {
                loginmessage = "The one time password is expired.";
                auditMessages.loginDenied(userName, new Date(), e.getLocalizedMessage());
                Info.I0023.format(this, userName, httpRequest.getRemoteAddr());
            } catch (final BurntAuthenticationException e) {
                loginmessage = "The account is locked due too many failed login attempts."; 
                auditMessages.loginDenied(userName, new Date(), e.getLocalizedMessage());
                Info.I0024.format(this,  userName,httpRequest.getRemoteAddr());
            } catch (final CredentialExpiredException e) {
                loginmessage = "The password is expired.";
                auditMessages.loginDenied(userName, new Date(), e.getLocalizedMessage());
                Info.I0025.format(this, userName,httpRequest.getRemoteAddr());
            } catch (final AccessCalendarException e) {
                loginmessage = "The access calendar does not allow a login currently.";
                auditMessages.loginDenied(userName, new Date(), e.getLocalizedMessage());
                Info.I0026.format(this,  userName,httpRequest.getRemoteAddr());
            } catch (final AuthenticationException e) {
                loginmessage = messages.get("Login.error.Fail");
                auditMessages.loginDenied(userName, new Date(), e.getLocalizedMessage());
                Info.I0027.format(this, userName,httpRequest.getRemoteAddr());
            } catch(net.atos.xa.rm.api.NotFoundException e)
            {
                loginmessage = messages.get("Login.error.Fail");
                auditMessages.loginDenied(userName, new Date(), e.getLocalizedMessage());
                Info.I0028.format(this, userName,httpRequest.getRemoteAddr());
            }

        } else {
            loginmessage = "You are already logged in.";
            nextPage = net.atos.wlp.olw.gui.pages.Index.class;
        }

        if (currentUser != null && currentUser.isAuthenticated() && currentUser.getPrincipal() != null) {
            auditMessages.loginSucceeded(currentUser.getPrincipal().toString(), new Date());
            Info.I0029.format(this, userName, httpRequest.getRemoteAddr());

            PciSessionHandler.getInstance().addSession(userName, null, httpRequest.getSession().getId(),
                    httpRequest.getRemoteAddr());
        }

        return nextPage;

    }

    @OnEvent("activate")
    public Object onActivate() {

        if (loginmessage != null) {
            loginMessageOutput = loginmessage;
            loginmessage = null;
        }

        final Class nextPage = null;

        return nextPage;
    }

}

Мой логин.tml:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" p:title="OnlineWatcher Login"
    xml:lang="en" lang="en"
    xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
    xmlns:p="tapestry:parameter">
    <head>
        <title>${message:common.title.text}</title>
        <link href="${asset:classpath:/imgs/favicon.ico}" rel="shortcut icon" />
        <meta http-equiv="Content-Type"
            content="text/html; charset=utf-8" />
        <meta name="copyright" content="Atos Worldline" />
        <meta name="author" content="PPC" />
    </head>

    <body>

        <!-- Framekiller -->
        <style> html{display:none;} </style>
        <script>
            if(self == top) {
                document.documentElement.style.display = 'block'; 
            } else {
                top.location = self.location; 
            }
        </script>

        <h1>
          <img src="${asset:classpath:/imgs/logo_login.png}"
                width="150"
                alt="${message:Layout.text.img.alt.applicationName}" 
                id="logo"/>
        </h1>
        <div id="wrapper">
            <h2>${message:Login.text.p.welcome}</h2>
            <p class="intro">${message:Login.text.p.welcomedetail}</p>

            <t:form t:id="loginForm">
                <fieldset>

                    <p>
                        <t:label for="userName">
                            ${message:Login.text.label.login}
                        </t:label>
                        <input type="text" t:type="TextField"
                            t:id="userName" id="userName" name="userName" t:value="userName" tabindex="1" />
                    </p>

                    <p>
                        <t:label for="password">
                            ${message:Login.text.label.password}
                        </t:label>
                        <input type="password" t:type="PasswordField" autocomplete="off"
                            t:id="password" id="password" name="password" t:value="password" tabindex="2" />
                    </p>

                    <!-- 
                    <p class="pForgpwd">
                        <a href="lostpwd">
                            ${message:Login.text.a.forgotpasswd}
                        </a>
                    </p>
                     -->

                    <p>
                        <input type="submit" t:type="submit"
                            t:id="submitButton" title="Enter" tabindex="3" value="${message:Login.text.input.submitButton}"/>
                    </p>

                </fieldset>
                <!-- ERROR MESSAGE ZONE -->
                <p id="ferrorlg">${loginMessageOutput}</p>
            </t:form>

            <p class="installinfo">
               <t:outputRaw value="installinfo" t:mixins="FilterHtml"/>
            </p>
            <p class="certification"> 
               <a href="http://www.legalis.net/cgi-iddn/certificat.cgi?IDDN.FR.010.0118219.000.R.X.2012.035.30000" title="Visit IDDN Site"> 
                     <img src="${asset:classpath:/imgs/iddn_66.gif}" alt="IDDN : All rights protected" />
               </a>               
            </p> 

            <p id="cprgthp">&copy; ${message:Login.text.p.copyright}</p>
        </div>

    </body>
</html>

Можете ли вы пожалуйста предоставить или предложить какое-либо решение?

...