amit170394 / sardine

Automatically exported from code.google.com/p/sardine
0 stars 0 forks source link

getRecources and put not working #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
final String webDavUser = "user";
final String webDavPass = "pw";
final String webDavServer = "http://somedomain.de:8080/pathA/pathB/"
final Sardine s = SardineFactory.begin(webDavUser,webDavPass);
final InputStream fis = new FileInputStream(new File("c:\lokalFileName.ext")

s.put(webDavServer, fis);
s.getResources(url);

What is the expected output? What do you see instead?
I expect that the file is uploaded and in the result of s.getRessources()
I get this errors on calling the put(_,_) Method:
com.googlecode.sardine.util.SardineException
    at com.googlecode.sardine.SardineImpl.executeWrapper(SardineImpl.java:349)
    at com.googlecode.sardine.SardineImpl.put(SardineImpl.java:251)
    at test.net.schmithuesen.tools.probeSardine.main(probeSardine.java:24)
Caused by: org.apache.http.client.ClientProtocolException
    at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:6
43)
    at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:5
76)
    at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:5
54)
    at com.googlecode.sardine.SardineImpl.executeWrapper(SardineImpl.java:345)
    ... 2 more
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot
retry request with a non-repeatable request entity.
    at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirecto
r.java:474)
    at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:6
41)
    ... 5 more

This ones i get if i try a getRessources(_):
com.googlecode.sardine.util.SardineException: Problem unmarshalling the data
    at
com.googlecode.sardine.util.SardineUtil.getMulitstatus(SardineUtil.java:279)
    at com.googlecode.sardine.SardineImpl.getResources(SardineImpl.java:116)
    at test.net.schmithuesen.tools.probeSardine.main(probeSardine.java:26)
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: Premature end of file.]
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(Abstrac
tUnmarshallerImpl.java:315)
    at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarsh
alException(UnmarshallerImpl.java:503)
    at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Un
marshallerImpl.java:204)
    at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unm
arshallerImpl.java:173)
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerIm
pl.java:137)
    at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerIm
pl.java:184)
    at
com.googlecode.sardine.util.SardineUtil.getMulitstatus(SardineUtil.java:275)
    ... 2 more
Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseExcept
ion(ErrorHandlerWrapper.java:195)
    at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHand
lerWrapper.java:174)
    at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorRep
orter.java:388)
    at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.j
ava:1414)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next
(XMLDocumentScannerImpl.java:1059)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentS
cannerImpl.java:648)
    at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocum
entScannerImpl.java:140)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocum
ent(XMLDocumentFragmentScannerImpl.java:510)
    at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configu
ration.java:807)
    at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configu
ration.java:737)
    at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXPa
rser.java:1205)
    at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXPar
serImpl.java:522)
    at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Un
marshallerImpl.java:200)
    ... 6 more
What version of the product are you using? On what operating system?
I use sardine-80 on win7, i tried it with a JBoss(Tomcat) serving webdav
(basic auth) as well as https://mediacenter.gmx.net

Please provide any additional information below.
This might not be a bug, but i could not find any forum or email of the
owner on this side i could write to. So i file you a bug ;-).
Additionally i needed to get commons-codec-1.4, without it httpClient cried
for BASE64 class missing.

Original issue reported on code.google.com by enigmain...@gmail.com on 2 Mar 2010 at 3:02

GoogleCodeExporter commented 9 years ago
For getRessources(_), what the server returns? JAXB error hints there is some
unexpected response.

Original comment by dynaw...@gmail.com on 2 Mar 2010 at 3:27

GoogleCodeExporter commented 9 years ago
Hmmm... I see your error:
  new File("c:\lokalFileName.ext")
You escaped "l".

Please fix this and check what the server returns for the other method. Until 
then, I
dare to mark this as Invalid.

Original comment by dynaw...@gmail.com on 2 Mar 2010 at 3:29

GoogleCodeExporter commented 9 years ago
By the way: Is your project Maven-based? I noticed your note about 
commons-codec...

Original comment by dynaw...@gmail.com on 2 Mar 2010 at 3:33

GoogleCodeExporter commented 9 years ago
First thx for the fast response!

My project is not maven-based, but i had the maven-integration installed in 
eclipse.
After uninstalling it, i retried without commons-codec with this result:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/codec/binary/Base64
    at org.apache.http.impl.auth.BasicScheme.authenticate(BasicScheme.java:163)
    at org.apache.http.impl.auth.BasicScheme.authenticate(BasicScheme.java:135)
    at
org.apache.http.client.protocol.RequestTargetAuthentication.process(RequestTarge
tAuthentication.java:99)
    at org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:251)
    at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:168)
    at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirecto
r.java:458)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
    at com.googlecode.sardine.SardineImpl.executeWrapper(SardineImpl.java:345)
    at com.googlecode.sardine.SardineImpl.getResources(SardineImpl.java:108)
    at test.net.schmithuesen.tools.probeSardine.main(probeSardine.java:26)
Caused by: java.lang.ClassNotFoundException: 
org.apache.commons.codec.binary.Base64
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)

Original comment by enigmain...@gmail.com on 2 Mar 2010 at 5:11

GoogleCodeExporter commented 9 years ago
@put Method

I did the escape error only here, in my test i used c:/..
To be really on the safe side i use now 
final char sC = File.separatorChar;
new File("c:"+sC+"path"+sC+"localFileName.ext")

PS: I tried webdav4j in the meantime, why did it not fit for you?

Original comment by enigmain...@gmail.com on 2 Mar 2010 at 5:21

GoogleCodeExporter commented 9 years ago
httpclient has a dep on commons-codec. i forgot about that. i've updated the 
wiki page 
and added it to the distribution for the next release.

Original comment by latch...@gmail.com on 2 Mar 2010 at 6:47

GoogleCodeExporter commented 9 years ago
@enigmainkognito: for some reason, sardine is having trouble communicating with 
your 
dav server. maybe it isn't configured correctly. is there anything in the 
tomcat logs 
which would suggest and issue?

Original comment by latch...@gmail.com on 2 Mar 2010 at 6:50

GoogleCodeExporter commented 9 years ago
Ad commons-codec: Ok, I've filed #28.  And now I see it's fixed already :)

Ad PUT - what's the result when you fixed the \ ?

Ad JAXB error - have you checked what the server sends? See Etheral:
http://www.ethereal.com/download.html

Original comment by dynaw...@gmail.com on 2 Mar 2010 at 7:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
@latchkey
I had that idea as well that the server might be answering not correctly, but 
the
problem persists if i use https://mediacenter.gmx.de/
Is there any Webdav testing server online? I could check vs an other host..
I could not find anything in the tomcat logs.

@ondra
-put: the stacktrace is the same as above
-jaxb: i will do it and check the server response and post it here (Ethereal is
wireshark this days)

Original comment by enigmain...@gmail.com on 2 Mar 2010 at 7:19

GoogleCodeExporter commented 9 years ago
i did a networktrace for the get method. See txt file in attachment.

I did also a trace for the put method: Server answers the first request with
"HTTP/1.1 401 Unauthorized" but the client does not try again with auth

Original comment by enigmain...@gmail.com on 2 Mar 2010 at 7:43

Attachments: