NoSuchFileException: plugin-descriptor.properties for custom plugin - elasticsearch

I'm creating a Java plugin for Elasticsearch version 7.17.6.
The zip file is built using:
gradle distZip
When the generated zip file is unzipped all files, including plugin-descriptor.properties, are in the root folder.
This command is run to install the plugin:
elasticsearch-plugin install file:///plugins/elasticsearch_plugin-1.0.zip -v
However the plugin installation fails with:
sh-5.0# elasticsearch-plugin install file:/plugins/elasticsearch_plugin-1.0.zip -v
-> Installing file:/plugins/elasticsearch_plugin-1.0.zip
-> Downloading file:/plugins/elasticsearch_plugin-1.0.zip
Retrieving zip from file:/plugins/elasticsearch_plugin-1.0.zip
[=================================================] 100%??
-> Failed installing file:/plugins/elasticsearch_plugin-1.0.zip
-> Rolling back file:/plugins/elasticsearch_plugin-1.0.zip
-> Rolled back file:/plugins/elasticsearch_plugin-1.0.zip
Exception in thread "main" java.nio.file.NoSuchFileException: /usr/share/elasticsearch/plugins/.installing-4054247711532660111/plugin-descriptor.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
at java.base/java.nio.file.Files.newInputStream(Files.java:160)
at org.elasticsearch.plugins.PluginDescriptor.readFromProperties(PluginDescriptor.java:183)
at org.elasticsearch.plugins.cli.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:827)
at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:887)
at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245)
at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:88)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.plugins.cli.PluginCli.main(PluginCli.java:36)
What can be the cause of the issue? plugin-descriptor.properties exists in the zip file in the root folder but when extracted as part of the install process it is not finding it.
plugin-descriptor.properties contains:
type=isolated
description=My custom plugin for Elasticsearch
version=1.0.0
name=myplugin
classname=com.example.MyPlugin
java.version=1.8
elasticsearch.version=7.17.6
*** Update ***
I found a temporary workaround by copying the zip file to the docker container, extracting it and then moving the extracted folder to
/usr/share/elasticsearch/plugins
and restarting the container. The plugin is then loaded and works as expected.

Related

Artifacts are not deployed with SSH Upload in TeamCity

