Powershell call works on server but returns error through jenkins - windows

We recently got some new Windows Server 2019 machines and I want to add them to our Jenkins setup. The problem is:
executing any external program causes an error. docker login, git status, java -version all give an error like this
[TestPowershell] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\XXX~1\AppData\Local\Temp\3\jenkins1416755497082623783.ps1'"
java : java version "1.8.0_101"
At C:\Users\XXX-sa\AppData\Local\Temp\3\jenkins1416755497082623783.ps1:1 char:1
+ java -version
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (java version "1.8.0_101":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Java(TM) SE Runtime Environment (build 1.8.0_101-b13
)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Notifying upstream projects of job completion
Finished: SUCCESS
Tried it on the server itself, works fine. All the setup is the same as our 2016 servers, which dont present this issue
EDIT: I setup a vanilla master on VM 2019 and it works without this error, still presents the error with a 2016 master.

For some reason, it seems that this is related to dotnet 4.8. Windows 2019 1809 ships with 4.7 which presents this strange error, not only does it happen on java -version, but git clone , npm install and ng build to name a few also cause the same error. Installing dotnet framework 4.8 fixes it.. in case anyone is having the same issue we were..

Per default jenkins-slave service runs under the SYSTEM user, under which e.g. git operations will fail, since the user credentials are missing.
In the Windows service control manager change the user of the jenkins-slave-service (properties - log on) the an user profile that has appropriate permissions.
Hope that helps.

Related

Powershell script running over ssh to windows via teamcity

I am getting the following error in my TeamCity pipeline log
An error has occurred which PowerShell cannot handle. A remote session
might have ended. + CategoryInfo : OpenError: (172.31.26.4:String) [],
PSRemotingDataStructureException + FullyQualifiedErrorId :
PSSessionStateBroken
I'm running TeamCity 2018.2.4 (build 61678) which is running on windows 2012 R2 along with a single Agent on the same server. Powershell 6 and OpenSSH installed on both TeamCity and the Windows Server.
I can run the script locally from the Teamcity server via powershell and runs fine with no errors.

Weblogic server could not start and could not configure domain

I just installed a fresh copy of weblogic server and OSB.
After the successful installation of weblogic 10.3.6 on the quick start screen I tried to configure domain. however the screen doesn't processed any further giving the error in the screenshot below.
Also, in eclipse, when i try to add the server, It prompts me to create a domain, but that doesn't work either.
The error am getting in the console is:
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option
MaxPermSize=128m; support was removed in 8.0
Unrecognized VM option 'UseSpinning'
It looks like Java 8 is being picked up elsewhere on your system.
Check to see if you have Java 8 installed and look at you path environment variable.
That warning you are getting is from Java 8. 10.3.6 would use Java 5 or 6...

Error in sonar startup, Unable to start JVM: No such file or directory (2)

I am facing strange issue with sonarqube 5.0.1 , one one of the machine it is not starting. Here is the error log - sonar.log -
--> Wrapper Started as Daemon
Launching a JVM...
Unable to start JVM: No such file or directory (2)
JVM exited while loading the application.
JVM Restarts disabled. Shutting down.
<-- Wrapper Stopped
Machine is x86_64 GNU/Linux - Centos 5.1.
this box has java installed -
$java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
The same sonarqube package works on another machine.
Any idea what could be the issue here?
Thanks.
Issue was in the wrapper.conf where the java wrapper command was not getting resolved. It worked if I give the absolute path - ‘wrapper.java.command=/path/to/my/jdk/bin/java’
This could be an issue with an environment on a host.. not sure.
Few things that helped me in troubleshooting this -
log level changed to DEBUG in wrapper.conf
comments given in the wrapper.conf!
Thanks all for chiming in! Appreciate your inputs.
1.Just close all running jvm from task manager
2. Change the port of the sonar runner from the properties
I had the same symptoms (wrapper starts then immediately stops).
I tried these steps and finally succeeded (on a windows 10 pc):
1) in wrapper.conf, specified the java command:
wrapper.java.command=C:\Program Files\Java\jdk1.7...\bin\java.exe
That did not help.
2) Finally this fixed the problem. In the windows Services, open the Sonar service and then open Log On tab.
Changed the Log On to myself as follows:
I was facing the same issue on sonar startup. After reading this post , i modified the JDK path in below file and it works.
Modify the JDK path in wrapper.conf
wrapper.java.command=%JAVA_HOME%/bin/java
Install jdk 11
sudo yum install java-11-openjdk -y
sudo alternatives --config java
Select the JDK 11 version
Set the JDK 11 version in wrapper.conf
vi /opt/sonar/conf/wrapper.conf
wrapper.java.command=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-3.el8_5.x86_64/bin/java
Could you verify the Java version on the machine starting?
Java 6 is no more supported http://docs.sonarqube.org/display/SONAR/Requirements#Requirements-Prerequisite but from your error message, I don't know if this is the problem you meet.
Solution 1
Set java path globally
Solution 2
Go to sonarqube-{version}/conf directory
Edit wrapper.conf file
Replace wrapper.java.command=java with wrapper.java.command= {path-to-your-java-bin-directory}/java
eg: wrapper.java.command=/usr/java/bin/java
Try using a relative path, if your Sonar Folder is located in the same root folder as your jdk. For me my sonar and jdk are both under "Program Files", which has restrictive permission, hence the error.
E.g:
wrapper.java.command=../../../Java/jdk-11.0.4/bin/java

