Is it possible to restart a Java application Service with install4j ?
I need to change some configurations in the application and then restart it in unattended mode using the api. (Not doing the complete install or update)
I found this answer that would work if the application is not a service: https://stackoverflow.com/a/65777281/150566
I tried to do the same thing using a Custom Application but using Service call like this:
I've also tried without the request privileges and without sleep with same result or using the stop service commandHalf of it works. The service stops but the Service never restart.
Is there something missing so that the service can start again ? Is there other alternative ?
Updated info:
The config is changed as mentioned to stop the service instead of ShutDown calling launcher:
When using debug as mentioned by Ingo Kegel those output are the result:
Called from mylauncher Service with the Api (not working):
[INFO] com.install4j.runtime.beans.actions.services.StopServiceAction [ID 147]: Execute action
Property executable: null
Property launcherId: 36
Property serviceName: null
Property windowsStopMinimumWaitTime: 30000
Property rollbackSupported: true
usedExecutable: C:\MyInstaller\mylauncher.exe
Stop minimum wait time: 30000
Called from command line (working):
[INFO] com.install4j.runtime.beans.actions.services.StopServiceAction [ID 147]: Execute action
Property executable: null
Property launcherId: 36
Property serviceName: null
Property windowsStopMinimumWaitTime: 30000
Property rollbackSupported: true
usedExecutable: C:\MyInstaller\mylauncher.exe
Stop minimum wait time: 30000
previous state true
Execute action successful after 519 ms
[INFO] com.install4j.runtime.beans.actions.services.StartServiceAction [ID 148]: Execute action
Property executable: null
Property launcherId: 36
Property serviceName: null
Property autostartOnly: false
Property rollbackSupported: true
usedExecutable: C:\MyInstaller\mylauncher.exe
previous state false
Execute action successful after 44 ms
[INFO] com.install4j.runtime.beans.screens.StartupScreen [ID 131]: command: move 1 screens, executing actions, checking condition
[INFO] cleaning up
[INFO] Finished at 2023-02-06 15:06:06
(I've also tried without the request privileges and without sleep with same result or using the stop service command)
Instead of "Shutdown calling launcher" you need the "Stop a service" action. Also, for unattended mode, you don't need the "Finish" screen, you can add all actions to the "Startup" node.
To check if there is a problem, start the executable of the custom application from the command line with the argument -Dinstall4j.log=<path to writable log file.txt> and check the log file.
Related
I am trying to run an API script in Tabpy but it takes over the default (30 seconds) to run. I found in the Tabpy documentation the command to change the timeout.
I used (base) PS E:\Users\Mitchell_Leon> tabpy --config E:\Users\Mitchell_Leon\tabpy.conf which contains a config file in accordance with the Tabpy documentation
[TabPy]
TABPY_EVALUATE_TIMEOUT = 30000
Which gave DEBUG:tabpy.tabpy_server.app.app:Parameter evaluate_timeout set to "30000.0" from config file or environment variable
When I attempted to run the script again I received the same error.
2022-03-29,11:20:54 [ERROR] (base_handler.py:base_handler:115): User defined script timed out. Timeout is set to 30 s.
When I try to deploy package on SAM, the very first status comes in cloud formation console is ROLLBACK_IN_PROGRESS after that it gets changed to ROLLBACK_COMPLETE
I have tried deleting the stack and trying again, but every time same issue occurs.
Error in terminal looks like this-
Sourcing local options from ./SAMToolkit.devenv
SAM_PARAM_PKG environment variable not set
SAMToolkit will operate in legacy mode.
Please set SAM_PARAM_PKG in your .devenv file to run modern packaging.
Run 'sam help package' for more information
Runtime: java
Attempting to assume role from AWS Identity Broker using account 634668058279
Assumed role from AWS Identity Broker successfully.
Deploying stack sam-dev* from template: /home/***/1.0/runtime/sam/template.yml
sam-additional-artifacts-url.txt was not found, which is fine if there is no additional artifacts uploaded
Replacing BATS::SAM placeholders in template...
Uploading template build/private/tmp/sam-toolkit.yml to s3://***/sam-toolkit.yml
make_bucket failed: s3://sam-dev* An error occurred (BucketAlreadyOwnedByYou) when calling the CreateBucket operation: Your previous request to create the named bucket succeeded and you already own it.
upload: build/private/tmp/sam-toolkit.yml to s3://sam-dev*/sam-toolkit.yml
An error occurred (ValidationError) when calling the DescribeStacks operation: Stack with id sam-dev* does not exist
sam-dev* will be created.
Creating ChangeSet ChangeSet-2020-01-20T12-25-56Z
Deploying stack sam-dev*. Follow in console: https://aws-identity-broker.amazon.com/federation/634668058279/CloudFormation
ChangeSet ChangeSet-2020-01-20T12-25-56Z in sam-dev* succeeded
"StackStatus": "REVIEW_IN_PROGRESS",
sam-dev* reached REVIEW_IN_PROGRESS
Deploying stack sam-dev*. Follow in console: https://console.aws.amazon.com/cloudformation/home?region=us-west-2
Waiting for stack-create-complete
Waiter StackCreateComplete failed: Waiter encountered a terminal failure state
Command failed.
Please see the logs above.
I set SQS as event source for Lambda, but didn't provided the permissions like this
- Effect: Allow
Action:
- sqs:ReceiveMessage
- sqs:DeleteMessage
- sqs:GetQueueAttributes
Resource: "*"
in lambda policies.
I found this error in "Events" tab of "CloudFormation" service.
We have configured an auto-updater to our service using the ‘updater-with-silent-version-check’ and using the unattended mode.
When we invoked the Updater.exe, it failed with the below error. When we invoked it again, it successfully downloaded the new version from the same URL and upgraded to next version.
What could be the probable reason for the earlier failure?
we passed the URL to the Updater as an argument : -VpatchAgentUpdatesUrl=https://xxxx.company.com:8443/updater-service/updates.xml
[ERROR] com.install4j.runtime.beans.actions.update.CheckForUpdateAction [ID 190]: could not download file
java.net.MalformedURLException: no protocol:
java.net.MalformedURLException: no protocol:
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.install4j.runtime.installer.helper.content.HttpRequestHandler.connect(HttpRequestHandler.java:120)
at com.install4j.runtime.installer.helper.content.Downloader.connect(Downloader.java:152)
at com.install4j.runtime.installer.helper.content.Downloader.connect(Downloader.java:25)
at com.install4j.runtime.installer.helper.content.HttpRequestHandler.connect(HttpRequestHandler.java:116)
----Update-----
We are passing the updater URL through command line argument to the Updater.exe.
We did the below changes.
1) In the Installer -> Auto-update options, 'URL for updates.xml' option is set to empty.
2) In the Installer -> Screens & Actions -> 'Updater with silent version check' , defined an installer variable 'updatesUrl' with value as ${compiler:sys.updatesUrl}
3) In the Installer -> Screens & Actions -> 'Updater with silent version check' -> Start up -> Check for Update -> set the 'Update Description Url' as ${installer:updatesUrl}
4) Invoking the Updater.exe with option -VupdatesUrl=https://xxxx.company.com/updater-service/updates.xml
Sometimes it’s working fine with the proper URL and sometimes its failed and URL field is shown as empty in the updater log.
Below is the properties shown in the updater log in the error case.
[INFO] com.install4j.runtime.beans.actions.update.CheckForUpdateAction [ID 190]: Execute action
Property variable: updateDescriptor
Property showError: true
Property rollbackSupported: false
Property connectTimeout: 10000
Property readTimeout: 20000
Property url:
Property askForProxy: true
Property acceptAllCertificates: false
Property connectionFailureScript: null
Property requestHeaders: []
I'm attempting to start and stop an application on a single JVM via the wsadmin console since the Web UI for IBM BPM PS Adv. doesn't allow for that kind of operation. So, I have the following script:
https://gist.github.com/predatorian3/b8661c949617727630152cbe04f78d7e
and when I run it against the DMGR from the Cell Host, I receive the following errors.
[wasadmin#server01 ~]$ cat /usr/local/bin/Run_wsadmin.sh
#!/bin/bash
#
#
#
/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython -user serviceAccount -password password $*
[wasadmin#cessoapscrt00 ~]$ time Run_wsadmin.sh -f /opt/IBM/wsadmin/wsadmin_Restart_Application.py WPS00 CRT00WPS01 redirectResource_war
WASX7209I: Connected to process "dmgr" on node CRTDMGR using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[WPS00, CRT00WPS01, redirectResource_war]"
WASX7017E: Exception received while running file "/opt/IBM/wsadmin/wsadmin_Restart_Application.py"; exception information: com.ibm.websphere.management.exception.ConnectorException
org.apache.soap.SOAPException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Read timed out; targetException=java.net.SocketTimeoutException: Read timed out]
real 3m21.275s
user 0m17.411s
sys 0m0.796s
So, I'm not specifying the connection types, and using the default, which is SOAP. However, upon reading about the other Connection Types, none of them seem any better, but I attribute that to IBM Documentation vagueness. Is there an option to increase the timeout wait periods, or turn it off, or is there a better connection type?
Also running this directly on the wsadmin console, it seems that it is hanging up on gathering the application manager string.
[wasadmin#server01 ~]$ Run_wsadmin.sh
WASX7209I: Connected to process "dmgr" on node CRTDMGR using SOAP connector; The type of process is: DeploymentManager WASX7031I: For help, enter: "print Help.help()"
wsadmin>appManager = AdminControl.queryNames('cell=CRTCELL,node=WPS00,type=ApplicatoinManager,process=CRT00WPS01,*')
WASX7015E: Exception running command: "appManager = AdminControl.queryNames('cell=CRTCELL,node=WPS00,type=ApplicationManager,process=CRT00WPS01,*')"; exception information:
com.ibm.websphere.management.exception.ConnectorException
org.apache.soap.SOAPException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Read timed out; targetException=java.net.SocketTimeoutException: Read timed out]
wsadmin>
You can increase timeout value in {profile}/properties/soap.client.props
com.ibm.SOAP.requestTimeout=180
If you want to turn off timeout, modify com.ibm.SOAP.requestTimeout=0
Or if you want longer timeout you can modify the value 180 to something else.
Also about your query command, I noticed that you have a typo on the MBean type, you had type=ApplicatoinManager, it should be type=ApplicationManager
HERE YOU GO -- I had the same issue. I want to override the timeout prop temporarily. This worked like a champ. Make sure you follow below steps exactly.I did some mistakes and the prop did not passed, I figured out and it works.
Copy the soap.client.props file from /properties and give it a new name such as mysoap.client.props.
Edit mysoap.client.props and update the value of com.ibm.SOAP.requestTimeout as required
Create a new Java properties file soap_override.props and enter the following line:
com.ibm.SOAP.ConfigURL=file:/mysoap.client.props
Pass soap_override.props into wsadmin using the -p option: wsadmin -p soap_override.props...
REFERENCE:
https://www.ibm.com/developerworks/community/blogs/timdp/entry/avoiding_wsadmin_request_timeouts_the_neat_way32?lang=en
Steps to reproduce.
List the existing instances:
> sqllocaldb info
v11.0
Stop the instance with the specified name:
> sqllocaldb stop "v11.0"
Stop of LocalDB instance "v11.0" failed because of the following error:
The specified LocalDB instance does not exist.
The results are contradictory. How can it exist in the first command and then not exist in the second?
Try using
sqllocaldb stop v11.0
without quotes. It should work.
Are you using Visual Studio Tools? If not, try using it.
EDIT:
It also works if you user an admin command prompt and type:
cmd.exe /C sqllocaldb p "v11.0"
I know this is old, but since I stumbled upon it, I will add this answer in addition to Tiago Cachinho's.
The command sqllocaldb info will also show stopped instances. Try adding the name of the instance to get more information:
>sqllocaldb info v11.0
Name: v11.0
Version: 11.0.7001.0
Shared name:
Owner: me
Auto-create: Yes
State: Stopped
Last start time: 1/25/2020 3:40:46 PM
Instance pipe name: