исключение запуска службы install4j - PullRequest
0 голосов
/ 27 июня 2018

Я создал новую итерацию приложения, используя install4j v5.1.15 . После установки приложение запускает службу Windows, которая имеет несколько шагов, чтобы попытаться нажать несколько URL-адресов, чтобы получить обновления или убедиться, что доступны другие конфигурации.

Все, что я получаю, это следующее исключение после завершения установки (используется режим отладчика). Можно ли как-то настроить программу установки для выдачи дополнительной информации ( либо указать, к какому URL он обращается ), я убедился, что все URL добавлены, как присутствующие в Доступен файл .install4j.

Что еще я могу попробовать?

[INFO] com.install4j.runtime.beans.screens.BannerFormScreen [ID 1202]: Show screen
[INFO] com.install4j.runtime.beans.actions.control.RunScriptAction [ID 1203]: Execute action
Property script: I4jScript_Internal_97
Property rollbackSupported: false
Property rollbackScript: null
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at I4jScript_Internal_97$1.execute(I4jScript_Internal_97.java:68)
at com.install4j.runtime.installer.ContextImpl.runElevatedInt(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runElevated(Unknown Source)
at I4jScript_Internal_97.eval(I4jScript_Internal_97.java:34)
at I4jScript_Internal_97.evaluate(I4jScript_Internal_97.java:99)
at com.install4j.runtime.installer.helper.Script.evaluate(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runScript(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runScript(Unknown Source)
at com.install4j.runtime.beans.actions.control.RunScriptAction.execute(Unknown Source)
at com.install4j.runtime.beans.actions.SystemInstallOrUninstallAction.install(Unknown Source)
at com.install4j.runtime.installer.InstallerContextImpl$2.fetchValue(Unknown Source)
at com.install4j.runtime.installer.helper.comm.actions.FetchObjectAction.execute(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionDirect(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionInt(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionChecked(Unknown Source)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.fetchObjectChecked(Unknown Source)
at com.install4j.runtime.installer.InstallerContextImpl.performActionIntStatic(Unknown Source)
at com.install4j.runtime.installer.InstallerContextImpl.performActionInt(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.performAction(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.executeActions(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.handleCommand(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.start(Unknown Source)
at com.install4j.runtime.installer.Installer.runInProcess(Unknown Source)
at com.install4j.runtime.installer.Installer.main(Unknown Source)

Edit-1: @ Инго Кегель Добавление сценария, который, по моему мнению, не работает:

//Get the "Click Finish to start..." label and update the text once the application is starting.
Screen otherScreen = context.getScreenById("1202");

FormEnvironment otherFormEnvironment = ((FormPanelContainer)otherScreen).getFormEnvironment();
FormComponent finishLabel = otherFormEnvironment.getFormComponentById("1207");

((JLabel)finishLabel.getConfigurationObject()).setText(context.getMessage("Please.Be.Patient.While.Application.Name.Is.Starting"));

//Start spinning the progress bar
context.getProgressInterface().setIndeterminateProgress(true);

//Get a handle on the port the user chose
final Long port = (Long)context.getVariable("user.specified.port");

//It's necessary to run this task elevated, otherwise install4j can have permissions issues and throw exceptions.
//See: http://blog.ej-technologies.com/2012/06/migrating-to-install4j-51.html
Boolean result = (Boolean)context.runElevated(new RemoteCallable() 
{
    public Serializable execute() 
    {
        int numRetries = 50;
        int retries = 0;

        java.net.URL url = null;

        try
        {
            url = new java.net.URL("http", "localhost", port.intValue(), "");
        }
        catch (java.net.MalformedURLException mue)
        {
            //If something goes wrong, return false.
            return false;
        } 

        while(retries < numRetries)
        {
            try
            {
                Thread.sleep(5000);
            }
            catch(InterruptedException ie)
            {
                return false;
            }

            try 
            {
                java.net.HttpURLConnection connection = (java.net.HttpURLConnection)url.openConnection();

                int responseCode = connection.getResponseCode(); 

                if (responseCode == java.net.HttpURLConnection.HTTP_OK) 
                {
                    return true;
                }
                else
                {     
                    retries++;
                }
            } 
            catch (Throwable t) 
            {
                t.printStackTrace();

                retries++;
            }
        }

        //We did not successfully find an application running on the port.
        return false;
    }
}, true);

context.getProgressInterface().setIndeterminateProgress(false);

return result;

1 Ответ

0 голосов
/ 01 августа 2018

Предоставление обновления, так как было обнаружено, что основная причина не связана с инструментом install4j.

Баночка, которую я использовал для упаковки устанавливаемого объекта, была недействительной. Недавно мы обновили версии плагинов maven. Более новая версия изменила способ упаковки нашего jar-файла, что не позволило сервису начать установку после установки.

Я все еще получаю ту же ошибку, что и в первоначальном сообщении, но не уверен в источнике (пока я ее игнорирую).

...