So I have one job that produces artifacts, and another job with dependency on those artifacts from first job. I tried to use SSH Upload, however I inserted into field "Paths to sources" *.deb => /tmp
In order to download Debian packages from previous job to tmp, but it does not download anything
Logs from my job to deploy:
[21:54:49] Collecting changes in 1 VCS root
[21:54:54] The build is removed from the queue to be prepared for the start
[21:54:54] Starting the build on the agent "agent3"
[21:54:55] Updating tools for build
[21:54:55] Clearing temporary directory: /opt/buildagent/temp/buildTmp
[21:54:55] Publishing internal artifacts
[21:54:55] Full checkout enforced. Reason: [Checkout directory is empty or doesn't exist]
[21:54:55] Will perform clean checkout. Reason: Checkout directory is empty or doesn't exist
[21:54:55] Checkout directory: /opt/buildagent/work/245575fe8c01221b
[21:54:55] Resolving artifact dependencies
[21:54:55] [Resolving artifact dependencies] Destination directory [/tmp] cleaned
[21:54:55] [Resolving artifact dependencies] Downloading files from <Xenoss.test / Build job of deb/rpm packages, build #0.0.2 [id 15836]> for pattern [*.deb => /tmp
*.rpm => /tmp]
[21:54:55] [Resolving artifact dependencies] 2 files retrieved
[21:54:55] Step 1/1: Upload deb/rpm package to destination server (SSH Upload) (1s)
[21:54:55] [Step 1/1] Permanently added '139.59.178.103' (EDDSA) to the list of known hosts.
[21:54:56] [Step 1/1] Starting upload via SCP to host [139.59.178.103:22]
[21:54:56] [Step 1/1] Uploaded [0] files for [] pattern
[21:54:56] Publishing internal artifacts
[21:54:56] [Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[21:54:56] [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisherImpl]
[21:54:56] Build finished
You should to fix your artifact dependency rule. In your setup:
TeamCity downloads artifacts to /tmp directory
TeamCity tries to upload *.deb from directory folder which is not equal to /tmp
So correct artfact dependency rule should look like this:
*.deb => .

Could not download org.springframework.vault

I am importing the gradle project in eclipse which is the spring boot application. I could see all the dependency jars are downloaded except "org.springframework.vault".
I could download the spring-vault-core-2.0.1.RELEASE.pom file from browser, so no network issues i guess.
When i checked in D:\softwares\gradle-4.6-bin\gradle-4.6\caches\modules-2\files-2.1 i could not find this directory. I tried to create this directory but i got the error pop up says "folder/file in it is open in other program". I have restarted the pc, also killed all the java process and tried to create this dir, but still failed.
I deleted the cache directory itself and did gradle build, it downloaded the jars freshly except the mentioned one.
code cannot be shared as it is working project.
when i ran the application getting the error
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
Could not resolve org.springframework.vault:spring-vault-core:2.0.1.RELEASE.
Required by:
project : > com.gogoair.ps:xauth-security:2.0.4
Could not resolve org.springframework.vault:spring-vault-core:2.0.1.RELEASE.
Could not get resource 'https://jcenter.bintray.com/org/springframework/vault/spring-vault-core/2.0.1.RELEASE/spring-vault-core-2.0.1.RELEASE.pom'.
Failed to move file 'C:\Users\CHE32904\AppData\Local\Temp\gradle_download5901172107951949118bin' into filestore at 'D:\softwares\gradle-4.6-bin\gradle-4.6\caches\modules-2\files-2.1\org.springframework.vault\spring-vault-core\2.0.1.RELEASE\562973b9fcc1880af51f50b2d1a53cf8b9f2745c\spring-vault-core-2.0.1.RELEASE.pom'
Failed to create parent directory 'D:\softwares\gradle-4.6-bin\gradle-4.6\caches\modules-2\files-2.1\org.springframework.vault' when creating directory 'D:\softwares\gradle-4.6-bin\gradle-4.6\caches\modules-2\files-2.1\org.springframework.vault\spring-vault-core\2.0.1.RELEASE\562973b9fcc1880af51f50b2d1a53cf8b9f2745c'

glide update failing -> Unable to export dependencies to vendor directory: Error moving files: exit status 1. output: Access is denied. 0 dir(s) moved

I followed the tutorial for glide usage.
I did glide init and a glide.yaml was created successfully. Post that, when I did glide update, I am getting below error. Any idea how do I resolve this?
I installed glide using go get github.com/Masterminds/glide
Note: I am doing these operation on Windows via Git Bash terminal.
(Not sure, but if GOPATH value is required, it is /c/Users/aagoyal/eclipse-workspace-oxygen/GoPath/:/d/Edge_OSS/code/microservice/NE3SProto/. And my code is in location /d/DAAAS/Edge_OSS/code/microservice/NE3SProto/src/ne3s)
$ glide update
[INFO] Downloading dependencies. Please wait...
[INFO] --> Fetching updates for github.com/gorilla/mux
[INFO] Resolving imports
[INFO] --> Fetching updates for github.com/gorilla/context
[INFO] Downloading dependencies. Please wait...
[INFO] Setting references for remaining imports
[INFO] Exporting resolved dependencies...
[INFO] --> Exporting github.com/gorilla/context
[INFO] --> Exporting github.com/gorilla/mux
[INFO] Replacing existing vendor dependencies
[ERROR] Unable to export dependencies to vendor directory: Error moving files: exit status 1. output: Access is denied.
0 dir(s) moved.
In my case, I was getting the same error when running Glide on Windows in an automated build environment. It seemed to be a problem moving the files from whatever temp directory Glide was using into the final vendor directory.
For me, I was able to get around the issue by overriding the GLIDE_TMP environment variable such that it was located in my project's build directory. So, in your case, you can try either setting the GLIDE_TMP variable to a working directory near your project directory, or using the glide --tmp value argument to do so just once as part of each Glide command
e.g. (assuming Bash terminal):
GLIDE_TMP=/d/DAAAS/Edge_OSS/code
glide update
or
glide --tmp /d/DAAAS/Edge_OSS/code update
If that temp directory doesn't work, you could instead try using your /d/DAAAS/Edge_OSS/code/microservice/NE3SProto/src/ne3s project directory as the temp directory, in which case Glide will temporarily create a random glide-vendor1234567 subdirectory there until it moves the files to vendor.

Using custom Maven version in Jenkins on OpenShift

I'm trying to run maven-android-sdk-deployer on my OpenShift Jenkins. It needs at least Maven 3.1.1 to run, whereas OpenShift currently uses version 3.0.5 as default. Thus I tried to configure a custom Maven installation.
My Maven system configuration:
name: maven-3.1.1
install automatically: true
one installer with "Unzip archive" (I also tried "Install from Apache" with the same result.)
label: empty
download url: http://mirror.synyx.de/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.zip
subfolder in archive: apache-maven-3.1.1
It seems to install Maven, because there is another error message, if "subfolder in archive" doesn't match. The zip file is valid.
But I cannot use it in the job.
I created a freestyle job and added a Maven step with the configured Maven installation.
There is an error message, when running the job:
[maven-android-sdk-deployer] $ app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn install -P 4.1
FATAL: command execution failed
java.io.IOException: Cannot run program "app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn" (in directory "app-root/data/jenkins/workspace/maven-android-sdk-deployer"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
... 13 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
... 17 more
Workaround for command line
I checked the file system the maven-android-sdk-deployer workspace and app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn both exist on the myappbldr-gear.
When I run the command from commandline I get the same error, whereas appending ~/ to the maven path works as intended:
[maven-android-sdk-deployer] $ ~/app-root/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.1.1/apache-maven-3.1.1/bin/mvn install -P 4.1
Looks like this is an administration problem. How can I fix this?

Maven : error in opening zip file when running maven

[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\jdom\jdom\1.1\jdom-1.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-rt-bindings-http\2.2.1\cxf-rt-bindings-http-2.2.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\codehaus\jra\jra\1.0-alpha-4\jra-1.0-alpha-4.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-api\2.2.1\cxf-api-2.2.1.jar; error in opening zip file
[ERROR] error: error reading C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-common-utilities\2.2.1\cxf-common-utilities-2.2.1.jar; error in opening zip file
[INFO] 44 errors
How to resolve this error while running mvn clean install?
And I see that, starting from servlet-api, no packages are being created inside the local repository on my disk.
Probably, contents of the JAR files in your local .m2 repository are HTML saying "301 Moved Permanently". It seems that mvn does not handle "301 Moved Permanently" properly as expected. In such a case, download the JAR files manually from somewhere (the central repository, for example) and put them into your .m2 repository.
See also:
asm-3.1.jar; error in opening zip file
http://darutk-oboegaki.blogspot.jp/2012/07/asm-31jar-error-in-opening-zip-file.html
This error sometimes occurs. The files becomes corrupt.
A quick solution thats works for me, is:
Go to your local repository (in general /.m2/) in your case I see that is C:\Users\suresh.m2)
Search for the packages that makes conflicts (in general go to repository/org) and delete it
Try again to install it
With that you force to get the actual files
good luck with that!
Try to remove your repository in /.m2/repository/ and then do a mvn clean install to download the files again.
I had the same problem but previous solutions not work for me. The only solution works for me is the following URL.
https://enlightensoft.wordpress.com/2013/01/15/maven-error-reading-error-in-opening-zip-file/
[EDIT]
Here I explain more about it
Suppose you got an error like below
[ERROR] error: error reading C:\Users\user\.m2\repository\org\jdom\jdom\1.1\jdom-1.1.jar; error in opening zip file
Then you have to follow these steps.
First, delete the existing jar C:\Users\user\.m2\repository\org\jdom\jdom\1.1\jdom-1.1.jar
Then you have to manually download relevant jar from Maven central repository. You can download from this link here
After that, you have to copy that downloaded jar into the previous directory.C:\Users\user\.m2\repository\org\jdom\jdom\1.1\
Then you can build your project using mvn clean install
hope this will help somebody.
go to the .m2/repository and delete the conflicting files
mvn -U clean install
This error can occur when your connection gets interrupted during your dependencies are being downloaded.
Delete the relevant repository folder and run following command again to download a fresh copy of corrupted file.
mvn clean install
I just have this error. You can delete the files and run the compiling command again:
$ sudo rm /Users/Chaklader/.m2/repository/org/apache/poi/poi/3.17/poi-3.17.jar
$ sudo rm /Users/Chaklader/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.7.5/jackson-databind-2.7.5.jar
$ sudo rm /Users/Chaklader/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.7.5/jackson-core-2.7.5.jar
Now, run the command for the clean compile:
$ mvn -U clean compile
I had a similar problem as well. The fix was a mix of both. I had a problem with asm-3.1 (as mentioned in the blog post linked by Takahiko. That jar was corrupt. I needed to manually get the jar from the maven central repository. Removing it and retrying just got the corrupt jar again. It then still failed on the asm-parent, which was a POM file containing the HTML with a 301. Again, it required manually getting the file myself. You may want to check what settings XML to see if you're set to a different repository, such as a local nexus server.
When the proper way to get the new one fails, manually grab it yourself.
I deleted the jar downloaded by maven
manually download the jar from google
place the jar in the local repo in place of deleted jar.
This resolved my problem.
Hope it helps
I also encountered the same problem, my problem has been resolved.
The solution is:
According to error information being given, to find the corresponding jar in maven repository and deleted.
Then executed mvn install command after deleting.
Accidently I found a simple workaroud to this issue. Running Maven with -X option forces it to try other servers to download source code. Instead of trash HTML inside some jar files there is correct content.
mvn clean install -X > d:\log.txt
And in the log file you find messages like these:
Downloading: https://repository.apache.org/content/groups/public/org/apache/axis2/mex/1.6.1-wso2v2/mex-1.6.1-wso2v2-impl.jar
[DEBUG] Writing resolution tracking file D:\wso2_local_repository\org\apache\axis2\mex\1.6.1-wso2v2\mex-1.6.1-wso2v2-impl.jar.lastUpdated
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/axis2/mex/1.6.1-wso2v2/mex-1.6.1-wso2v2-impl.jar
You see, Maven switched repository.apache.org to maven.wso2.org when it encountered a download problem. So the following error is now gone:
[ERROR] error: error reading D:\wso2_local_repository\org\apache\axis2\mex\1.6.1-wso2v2\mex-1.6.1-wso2v2-impl.jar; error in opening zip file
This issue is a pain in my a$$, I have this issue in my Mac,
if I run
mvn clean install | grep "error reading"
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/commons-net/commons-net/3.3/commons-net-3.3.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/commons/commons-lang3/3.0/commons-lang3-3.0.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/javax/mail/mail/1.4/mail-1.4.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/pdfbox/pdfbox/2.0.0/pdfbox-2.0.0.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/com/itextpdf/itextpdf/5.5.10/itextpdf-5.5.10.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/com/aspose/aspose-pdf/11.5.0/aspose-pdf-11.5.0.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/commons-net/commons-net/3.3/commons-net-3.3.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/commons/commons-lang3/3.0/commons-lang3-3.0.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/javax/mail/mail/1.4/mail-1.4.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/apache/pdfbox/pdfbox/2.0.0/pdfbox-2.0.0.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/com/itextpdf/itextpdf/5.5.10/itextpdf-5.5.10.jar; error in opening zip file
[ERROR] error reading /Users/ducnguyen/.m2/repository/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.jar; error in opening zip file
Removing all corrupted libs is the only solution
So I want to remove all of them at once.
mvn clean install | grep "error reading" | awk '{print "rm " $4 | "/bin/sh" }'
The command needs AWK to take libPath string from column $4
Then rerun
mvn clean install
I deleted the affected jar file from Maven external libraries
Then I performed Maven > Reload project which fixed the library by reinstalling
This worked for me without manually downloading a .jar file
For me I should change the .m2 repo in the settings.xml file with another one because in Mac maven can't create a folder that start with point(.)
to solve that, open your maven/version/conf/settings.xml and specify the location of your repo folder like this :
<localRepository>../repo</localRepository>
don't forget to change it also in your IDE, in eclipse go to : Windows > Preferences > Maven > User Settings > Global Settings, and navigate to your settings.xml.
clean install your project.
hope this will help you.
This error occurs because of some file corruption.
But we don't need to delete whole .m2 folder.
Instead find which jar files get corrupted by looking at the error message in the console. And delete only the folders which contains those jar files.
Like in the question :
C:\Users\suresh\.m2\repository\org\jdom\jdom\
C:\Users\suresh\.m2\repository\javax\servlet\servlet-api\
C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-rt-bindings-http
C:\Users\suresh\.m2\repository\org\codehaus\jra\jra
C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-api
C:\Users\suresh\.m2\repository\org\apache\cxf\cxf-common-utilities
Delete these folders.
Then run.
mvn clean install -U
Deleting the entire local m2 repo may not be advisable. As in my case I have hundreds and hundreds of jars in my local, I don't want to re-download them all just for one jar.
Most of the above answers didn't work for me, here is what I did.
STEP:1: Ensure if you are downloading from the correct Maven repo in you settings.xml. In my case it was referring to http://central.maven.org/maven2/ as https://repo1.maven.org/maven2/. So it was getting corrupted or going otherwise?
STEP:2: Delete the folder containing the artifact and other details in your local machine.This will force it download it again upon next build
STEP:3: mvn clean install :).
Hope it helps.
I downloaded the jar file manually and replace the one in my local directory and it worked
You could also check if the required certificates are installed to make sure that it allows the dependencies to be downloaded.

Resources