Weblogic domain is not getting created because of jrockit error

I am creating a Basic Weblogic server domain(11g, version 10.3.5.0 ). And in the JDK selection Window, in Available JDKs , ' JRockit SDK 1.7.0_55 # C:\Program Files\Java\jdk1.7.0_55' is selected..
The domain gets created, now i check the 'Start Admin Server' checkbox and click 'Done' . The process of starting server runs in the cmd, but it halts with the following error::
starting weblogic with Java version:
Unrecognized option: -jrockit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
My Jdk(64-bit) is installed correctly according to me, JAVA_HOME and those things are correct. jrockit comes bundled with JDK , so why this error, any leads will be very helpful..
Thanks :)
I believe that WebLogic 10.3.5 only supports Suns Java JDK 1.6.0_24+ OR JRockit R28.1.3-1.6.0_24+.
It appears as though Weblogic 10.3.5 is not compatible with Java 7, try re-installing/configurring with a Java 6 version installed.
Source: Oracle Installation Docs

How to install Tomcat 7 as a Windows service using command line install

I need to install Tomcat 7 as a Windows service and to start the service manually.
Referring to How to install Tomcat as a Windows service, I believe I would need to specify the following on the command line:
tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" --Install="C:\Tomcat7\bin\tomcat7.exe
Do I also need to specify all or some of the following on the command line like in the example? If only some, please specify which ones. If anything in the example is incorrect, please specify.
--Jvm=auto
--StartMode=jvm
--StopMode=jvm
--StartClass=org.apache.catalina.startup.Bootstrap
--StartParams=start
--StopClass=org.apache.catalina.startup.Bootstrap
--StopParams=stop
What I need for sure is to specify the following because I need to tell Tomcat to use a specific java home and not the java home set by the environment variable JAVA_HOME on the server where this will be installed.
--JavaHome="C:\Program Files\Java\jdk1.7.0_51
The reason: the server already has a different version of Tomcat (5.5) and it uses an older version of the JDK (1.5). I must not change JAVA_HOME on the server. I simply need to ensure Tomcat 7 uses JDK 1.7 and I have tried this line:
C:\tomcat7\bin>tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" --Install="C:\Tomcat7\bin\tomcat7.exe" --JavaHome="C:\Program Files\Java\jdk1.7.0_51"
When I attempt to Start the service, the following error message is displayed:
Windows could not start the Apache Tomcat 7 on Local Computer. For
more information, review the System Event Log. If this is a
non-Microsoft service, contact the service vendor, and refer to
service-specific error code 1.
I had a look at the System Event Viewer and it provides the following information:
The Apache Tomcat 7 service terminated with service-specific error Incorrect function..
I need to figure out these steps because I then need to provide the support team with the information to install this service on the production server. So any help would be greatly appreciated!
Use Chocolatey from Powershell command line:
first install Chocolatey
PS:\> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
To install Tomcat
PS:\> choco install tomcat
To upgrade
PS:\> choco upgrade tomcat
Seems like a mismatch in your java JVM and tomcat version.
The tomcat7.exe wrapper program actually
"runs" the JVM, it must match the type of JVM that it runs, in terms
of 32bit/64bit version. If you try to start a 64-bit JVM with a 32-bit
tomcat7.exe, it won't work, and vice-versa.
Reference
This is because of shortage in physical RAM.
Check the Minimum System Requirements on Tomcat docs and try to close unnecessary programs if possible.
Use Chocolatey from Powershell command line:
PS> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
To install Tomcat:
PS> choco install tomcat
To upgrade:
PS> choco upgrade tomcat

Resources