Apache kafka error on windows 10: kafka-topics.bat file gives syntax error - batch-file

I am starting to learn Kafka. I managed to run zookeeper and kafka successfully. I am using Windows10 and my kafka version is 2_12-2.5.0.
My question is that when I try to create a topic from cmd using the below command:
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic firstTopic`
I get the error:
The syntax of the command is incorrect.
I know that the command I wrote is correct and the issue is the command inside the .bat file as I changed the command inside the kafka-topics.bat, the error changes. However I could not manage to run it. This is the content of kafka-topics.bat:
"%~dp0kafka-run-class.bat" kafka.admin.TopicCommand %*
I also tried to run kafka-topics.sh file instead of batch, but that gives a different error opening git bash, that is:
Error:Could not find or load main class kafka.admin.topicCommand
I also got rid of the space in "Program Files" while writing the path, so I don't think that is the reason of this error.
I got stuck and its hard to understand these errors as I am new.
Can you please help?

in my case it worked only when I moved Kafka folder to C: partition without any space in path
for example C:\Kafka_sources
and I used the below command to create a topic
kafka-topics.bat --create --topic test --zookeeper localhost:2181 --partitions 1 --replication-factor 1

in my case:
i removed the quotation marks in .properties for directories
use forward slashes in .properties for directories
i removed the dot-version numbers in directory path (don't know if that was deciding)
but start with point and backlashes .\bin\windows\kafka-server-start.bat .\config\server.properties)
d:\ is possible !

Related

Post-commit-hook in Subversion doesn't work as I want

i came across a problem with subversion at my work. I want to create a post-commit-hook (post-commit.bat file) command that creates information about the last transaction.
The code looks like this:
#echo off
set file="D:\mypath\logfile%2.txt"
svn log D:\'my path to repro'\ -r %2 -v > %file%
The %2 corresponds to the last revision number. It creates the file with the correct number and tries to write in it. But then the commit hangs and the file remains open. The curious thing is, if I manually trigger the command with a valid revision number, then the whole thing works. Only with the hook it hangs and it also does not commit the files.
Can anyone help me or have any ideas for my problem?
I found a solution, maybe this might be helpful for some person.
I used the wrong command "log". Instead you have to use "svnlook changed..." on the server to get the latest information about the last commit.

Creating a TortoiseSVN Start Commit local hook script to run .bat file, cannot find path specified

I'm trying to have TortoiseSVN run a .bat file before all commits using a start commit hook. I defined it by right clicking the folder -> Properties ->Subversion -> Properies... -> Created a new hook script.
I've tried several different commands...
WScript "%REPOROOT+%\precommit.bat"
VBScript "%REPOROOT+%\precommit.bat"
%REPOROOT+%\precommit.bat
Though none have worked, I keep getting that the file was not found. I'm not sure if REPOROOT is not defined or what?
Even doing
echo "%REPOROOT%" gives the error.
Using "%REPOROOT+%/precommit.bat" fixed the issue. Combination of needing to use forward slashes as suggested in comments and also using double quotes.

VisualSFM install mac issue

Installing VisualSFM on mac with the Dan Monaghan installer and halfway through the build I get an error that reads:
libsiftgpu.so failed to build. Halting.
What caused this and how do I fix it?
Googling found many with similar issues, was able to combine pieces from different solutions and get it working.
Why the error occurs:
The program tries to build & install a siftgpu function on line 246 of the vsfm_os_x_installer.sh file.
But that link is dead.
Step 1:
Manually insert a sift_gpu.zip file into your /users/USERNAME/ directory.
Step 2:
After the sift_gpu.zip file is in your users/USERNAME directory, Ninorian changed the following lines (in the vsfm_os_x_installer.sh file) and it worked for me too:
Search for : sed -i '' Replace with: sed -i
Step 3:
The sift_gpu.zip file opens a directory called SiftGPU-master, and we need to change the name to SiftGPU, so add this line above line 262 like this:
(line 261) mv SiftGPU-master SiftGPU
(line 262) cd SiftGPU
Step 4:
I got this far, but kept getting errors that said “file or directory not found”, and this was remedied by changing the file extension on line 356 in the vsfm_os_x_installer.sh file* (hat-tip to this Github build issue support ticket)
From this:
cp ../patches/SparseBundleCPU.patch src/pba/
To this:
cp -R /users/USERNAME/downloads/VisualSFM_OS_X_Installer-master/patches/SparseBundleCPU.patch src/pba
After that, everything finished installing smoothly,
But I couldn't run it yet.
Step 5:
This 5-minute VisualSFM Mac install YouTube tutorial helped.
Here are the steps:
You need to add 2 scripts to your ~/.bash_profile, go into terminal and type: nano ~/.bash_profile and then paste those two scripts at the bottom of that file.
Save and close ~/.bash_profile
Then go into the /users/USERNAME/vsfm/bin folder and copy libpa.so AND libsiftgpu.so and paste them into your /users/USERNAME/ directory.
Create a new folder in /users/vsfm directory called /users/vsfm/sift
Move the SiftGPU folder from your users/USERNAME/ directory into your /users/vsfm/sift directory
From there, go to users/USERNAME/vsfm/bin/ and double-click on VisualSFM, and if all went well the program should start running and open up, ready for use.
This was a pain in the ass to troubleshoot but it's over and done and I hope this helps anybody.

Sqlcmd Error "The filename, directory name, or volume label syntax is incorrect"

I create a bat file for the first time, and have the following issue: my command is running just fine when I type it directly into the command prompt, but it's not running through the bat file I created. The script is:
#echo off
sqlcmd -S DESKTOP-55JKCD5\SQLEXPRESS -i “C:\Users\Didi\Documents\SQL\test.sql” -o “C:\Users\Didi\Documents\SQL\output.csv” -s”,”
I get the following message from cmd:
Sqlcmd: Error: Error occurred while opening or operating on file ôC:\Users\Didi\Documents\SQL\test.sqlö (Reason: The filename, directory name, or volume label syntax is incorrect).
I can't understand what's wrong, provided that I don't have any issues when typing directly in cmd.
I'm begging for your advice, guys! Bat files are totally new for me, apologies is asking a stupid question.
Don't use "smart quotes"! Use " - in a proper editor, not a word-processor.
If you are running this exe from Azure Dev Ops you can also get this issue if there is a new line in the definition of the step in the Release or Pipeline. The step is multiline so it is difficult to spot. It's the difference between:
ServerRoleMembership;ServerRoles;RoleMembership;Permissions" /v:Environment=$(Environment) /Diagnostics:true
/p:ScriptDatabaseOptions=false
and
ServerRoleMembership;ServerRoles;RoleMembership;Permissions" /v:Environment=$(Environment) /Diagnostics:true /p:ScriptDatabaseOptions=false
Both look same in Dev Ops, it's only when you copy them out to notepad you will see the new line

Delete a file named "NUL" on Windows

I ran a program on Windows 7 that was compiled under Cygwin and passed "NUL" as an output file name. Instead of suppressing output it actually created a file named "NUL" in the current directory. (Apparently it expects "/dev/null", even on Windows.) Now I'm stuck with this "NUL" file that I cannot delete!
I've already tried:
Windows Explorer - error: "Invalid MS-DOS function" (yes, that is seriously what it says!)
Command prompt using "del NUL" - error: "The filename, directory name, or volume
label syntax is incorrect."
Deleting the entire directory - same deal as just deleting the file
remove() in a C program - also fails
How can I get rid of these NUL files (I have several by now), short of installing the full Cygwin environment and compiling a C program under Cygwin to do it?
Open a command prompt and use these commands to first rename and then delete the NUL file:
C:\> rename \\.\C:\..\NUL. deletefile.txt
C:\> del deletefile.txt
Using the \\.\ prefix tells the high-level file I/O functions to pass the filename unparsed to the device driver - this way you can access otherwise invalid names.
Read this article about valid file / path names in Windows and the various reserved names.
If you have Git for Windows Installed (v2.18) do the following
Open the directory containing the files you want to remove
Left Click and select Git Bash Here
Type rm nul.json at the command prompt and hit ENTER, the file now should be removed.
NOTE: These screenshots show the removal of file nul.topo.json which is another file that I could not removed with a simple delete.
If you have git on windows, just right click on the folder containing the nul file -> go to gitbash here -> and type "rm nul" or "rm nul.json" depending upon the file type.
I had a similar issue. It was probably caused by Cygwin as well (since I use this regularly), but I've since forgotten exactly how the file was created.
I also had trouble deleting it. I followed the advice of some other posts and tried booting into safe mode to delete the file, though this did nothing. The tip from +xxbbcc didn't work for me either.
However, I was able to delete the file using the Cygwin terminal! Cygwin createth and Cygwin destroyeth.
To remove a nul file situated here:
C:\unix\cygwin\dev\nul
I simply use (tested only on Windows 10) :
Del \?\C:\unix\cygwin\dev\NUL
I solved this in a slightly different way.
I thought I would add this here because it is high in the google results and I had a similar issue for a folder named NUL.
I tried rmdir\\?\C:\My\Path\NUL and rmdir\\.\C:\My\Path\NUL without any success and also tried several commands using bash from my SourceTree installation. No joy.
In the end I used DIR /X /A from cmd to list the short names in the parent directory. This showed me NUL~1 for my NUL folder and identified the crux of the problem.
This was then used in the standard command rmdir /s NUL~1 and finally resolved the issue.
I was having this same issue.
If you have WSL2 installed just go to that directory and run:
rm -f nul
In my case the file was lowercase. You should be good.
Try writing a short C program that calls the Windows API to delete that file.
http://msdn.microsoft.com/en-us/library/aa363915%28v=vs.85%29.aspx
If that doesn't work, try opening a handle to the file with CreateFile() with FILE_FLAG_DELETE_ON_CLOSE, and then close the handle.

Resources