I'm using Jenkins to deploy the build.
We need to extract files from a .war into some directory.
We have an .xml file which includes commands to extract the files from the .war file and start the server.
The build is being created properly but the .war extraction is not happening and the destination folder is being left empty. The Jenkins Console shows the following output:
[sshexec] bash: jar: command not found
As read from other answers, I have set the PATH properly in .bashrc or in .profile but I'm still facing the same issue.
Install Java devel as follows:
yum install java-devel
To be specific, JAVA bin directory is not in your PATH variable. Add it to PATH variable. In order to search the executables, the OS need to have a list of directories to look up. So, Add the directory which contains 'jartool in thePATH` environment variable
Note : For Windows, Path separator is (;) and for Unix-like OS, Path separator is (:)
The "[sshexec]" tells me you are using some Jenkins plugin to execute a command on a remote host.
This usually means Jenkins executes this (or an equivalent thing by implementing the SSH protocol natively):
ssh user#remotehost 'jar arg1 arg2...'
What happens here is the sshd daemon on the remote host will execute the default shell of the user and ask the shell to execute the command line. The shell is typically not executed as a "login shell", meaning the shell will skip the initialization steps that login shells normally do when the user logs in interactively.
You can study man (name of your shell) to see exactly what the difference is between a shell executed with -l option and one executed without it. In the case of bash it essentially means .profile and .bashrc will not be executed, so any PATH modifications you might have there will not take place.
I think your best bet is to provide the full path to the jar command when you want to execute it.
As you are executing the command on remote host so, it will invoke the new Shell on the remote host. The PATH which you have set in the current host .bashrc file will not make any difference. Instead if you set the PATH for Java in remote host's .bashrc things should work else if you are running any script then mention the complete path for JAR like /usr/jdk64/jdk1.8.0_40/bin/jar -tf /tmp/jars/abc.jar while invoking the command on remote host.
Two ways to do:
export PATH=$PATH:/usr/jdk64/jdk1.8.0_40/bin ---> in remote host's .bashrc
/usr/jdk64/jdk1.8.0_40/bin/jar -tf /tmp/jars/abc.jar --> invoke the jar command with complete path for JAR from remote host.
Related
I'm using Java EE with Glassfish.
I can't run asadmin command as well. I did the following, but output from terminal is:
No command 'asadmin' found, did you mean: Command 'amadmin' from package 'amanda-server' (universe) Command 'acsadmin' from package'ion' (universe) asadmin: command not found
I have Ubuntu 14.04 Trusty Tahr. I should be in bin directory of glassfish, so I'm in /opt/glassfish4/bin.
But always nothing happend, just error message above.
In Ubuntu and Linux in generál, you run commands from current directory like this: ./asadmin, ie. you must prepend ./ to make it explicit that you run a command I current directory. This is traditionally for some security reasons.
Try following command export PATH=/installationDirectory/glassfishName/bin:$PATH
In my case it was export PATH=/opt/glassfish4/bin:$PATH
The asadmin command needs to be read from glassfish bin directory when executing commands, hence you need to export the following in your environment variables.
On mac,
export PATH=/Users/macpro15/Downloads/glassfish5/bin:$PATH
I think you are creating the domain inside the default domain. You should make your own domain in the domains folder, and the run the following command in your terminal:
sh asadmin start-domain DOMAIN_NAME
Per the installation directions I run:
./bin/sqoop.sh client
and it returns error:
could not find or load main class org.apache.sqoop.shell.SqoopShell
I'm setting up Sqoop for the first time. I have the server up and running on Redhat Linux. Now I am stuck running the client on Windows Server 2012. I am running hadoop v2 and sqoop-1.99.3-bin-hadoop200. At the command line I verified java is installed by running "java -version" at the command line and seeing "1.8.0". Scoop is written in Java 1.6. Does that matter? I'm having difficulty locating an active download link to 1.6 for windows for troubleshooting.
I tried installing Cygwin and running the command. Same error.
Locate the directory traversal for the case of client in sqoop.sh
# Build class path with full path to each library
for f in $SQOOP_CLIENT_LIB/*.jar; do
CLASSPATH="${CLASSPATH}:$f"
done
Just add the following search and replace params (note changes of colon to semicolon in classpath)
# Build class path with full path to each library
PARAMSEARCH="/c/"
PARAMREPLACE="C:\\"
for f in $SQOOP_CLIENT_LIB/*.jar; do
f=${f/$PARAMSEARCH/$PARAMREPLACE}
CLASSPATH="${CLASSPATH};$f"
done
I had the same issue running on Windows 8.1. Turns out it's caused because sqoop.sh uses POSIX style directory paths. So / instead of . This results in the script being unable to set the correct CLASSPATH. This could have been remedied by using a cmd file for Windows. I don't know why they didn't do it. There are cmd files for catalina and such but not for launching sqoop!
Anyway I got around this issue by adding all the jar files in the shell\lib folder to CLASSPATH. You do have to add each & every jar file there and not just the folder path. A restart was required after this which was annoying. However the shell script will still not launch the client even after this change. The little trick I used is to just launch the client at the command prompt from the shell\lib folder with the following command
***java org.apache.sqoop.shell.SqoopShell***
Now I get the groovy prompt from where I can run all the commands provided here
I used the following steps to configure sqoop in a windows machine and now able to work with sqoop 1.99.3 successfully.
*Cygwin must be installed before continuing further steps. Also its just for using the native libraries, we can interact with sqoop directly from windows command prompt.
Save the sqoop package folder in “C:” drive name as sqoop
Copy the hadoop lib folder “hadoop” from C:\hadoop\share into C:\usr\lib\hadoop [If this directory doesn't exists, then create one]
Change the hadoop configuration properties in the file “sqoop.properties” from the location “C:\sqoop\server\conf” as below
at line:132
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=C:\hadoop\etc\hadoop
Copy the sqoop.properties and sqoop_bootstrap.properties from “C:\sqoop\server\conf” into “C:\sqoop\server\bin”.
Set the environment variables for sqoop home as well as path:
SQOOP_HOME = C:\sqoop
Starting the server:
Open Command prompt (run as Administrator) and enter into the $SQOOP_HOME location and type command as follows
C:\sqoop> cd server\bin
C:\sqoop\server\bin> catalina start
The catalina server will be start and check it in the below location
http://localhost:12000/sqoop
Client Shell Command
Open the command prompt and enter the following command
java -classpath C:\sqoop\shell\lib\sqoop-shell-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\sqoop-common-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\sqoop-client-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\log4j-1.2.16.jar;C:\sqoop\shell\lib\json-simple-1.1.jar;C:\sqoop\shell\lib\jline-0.9.94.jar;C:\sqoop\shell\lib\jersey-core-1.11.jar;C:\sqoop\shell\lib\jersey-client-1.11.jar;C:\sqoop\shell\lib\jansi-1.7.jar;C:\sqoop\shell\lib\hamcrest-core-1.3.jar;C:\sqoop\shell\lib\groovy-all-1.8.5.jar;C:\sqoop\shell\lib\commons-lang-2.6.jar;C:\sqoop\shell\lib\commons-cli-1.2.jar org.apache.sqoop.shell.SqoopShell
The client shell command will be displayed as :
Sqoop Shell: Type 'help' or '\h' for help.
sqoop:000>
Hope this helps
Thanks
I have installed and configured hadoop in a linux machine .Now i am trying to run a sample MR job.I have started the hadoop via the command /usr/local/hadoop/bin/start-all.sh and the output is
namenode running as process 7876. Stop it first.
localhost: datanode running as process 8083. Stop it first.
localhost: secondarynamenode running as process 8304. Stop it first.
jobtracker running as process 8398. Stop it first.
localhost: tasktracker running as process 8612. Stop it first.
so i think that my hadoop is configured successfully.But when i am tryinh to run below command it is giving
jeet#jeet-Vostro-2520:~$ hadoop fs -put gettysburg.txt /user/jeet/getty/gettysburg.txt
hadoop: command not found
i am new in hadoop.somebody please help .I am also posting the screenshot of what i am trying
As it seems from your commands history, you can replace hadoop by /usr/local/hadoop/bin/hadoop and it should help.
If you want to use hadoop command without specifying the full path to it, you can edit ~/.bashrc file and add the following line:
export PATH=$PATH:/usr/local/hadoop/bin/
Then you need to reopen your terminal.
edit PATH variable, if you want to be able to invoke hadoop without specifying full path
export PATH=$PATH:/usr/local/hadoop/bin/
if you want it for each bash profile then edit ~/.bash_profile to include this
I got the same error, and this worked for me
I configured path variable in.bashrc.
export HADOOP_HOME=/opt/hadoop
export PATH= $PATH:$HADOOP_HOME/bin
Sometime restarting your machine can resolve the issue ,only if you have configured everything correct.
cd ~
vi .bashrc
export PATH=$PATH:<hadoop installation path>
for example replace <hadoop installation path> by /usr/local/hadoop/bin/
once echo your path ,if your path hasn't set ,then go to your .bashrc file
vi ~/.bashrc
and add folliwing in that.
export PATH=$PATH:/usr/local/hadoop/bin/
Please make sure that you are logged into the particular user, whose .bashrc file has got this entry
export PATH=$PATH:/usr/local/hadoop/bin/
Assuming that your hadoop setup is lying at /usr/local
Example You have set the .bashrc file for user hadoopuser in /home/hadoopuser/.bashrc, then you should be logged in as hadoop user only and not as any other user.
Hadoop command not found?
put this 3 commands at the end of ~/.bashrc file
sudo gedit ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_HOME=/home/Work/hadoop-1.2.1
export PATH=$HADOOP_HOME/bin:$PATH*
java-8-openjdk-amd64 - put your folder name
hadoop-1.2.1 - put your folder name
save the file and use below command
source ~/.bashrc
or simply close the terminal and open it again
I'm building a server in Java. I want to setup a single word option that will start and stop the server. "start" to start the server. "stop" to stop the server. I tried to use an executable file that launched the jar, but even using that strategy, I still have to type "./start". The punctuation is a little ugly.
I wanted something similar to "git". If you type "git" in Terminal, you are immediately using git's tools. I'm guessing this is because of a symlink? If so, how did the symlink for "git" get setup? I didn't have to manually set it up from what I remember.
If you would like to avoid sh or ./ while executing you may use alias, add following at the end in ~/.bashrc file:
alias sayhello="./sayhello.sh"
And then run the .bashrc file using following command:
source .bashrc
Finally, you should be able to execute your command using just:
sayhello
What OS are you working on? In windows you just have to add the location of start.exe to your PATH, then typing "start" in the command prompt will launch the executable and the jar
I'm trying to run a sample app in Tomcat. I've installed tomcat, set up the environment variable by creating a new system variable called JAVA_HOME which is set to C:\Program Files\Java\jdk1.6.0_20. And I've created a new dir for the web app in the tomcat program directory. In the cmd prompt I navigate to the tomcat program directory and type in bin/startup.sh and I get the following error: 'bin' is not recognized as an internal or external command, operable program, or batch file.
I'm using tomcat 6.0 and I'm on a windows machine. What could the problem?
On Windows you must run the startup.bat file instead of the startup.sh file (note the extension is different).
Also, enter the bin directory before executing the bat script.
cd bin
startup.bat
Your on windows try:
bin\startup.bat
If you try typing in bin\startup.bat on a Windows machine and still get the same error, there's a possibility that Windows is not seeing the batch script where it should be. As a-horse-with-no-name already said, try installing Tomcat to a location where there are no spaces in the path. In your case, anywhere other than Program Files.
EDIT: To resolve this space issue, you can do two things: 1) Install JDK/JRE to a common location without spaces (say, C:\Java) and set it to be JAVA_HOME environment variable. 2) Install Tomcat to another location (say, C:\Tomcat) and proceed from there. Since these are all in common location, I believe you can do this as a limited account user without needing admin privileges.
Try to install Tomcat (and possibly the JDK) into a directory without spaces.
The script you ran is intended for *nix systems. Try bin\startup.bat
I'm a little confused by some of the answers. First, the error you are receiving is from Windows. Nothing to do with Tomcat. The Windows OS thinks you have entered a command, and doesn't recognize it. Files with the .bat extension are always recognized by Windows as Batch file commands....... soooo..... Navigate to the bin directory, again, under your tomcat installation. Then....
Don't append the bin in front of the command. You should do a quick look to make sure that the "startup.bat" file is here (dir *.bat). Then just type "startup.bat".
Seems like I just type "catalina.bat start" (for my tomcat catalina installation)