Error launching sqoop client on windows - java

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

Related

Sprin Boot apps no log dir created by running it throgh a remote ssh command

I try to deploy the sprin boot jar file into a remote Linux server and run it throw java -jar command.
The command was much like below:
ssh root#xxx.com:/myjdk_path/bin/java -jar /tmp/target.jar
The problem is that there was no any log dir been created while i running the command.
The sprin boot app was created by the spring.io site,it's a normal app then i put one single line "logging.file=./log/my.log" into application.properties.
But it works(the log dir can be created) when i just logged into the target server and type the command in the ssh console.
The sprin boot version is 2.05 and i've test version 1.5.16 still the same.
And i aslo test it in both Ubuntu and Centos servers,nothing haapens too.
Really appreciate if you can give a clue on this!
Thanks all you guys , it turns out my fault, the reason is that I am using a relative log path ,and I run that java -jar command out side the shell directory.
old command:ssh root#xxx.com:/myjdk_path/bin/java -jar /tmp/target.jar
new command:ssh root#xxx.com:cd /tmp; /myjdk_path/bin/java -jar target.jar
the log dir was been created for the old command ,but it in the user home path(for this command is the ROOT user),but not in the /tmp path.
so my stupid check steps missing that point,and thought there is no log dir been created!

Unable to run Jmeter.bat

I'm trying to use Jmeter but am coming across an issue when I try and run it using the Jmeter.bat file.
It's spits out the following error:
'java -version 2>&1 | findstr /i "version"' is not recognized as an internal or external command, operable program or batch file.
Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Press any key to continue . . .
I've tried googling this and lots of posts mention that this error is usually down to the environment variables not being set correctly, but I'm fairly sure they are as if I type java or javac into the command prompt I get a response.
I've got them set as follows:
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
JDK_HOME : %JAVA_HOME%
JRE_HOME : %JAVA_HOME%\jre
CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
PATH : your-unique-entries;%JAVA_HOME%\bin
I tried taking the string it's complaining about and pasted that into the command prompt by itself and it ran fine:
C:\Windows\System32>java -version 2>&1 | findstr /i "version"
java version "1.8.0_25"
So why is it throwing the error when running the batch file but not if I paste it in manually? The batch file is located in a folder in my C drive and I'm running by right clicking and selecting 'Run as Administrator'. If I just double click the .bat file I get the error:
Windows cannot find 'C:\apache-jmeter-2.13_src\bin\jmeter.bat'. Make sure you typed the name correctly, and then try again
Is the above error related or is that a separate permissions issue?
Thanks for any help
From command Prompt go to bin folder of apache jmeter and type following command:
C:\apache-jmeter-3.0\bin> java -jar ApacheJmeter.jar
I also faced similar problem when I extracted the JMeter in C. In my case, i don't have admin rights. I assume it is related to some permission issue. So better copy to D: and then check.
Copy C:\apache-jmeter-2.13_src folder to other drive (D:) or download JMeter and extract in D drive and run the batch file.

bash: jar: command not found

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.

Glassfish server open source addition failed to install

i got the following error when i tried to install GlassFish Server glassfish-3.1.2.2-windows().exe
Executing command :C:\glassfish3\glassfish\bin\asadmin.bat --user admin --passwordfile - create-domain --savelogin --checkports=false --adminport 4646 --instanceport 7070 --domainproperties=jms.port=7676:domain.jmxPort=8686:orb.listener.port=3700:http.ssl.port=8181:orb.ssl.port=3820:orb.mutualauth.port=3920 domain1
C:\glassfish3\glassfish\bin\asadmin.bat --user admin --passwordfile - create-domain --savelogin --checkports=false --adminport 4646 --instanceport 7070 --domainproperties=jms.port=7676:domain.jmxPort=8686:orb.listener.port=3700:http.ssl.port=8181:orb.ssl.port=3820:orb.mutualauth.port=3920 do main1 The system cannot find the path specified.
print screen of error is following
I just ran into this same problem and it appears to be created by the batch files asadmin.bat and asenv.bat. The batch files read as follows (I've removed the REM statements and lines that didn't pertain to the problem:
asadmin.bat in c:\glassfish3\glassfish\bin
REM Always use JDK 1.6 or higher
REM Depends on Java from ..\config\asenv.bat
call "%~dp0..\config\asenv.bat"
if "%AS_JAVA%x" == "x" goto UsePath
set JAVA="%AS_JAVA%\bin\java"
goto run
:UsePath
set JAVA=java
:run
%JAVA% -jar "%~dp0..\modules\admin-cli.jar" %*
asenv.bat in c:\glassfish3\glassfish\conf
set AS_JAVA=C:\Program Files (x86)\Java
I could not figure out how to get Glassfish to just use the environment variable during install. I attempted to use the -j "(javapath)" argument, but this didn't solve the problem for me.
What worked, and I'm not proud of this solution, is to give Glassfish what it's looking for. If you put together the path its constructing above, you get C:\Program Files (x86)\Java\bin\java.exe. Since Java installs to C:\Program Files (x86)\Java\jre7\bin\java.exe, I simply copied the contents of C:\Program Files (x86)\Java\jre7\ to C:\Program Files (x86)\Java\ and Glassfish installed correctly.
If someone else has a better solution to this problem, PLEASE post it!
Full Disclosure:
Installing Glassfish 3.1.2.2 on Windows Server 2008, running on a VM.
Update: A co-worker of mine came up with a different solution that doesn't involve copying the contents of C:\Program Files(x86)\java\jre7.
During the Glassfish install, at the point where it's requesting a password for the admin account, edit the asenv.bat file and add the "jre7\" to the line I quoted above. This forces Glassfish to look in the proper folder.

Tomcat -- Running a web application

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)

Categories