jfrog / artifactory-client-java

Artifactory REST Client Java API bindings
Apache License 2.0
319 stars 153 forks source link

Error when deploying artifact with services-0.8-all #15

Open triaubaral opened 11 years ago

triaubaral commented 11 years ago

Hey Baruch,

I am using services-0.8-all.jar for trying to deploy artifact on artifactory and I wrote this code to make it works.

Artifactory artifactory = org.jfrog.artifactory.client.ArtifactoryClient.create("http://myip:8080/artifactory", username, password);

java.io.File file = new File("path/to/my/local/jar");

RepositoryHandle repoHandle = artifactory.repository(repoWhereToUpload);

UploadableArtifact uploadable = repoHandle.upload("path/to/remote/jar/to/create",file);

uploadable.doUpload();

When I execute the preceding code I've got this message :

Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: org.jfrog.artifactory.client.impl.ArtifactoryImpl.put() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, java.util.LinkedHashMap, java.io.BufferedInputStream, java.util.LinkedHashMap, java.lang.Class, groovyx.net.http.ContentType, java.lang.Long) values: [/jk_p/02.12.00/jk_p-02.12.00.jar, ...] Possible solutions: wait(), any(), dump(), find(), grep() at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:51) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.jfrog.artifactory.client.impl.UploadableArtifactImpl$_uploadContent_closure1.doCall(UploadableArtifactImpl.groovy:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) at groovy.lang.Closure.call(Closure.java:411) at groovy.lang.Closure.call(Closure.java:427) at org.codehaus.groovy.runtime.IOGroovyMethods.withStream(IOGroovyMethods.java:1160) at org.codehaus.groovy.runtime.dgm$709.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.jfrog.artifactory.client.impl.UploadableArtifactImpl.uploadContent(UploadableArtifactImpl.groovy:60) at org.jfrog.artifactory.client.impl.UploadableArtifactImpl.this$3$uploadContent(UploadableArtifactImpl.groovy) at org.jfrog.artifactory.client.impl.UploadableArtifactImpl$this$3$uploadContent.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at org.jfrog.artifactory.client.impl.UploadableArtifactImpl.doUpload(UploadableArtifactImpl.groovy:52) at fr.cnamts.repo.rest.Main.testArtifactory(Main.java:270) at fr.cnamts.repo.rest.Main.main(Main.java:160)

Have you got any idea where it could be from ?

Thanks

I am running with : ->eclipse galileo ->Windows 7 -> jdk 1.7.0_13

triaubaral commented 11 years ago

Hi Baruch,

I solved my problem in order to make it works. I forget to put a good username and password.

File testFile = new File("/path/to/libToUpload.jar");

private final String NEW_LOCAL = "http://"+username+":"+password+"@localhost:8081/artifactory";

artifactory.repository(NEW_LOCAL).upload("libs-release-local/junit/junit/4.9/juni-4.9.jar", testFile).doUpload();

Thanks for the lib services-0.8-all.jar, it's brilliant ;o)

jbaruch commented 11 years ago

Thank you for pointing it out, it shouldn't fail that ugly for lack of username and password.

And I glad you like it. More feedback, please :)

jbaruch commented 11 years ago

I am trying to reproduce and not sure what you meant by "I forget to put a good username and password". Did you run it without username and password? If it was Java, you probably wouldn't be able to compile it? Please help me here :)

Thanks!

triaubaral commented 11 years ago

I created a simple maven project under eclipse with a jdk jdk 1.7.0_13 and I created a dependency on services-0.8-all.jar. Then, I wrote a unit test (the one you can see in my first post) in order to make a simple upload.

I did the test matching the above description at work and I get the stacktrace I gave you in my first post. Now, I am on holidays and I try again at home the same scenario. I wanted to change a little bit my strategy in order to not get the same error again, I wrote the code you can see in my second post and this time it works. The only thing I changed, was in my memory, the username and password.

Unfortunately I try to reproduce at home the same error with the code I used for my first post and it works as well. I don't get the stacktrace anymore... I will come back at work in three weeks, I will check it out and I will give you more details on what happened exactly. I hope I did not bother you for nothing :-(

jbaruch commented 11 years ago

No worries, my friend. Thank you for tying it out for us!

I'll keep the issue open, but if you won't be able to reproduce it, feel free to close it at will.