Jenkins was up and running for months without issue, as a windows service.
I did some Jenkins updates (copied a newer/later .war file to the .jenkins folder) and some windows updates also occurred. The version that I have is Jenkins 2.263.3.
I did a lot of trolling through the documentation and other StackOverflow tickets and found out that the JENKINS_HOME environmental variable was missing. I added this.
Here is what my investigation reveals.
The Java environment variable is set - see below:
C:\>java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
JENKINS_HOME environmental variable is set - see below:
C:\>echo %JENKINS_HOME%
C:\Users\XXXXX\.jenkins
The Installation was under user XXXXX and the service account Log On was configured accordingly
I do not have another application using port 8080 - I checked this with sys internals.
My jenkins.xml looks like this:
<service>
<id>jenkins</id>
<name>Jenkins</name>
<description>This service runs Jenkins automation server.</description>
<env name="JENKINS_HOME" value="%BASE%"/>
<!--
if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
The following value assumes that you have java in your PATH.
-->
<executable>java</executable>
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
<!--
interactive flag causes the empty black Java window to be displayed.
I'm still debugging this.
<interactive />
-->
<logmode>rotate</logmode>
<onfailure action="restart" />
<!--
In the case WinSW gets terminated and leaks the process, we want to abort
these runaway JAR processes on startup to prevent corruption of JENKINS_HOME.
So this extension is enabled by default.
-->
<extensions>
<!-- This is a sample configuration for the RunawayProcessKiller extension. -->
<extension enabled="true"
className="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension"
id="killOnStartup">
<pidfile>%BASE%\jenkins.pid</pidfile>
<stopTimeout>10000</stopTimeout>
<stopParentFirst>false</stopParentFirst>
</extension>
</extensions>
<!-- See the referenced examples for more options -->
</service>
I can start Jenkins from the command line as follows:
java -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Users\XXXXX\.jenkins\jenkins.war" --httpPort=8080 --webroot="C:\Users\XXXXX\.jenkins\war
If I try start it from the Serice Manager I get this error - System.BadImageFormatException
One last thing, once I start Jenkins from the command line, and login to the the application, I note the following Jenkins System log:
Feb 17, 2021 10:29:31 AM INFO hudson.WebAppMain$3 run
Jenkins is fully up and running
Feb 17, 2021 10:29:57 AM WARNING hudson.lifecycle.WindowsServiceLifecycle getBaseDir
Could not find environment variable 'BASE' for Jenkins base directory. Falling back to JENKINS_HOME
Any suggestions how to get the service to start via the Service Manager?
The service is starting and stopping without issue.
The problem I suspect was that the original install of Jenkins was very old, and I presume that it may have been a 32-bit application at the time. The current updates seem to 64-bit apps. Since the original install, Jenkins was updated - with changes spanning several major releases from the original install (.war file updates). The jenkins.exe file - that starts the service was never updated.
The error message 'System.BadImageFormatException' after much research indicated that the issue was related to compatibility difference between 32/64 bit executable. I presume it was expecting a 64-bit executable but was getting a 32-bit exe.
To solve this problem I installed the latest version of Jenkins on my local PC.
On the Server I backed up the files:
jenkins.exe
jenkins.exe.config
I then stopped Jenkins on the Server, where the Service was not Starting (from the terminal window with Ctrl+D).
I then replaced these 2 files on the server with the latest files from my local installation.
Service started the first time.
We upgraded to Grails 4 / Java 11 and lost hot-swapping capabilities during development. I tried DCEVM but the application wouldn't start (errors on first withNewSession call).
Has anyone had success with getting Grails and DCEVM to work together?
I've got hotswap working with Grails 5.1.2 but the Hibernate plugin causes a
org.hibernate.HibernateException: No Session found for current thread
so I had to disable the plugin. This means any changes to domain classes will still need a restart.
You'll need a copy of groovyReset.jar to avoid random errors due to Groovy caching methods that have been replaced by hotswap.
sdk install java 11.0.9-trava
sdk use java 11.0.9-trava
Add a copy of groovyReset.jar to your project root
Add the following to the bootRun jvmArgs in build.gradle:
'-XX:HotswapAgent=fatjar',
'-javaagent:groovyReset.jar'
Create src/main/resources/hotswap-agent.properties containing:
disabledPlugins=Hibernate
autoHotswap=true
You should now be able to start Grails and any code changes will be picked up without restarting.
Recently I tried with Hybris2005 + Java 11 + Windows + Eclipse.
Follow below given steps and do modification as per your need.
DCEVM 11 Configuration Step.
Download and extract java11-openjdk-dcevm-windows.zip in your local machine
Set JAVA_HOME=D:\java11-openjdk\dcevm-11.0.10+3 (Adjust the path as per location in your system)
In eclipse go to windows->Preference->Installed JRE and set JRE home to D:\java11-openjdk\dcevm-11.0.10+3
4 In local.properties adjust the property tomcat.debugjavaoptions as below
tomcat.debugjavaoptions=-XX:HotswapAgent=core -javaagent:D:/java11-openjdk/dcevm-11.0.10+3/lib/hotswap/hotswap-agent.jar=disablePlugin=Log4j2,disablePlugin=Spring,disablePlugin=Proxy,disablePlugin=AnonymousClassPatch,disablePlugin=ZK,autoHotswap=true -Djava.locale.providers=COMPAT,CLDR -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n -Xmx4G -Xms2G
Also, please set ANT_HOME environemnt variable so that we don't to run setantenv.bat from \hybris\bin\platform and update the PATH variable accordingly.
Perform ant clean all and start hybris in debug mode.
Add System.out.println() statement in your code and then execute ant build command from that specific extension folder.
Verify if HOT swap is done.
I am trying to install Weblogic adminserver as windows service but getting "Input too long" error while executing the install script.
I have struggled a lot in this issue and finally got the way to register AdminServer and Nodemanager as windows service for Weblogic. Below are the steps and issues faced with the progress:
To register weblogic AdminServer as windows server first need to create a script which will contain values like oracle home, java home etc. Below is the script I have used to install the service:
`
echo off
SETLOCAL
set MW_HOME=C:\Oracle\Middleware\Oracle_Home
set DOMAIN_NAME=osb_domain
set USERDOMAIN_HOME=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain
set SERVER_NAME=AdminServer
set WL_HOME=C:\Oracle\Middleware\Oracle_Home\wlserver
set PRODUCTION_MODE=true
set JAVA_OPTIONS=-Dweblogic.Stdout="%USERDOMAIN_HOME%\stdout.txt" -Dweblogic.Stderr="%USERDOMAIN_HOME%\stderr.txt"
set WLS_USER=weblogic
set WLS_PW=Password123
set MEM_ARGS=-Xms1024m -Xmx1024m
call "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain\bin\setDomainEnv.cmd"
call "C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin\installSvc.cmd"
ENDLOCAL
`
By running this script I was not even able to install the windows service as it was throwing " Input is too long" error and the reason is windows char limitations. You might get confused by classpath and will try to resolve classpath but
the issue is with JAVA_OPTIONS values which is set by SetDomainEnv.txt is creating this issue.
I have modified the script like below and shorten the JAVA_OPTIONS values by calling SetDomainEnv.txt command just before setting JAVA_OPTIONS in the script.
This has overridden the lengthy value of JAVA_OPTIONS. Now I have succesfully installed the AdminServer as windows service.
`
echo off
SETLOCAL
set MW_HOME=C:\Oracle\Middleware\Oracle_Home
set DOMAIN_NAME=osb_domain
set USERDOMAIN_HOME=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain
set SERVER_NAME=AdminServer
set WL_HOME=C:\Oracle\Middleware\Oracle_Home\wlserver
set PRODUCTION_MODE=true
call "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain\bin\setDomainEnv.cmd"
set JAVA_OPTIONS=-Dweblogic.Stdout="%USERDOMAIN_HOME%\stdout.txt" -Dweblogic.Stderr="%USERDOMAIN_HOME%\stderr.txt"
set WLS_USER=weblogic
set WLS_PW=Password123
set MEM_ARGS=-Xms1024m -Xmx1024m
call "C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin\installSvc.cmd"
ENDLOCAL `
Even the service is successfully installed, when I was starting it the service is stopped immediately and wasn't printing any logs as it was not connecting to AdminServer.
After a bit analysis I found that JAVA_OPTIONS values which I have overridden in my script is very much needed to invoke AdminServer.
I have run SetDomainEnv.txt in cmd prompt and copied thre JAVA_OPTIONS values.
As the service is already installed, I just copied the correct JAVA_OPTIONS values CMDLINE param in the windows service registry manually.
Server subsystem failed. Reason: A MultiException has 6 exceptions.
Server installed as Windows NT service with incorrect password for user weblogic. The password may have been changed since the server was installed as a Windows NT Service. Contact the Windows NT system administrator.
Note: No extra spaces or character is inserted in CMDLINE param.
Now everything is in place which is actually required to start the admin server. But when I start the service it is throwing some authentication error along with others in the adminserver.log file.
after a lot of analysis I found that is is not authentoication issue, the problem was with boot.properties file. boot. properties file was not read properly.
This answer is continuation of below one:
after a lot of analysis I found that is is not authentoication issue, the problem was with boot.properties file. boot. properties file was not read properly.
Now I would give some background- If the fusion middleware is installed as development mode the boot.properties files is created automatically inside Oracle_HOME\user_projects\domains\domainname\servers\AdminServer\security and if you look at this prop file you will find the password and username in encrypted mode.
If the fusion Middleware is installed as production Mode then everytime it will ask for password and username. to avoid this perform below steps:
manually create file under Oracle_HOME\user_projects\domains\domainname\servers\AdminServer\security\boot.properties like mention below:
username=weblogic
password=Password
Note: No spaces should be added and take care of file extension.
Now start weblogic from domain\bin\startWeblogic.cmd. This will encrypt you boot.properties file. check boot.proprties file if encrypted you are good to go.
Finally start the windows service whic is installed following above process. It should work fine.
=======================
About Node manager use installNodeMgrSvc from domain\bin. Again if you get input is too long error, you must shorten JAVA_OPTIONS and then carefully edit CMDLINE param in the windows registry.
I am getting the below error when I run net start thingsboard
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.
Problem was with windows service java wrapper
I was able to run thingsboard from command line with out using service wrapper using below command :
SET BASE=C:\thingsboard
SET LOADER_PATH=%BASE%\conf,%BASE%\extensions
SET SQL_DATA_FOLDER=%BASE%\data\sql
SET jarfile=%BASE%\lib\thingsboard.jar
SET installDir=%BASE%\data
java -jar thingsboard.jar
I had same Problem that I solved by giving correct path of java in
Control Panel\All Control Panel Items\System\Advanced system settings\Advanced\Environmental Variables\System variables
In system variable select Path and click on Edit and give your java version path
for example mine is:
C:\Program Files\Java\jre1.8.0_172\bin
if this is not working check whether multiple java versions are available or not.
there should not be multiple java path in Environment Variables if its there delete others and let only correct path
I have been trying to install Maven v 3.0.4 on my machine win 7 for the first time.I have a problem setting the path environment System variable I have the following 4 entries :
PATH
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_04;C:\Program Files\apache-maven-3.0.4\bin;M2_HOME;%M2%
M2_HOME
C:\Program Files\apache-maven-3.0.4\bin
M2
%M2_HOME%\bin
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_04\bin
when I do mvn --version
I get the error:
JAVA_HOME not found in your environment, please set the JAVA_HOME variable in your environment to match the location of your java installation
The java -version displays the java version fine,
what am I doing so horribly wrong? Is the PATH ok?
Help appreciated, thanks.
It is only necessary to set the path to the Maven binary and to the JDK correctly:
set PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_04\bin;C:\Program Files\apache-maven-3.0.4\bin
Furthermore you need to set the JAVA_HOME correctly which is done under windows like this:
SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_04
Be aware of setting JAVA_HOME to the root of the installed JDK and not to bin folder it.
The settings of M2 and M2_HOME is not necessary.
from command prompt run the following
set M2_HOME= C:\Program Files\apache-maven-3.0.4
set PATH=%PATH%;%M2_HOME%\bin
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_04
set PATH=%PATH%;%JAVA_HOME%\bin
cmd.exe
mvn -version
The environmental variables should point to the installation directory of each program respectively, and their corresponding bin folders should be added to the PATH:
Make sure that your JAVA_HOME points to the C:\Program Files\Java\jdk1.7.0_04 (or whatever directory you have installed your JDK to).
Add the %JAVA_HOME%\bin folder to your PATH (e.g. by replacing the part with C:\Program Files\Java\jdk1.7.0_04). Make sure that you use ; to separate different path components.
Likewise, the M2_HOME variable should be assigned Maven's installation directory, e.g. C:\Program Files\apache-maven-3.0.4 and you should add %M2_HOME%\binto the PATH (the part with C:\Program Files\apache-maven-3.0.4\bin;M2_HOME;%M2% can be removed.
The advantage of adding the environmental variables %JAVA_HOME%\bin and %M2_HOME%\bin on the path rather than the fully qualified path is that it will be easy to update Java and Maven (or to have several versions installed in parallell). All you need to do is to update the environmental variable, and the PATH variable will fallow automatically.
I ran into the same issue as the original poster. I checked, double checked, and triple checked everything to conform to what everyone has (correctly) indicated the setup needs to be. I still got the same error. In the end, I ran SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45 from the command line and then ran the mvn command and viola.
So, for what ever reason, pss's suggestion did the trick. Obviously, this doesn't really change what everyone else said, because that's exactly what my environment variables look like...just had to hit the JAVA_HOME from the command line.
Oddness.
I followed all the steps but it was not working for me. But as soon i have set the JAVA_HOME Path, in Command prompt just type:
C:>SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_91
It is working fine in fraction of seconds. Thanks Everyone.
I faced the same problem on local installation. I tried out all the suggested methods including the SET method but that didn't work for me. In the end, I had to manually add another environment variable to the system, and then after that
mvn -v
gave the appropriate response:
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T04:57:37-07:00)
Maven home: C:\Program Files (x86)\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin\..
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "dos"
If, like me, you are running mvn -version from the command prompt, and then adding any missing environment variables from the GUI, it is possible that you just have to reload the command prompt after adding the environment variables.
Just exit and run cmd.exe
You need to make a variable of name JAVA_HOME in your Environment and set its value as path to jdk.
Right click on My Computer/ This PC -> Properties
Choose Advance system settings
Open Environment variables
Under System variables click on New... button and give the name
as JAVA_HOME and value as c:/path/to/jdk
Version that I always use. Double click and you get the maven up and running
#echo off
title Maven 3.0.5
set JAVA_HOME=C:\Users\hutingung\Development\jdk\jdk1.6.0_33
set MAVEN_OPTS=-Xmx1024m -Xms512m -XX:MaxPermSize=192m -Dfile.encoding=utf-8
set MAVEN_HOME=C:\Users\hutingung\Development\tools\apache-maven-3.0.5\bin
set PATH=%MAVEN_HOME%;%JAVA_HOME%\bin;%PATH%
#cmd /k
Yes, Appending that path C:\programfiles\maven\bin to path variable in system variables is enough, it will work. No need to add user variables.