I’m a Jenkins newbie but really want to see how Jenkins can help me in our build pipeline. As a part of our requirement, we need to be able to invoke PowerShell scripts via the x64 instance. I've got Jenkins installed on Windows Server 2012 R2 and out of the box, the PowerShell plugin worked fine but via the x86 engine. As I’ve learned, by default, Jenkins uses the x86 version of Java. No problem. I’ve installed the x64 version of Java, modified Jenkins.xml to look like this:
<executable>C:\Program Files\Java\jre1.8.0_131\bin\java.exe</executable>
…and restarted the Jenkins service. The service restarts fine but the web interface is unresponsive. I’ve tried to reboot the entire server, set the JAVA_HOME system environment variable to C:\Program Files\Java\jre1.8.0_131 and uninstalled the x86 version of Java to no avail.
From what I've been reading, this works for most people but not for me. I've also looked at the jenkins.err.log and jenkins.out.log files to see any indication why I'm getting no response from the web interface and they have nothing in them.
Adam, I think your correct except the entry would require quotes. Here is what I have in my very PowerShell oriented Jenkins and all works as expected.
<executable>"C:\Program Files\Java\jre1.8.0_131\bin\java.exe"</executable>
64 bit Java and 64 bit PowerShell, as you require.
UPDATE:
Here is my scrubbed but accurate full jenkins.xml. I've never had to set JAVA_HOME, maybe something is picking that up and getting confused. Aside from altering the executable to an external JVM (64bit) and some --https* parameters added I've not done anything extraordinary to the config and like I said its been happily working for awhile.
<service>
<id>jenkins</id>
<name>Jenkins</name>
<description>This service runs Jenkins continuous integration system.</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>%BASE%\jre\bin\java</executable>-->
<executable>"C:\Program Files\Java\jre1.8.0_131\bin\java.exe"</executable>
<arguments>-Xrs -Xms1G -Xmx1G -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --webroot="%BASE%\war" --ajp13Port=-1 --httpPort=-1 --httpsPort=8443 --httpsListenAddress=192.0.0.192 --httpsKeyStore=C:\MyJavaKeyStore.jks --httpsKeyStorePassword=PasswordToSaidJKS</arguments>
<!--
interactive flag causes the empty black Java window to be displayed.
I'm still debugging this.
<interactive />
-->
<logmode>rotate</logmode>
<onfailure action="restart" />
</service>
You might try un-commenting the <interactive /> node to see what errors might be thrown but possibly not logged.
There is a workaround , you can use the Execute Windows batch command instead of Windows powershell and call the x64 powershell like below
"C:\Windows\SysNative\WindowsPowerShell\v1.0\Powershell.exe" -ExecutionPolicy ByPass -noprofile -file "<Folder Path of file>\Psscript.ps1" -<Parameter> "<Parameter value>"
I ended up just getting frustrated and copying the x64 JRE into the C:\Program Files (x86)\Jenkins\jre folder and everything worked.
I updated the windows firewall "allowed executable" in the programs/services tab from the exe in the Jenkins directory to the new java.exe in the 64 bit directory.
I noticed that if I ran Jenkins in localhost:8080 on the remote machine, everything ran fine. Only remote machines couldn't connect.
Related
I downloaded the Carrot2 Document clustering server build 3.15.0 for Mac. The read me file says:
The DCS requires a Java Runtime Environment (JRE) version 1.7.0 or later. To
run the DCS, execute the 'dcs' script and point your browser at
http://localhost:8080 for further instructions.
Mac OS Sierra doesn't make it easy, but I got 1.8.0_112 installed.
The problem is that I don't know how to execute the 'dcs' script.
There are .cmd, .sh, .war, and .jar files. I wasn't sure which of those to work with. I thought .jar looked promising, so I followed some of this thread and tried this in a terminal window:
java -jar invoker.jar
I cd-ed to the correct directory, but it just says Provide main class, but I'm not sure what or where that is.
Can anybody provide instructions or a link to how to do this?
Use the dcs.sh (on Linux/Mac) and dcs.cmd (on Windows) to start the server. The scripts will set some extra options for the JVM and then start the DCS. In case of any problems, append the -v option to see diagnostic output.
I have some question when using jenkins.
the scenario:
I have installed a tomcat on machine A,and config all necessary environment including JDK, and they work well.
I wrote a shell script named restart.sh to kill the tomcat process,and restart.
I execute the script and it works well.When I check the tomcat process using ps -ef,and it shows the exact JDK path as I already config.The JDK path is /usr/local/java/JDK7
When I execute the restart.sh script via jenkins,problem comes. I can see the tomcat process using the wrong JDK path,/usr/bin/java,not the path as i config. I use SSH Publishers plugin to run the remote script.see as the image below:
enter image description here
I don't know how this problem happen,please help,Thanks all
This might be the problem of path variables, just to cross verify , find JAVA_HOME on your server 1. By logging onto server manually 2. From Exec command of your ssh section of your jenkins job , most probably you will find the answer.
i'm assuming you're jenkins is configured to use jdk which is defined at its root level.
if this didn't solve , we need to look into this problem from another angle.
I've made my first clojure app and I've built it with leiningen by running lein ring uberjar. I can run this on my dev machine (fedora 23) and I can run this on my ubuntu production machine java -jar tomahawk.jar. I've followed the digital ocean tutorial here that describes how to set up the environment. My supervisor conf is the following:
[program:tomahawk]
environment=TOMAHAWK_DB=$TOMAHAWK_DB
command=/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -jar tomahawk.jar
logfile=/tmp/supervisord.log
directory=/var/www/tomahawk/app
user=www-data
autostart=true
autorestart=true
startretries=3
redirect_stderr=true
stdout_logfile=/var/www/logs/tomahawk.app.log
However, when using this through nginx, i get the error
2016-03-19 23:34:08.594:WARN:oejs.AbstractHttpConnection:/
java.sql.SQLException: No suitable driver found for jdbc:sqlserver:$
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:255)
This comes from the com.microsoft.sqldbc4.jar file. However, I can run this standalone jar file, as well as I can run sudo -u www-data env TOMAHAWK_DB=$TOMAHAWK_DB java -jar tomahawk.jar just fine. Also, while this is running, I can hit it through the nginx reverse proxy.
I've searched around and found an unanswered email on the supervisor mailing list from 2011. Why can I only sometimes see the missing jar file?
I've tried putting it inside of the /usr/lib/jvm/.../lib/ext location for my jvm, bundled inside of the jar file, running from Tomcat, etc. I've made an upstart script as well with identical results as well. I am not sure what other paths I can try and was wondering if anyone had any insights.
I have downloaded Neo4J enterprise from the Neo site and have untar'd it under /opt
I have successfully downloaded and installed the Java 7 Server edition from the Oracle web site. Note after indicating I want a server JRE, Oracle downloads this : jdk1.7.0_51
I have untar'd both under /opt giving me /opt/neo4j-2.0.0 and /opt/jdk1.7.0_51
I have successfully installed Neo4J 2.O on AWS with Centos Linux, such that it should run as a Service under a service account. To do this I used the Neo install command. The command ran successfully
I can successfully start Neo4J as myself. After editing my ~/.bash_profile to define JAVA_HOME and exporting.
export JAVA_HOME="/opt/jdk1.7.0_51/"
export NEO4J_HOME="/opt/neo4j-2.0.0"
export PATH=$JAVA_HOME/bin:$NEO4J_HOME:$PATH
Apply
source ~/.bash_profile
cd /$NEO$J_HOME
bin/neo4j start
Works just fine.
However, we are not able to successfully get Neo to start as a service
sudo service neo4j-service start
which: no java in (/sbin:/usr/sbin:/bin:/usr/bin)
ERROR: Unable to find java. (Cannot execute )
* Please use Oracle(R) Java(TM) 7 to run Neo4j Server. Download "Java Platform (JDK) 7" from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
* Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.
If I echo $JAVA_HOME it returns as expected
If I echo $PATH it returns as expected
by as expected we can see java on the path.
If I simply type java -version before I run sudo service neo4j-service start
the response shows the java version.
A bit of background: the Linux service command is not available unless I first run a special script per our normal it policies. However, the script clobbers the exports that I would otherwise use.
Accordingly the command
service neo4j-service start
returns
-bash: neo4j-service: command not found
indicating that the 'service' command cannot be found
So sudo is required in our environment to execute the service command
We have tried simply placing jdk1.7.0_51 under /sbin/jdk1.7.0_51 that does not work. We have also tried extracting the jre folder from jdk1.7.0_51 and placing it under /sbin/jre
Also tried creating a java.sh file under /etc/profile.d/
Still no success.
So the simple question....
Where is Neo4J 2.0.0 looking for Java when running as a service? Is it using the environment variable JAVA_HOME, or is it looking in one of the following locations as the Neo4J server error message would seem to indicate? "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"
Under my installation configuration the neo4j service is intended to run under the account neo4jservice. Is this as simple as making sure JAVA_HOME is available to the neo4jservice accound? Why the error message "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"?
Thanks in advance
I ran a test on my solaris and Linux Mint install and this seems to work for me
Perhaps it's not elegant, but it will get you going. Just drop the sudo part for your startup script.
sudo NEO4J_HOME="/opt/neo4j" JAVA_HOME="/usr/java" /opt/neo4j/bin/neo4j start
Obviously, modify the environment variables to your situation:
JAVA_HOME="/opt/jdk1.7.0_51/" NEO4J_HOME="/opt/neo4j-2.0.0" service neo4j-service start
Not quite the answer I was hoping for... as the answer seems to disregard this part of the original POST: "So sudo is required in our environment to execute the service command"
What does seem to work is modifying the neo4j-service script to include the exports.
neo4j-service is found at /etc/init.d
If I start a java process in a cygwin console, and then launch visualVm, the later cannot see the former.
If I start the same process in a Dos console visualvm sees it fine. I am in jdk1.6.0_25. This happens both in win7 32b, and in win7 64b with a 64b jvm.
Anyone can think of an explanation/workaround?
I fixed the problem by running VisualVM from within Cygwin. If you prefer not to profile using a remote JMX connection, you can run both VisualVM and your Java program using Cygwin:
Open the Cygwin Console window, navigate to visual_vm.exe and run that file from within the Cygwin environment.
I had the same problem. The vm was not shown automatically but I was able to connect via "Add JMX Connection", using hostname and jmx.remote.port...
On VisualVM go to File -> Add JMX Connection
localhost:3333
Add vm parameter at startup e.g.:
-Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
VisualVM can automatically detect local applications running under the same user. So one explanation can be that cygwin process is running under the different user. Make sure that both VisualVM and monitored application is running under JDK 6 update 25. JDK 6 update 25 has a fix for the following JDK bug #6938627, which can affect your case.
The opposite approach to #seanhodges answer is to launch the application to debug with a modified environment, pointing it back to your Windows User Temp directory
For example if you normally do:
./gradlew run
And say your TEMP directory on Windows (according to your User environment variables) is:
T:\Temp
You can do one of these instead:
TMP=T:\\Temp ./gradlew run
TMP=/cygdrive/t/Temp ./gradlew run
(they both seem to work)