commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Schuster <st...@wilken.de>
Subject Re: VFS problem with StaticUserAuthenticator
Date Fri, 06 Jun 2008 10:33:00 GMT
hi yannick,

i've no experiences with smb over commons-vfs but i am pretty sure that 
it works - at least basically. before looking after another library i 
would recommend to track down the errors you receive with vfs. for 
example you should try to figure out why the url you provided is "badly 
formed" even though it looks ok on the first glimpse.

maybe there are other who have more experiences in this area.


good luck,
stephan


Yannick PIERSON wrote:
> Hi,
> 
> I've done what you have explain to me. For webdav it's working now, but i
> can't access to a share folder on windows thanks to smb protocol. Is there
> an another library to perform that?
> 
> My error:
> INFO: Using "C:\DOCUME~1\pierson\LOCALS~1\Temp\vfs_cache" as temporary files
> store.
> 6 juin 2008 11:37:45 test.UserApplicatif resolveFile
> GRAVE: null
> org.apache.commons.vfs.FileSystemException: Badly formed URI
> "smb://host:445/share_windows/test.txt".
>         at
> org.apache.commons.vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:85)
>         at
> org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:662)
>         at
> org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:582)
>         at test.UserApplicatif.resolveFile(UserApplicatif.java:83)
>         at test.TestUserApp.main(TestUserApp.java:28)
> Caused by: java.net.MalformedURLException: unknown protocol: smb
>         at java.net.URL.<init>(URL.java:574)
>         at java.net.URL.<init>(URL.java:464)
>         at java.net.URL.<init>(URL.java:413)
>         at
> org.apache.commons.vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:66)
>         ... 4 more
> Exception in thread "main" java.lang.NullPointerException
> 
> 
> 2008/6/6 Stephan Schuster <stsch@wilken.de>:
> 
>> hi yannick!
>>
>>  Is the code working with a newer version of httpclient than
>>> 2.0.2<http://2.0.2./>or must I use the patch you have posted to the
>>> forum ?
>>>
>> here is what you have to do to use commons-vfs with webdav based on
>> httpclient 3.0.1 (probably even 3.1 - i havn't tested it yet but there where
>> posting that it should work with 3.1 as well, i'm sure it will!):
>>
>> - in order to use commons-vfs jars with httpclient 3.0.1 you have to patch
>> commons-vfs (see [1])
>> - you have to use the webdavclient4j jars instead of the jakarta slide jars
>>
>> the easiest way to achieve all this is to checkout webdavclient4j (see [2])
>> and execute the ant target called "all". amongst others this will generate a
>> folder named "dist/vfs/lib" which contains all jars you need:
>>
>> // httpclient
>> - commons-httpclient-3.0.1.jar
>>
>> // commons-vfs (patched with vfs-74)
>> - commons-vfs-1.1-patched-hc301-SNAPSHOT.jar
>>
>> // the core webdav functionality (replaces slide)
>> - webdavclient4j-core-0.91.jar
>>
>> // webdav providers for vfs -> the bridge between webdavclient4j and vfs
>> (replaces vfs-sandbox stuff)
>> - webdavclient4j-vfs-0.91.jar
>>
>> // dependencies
>> - commons-codec-1.3.jar
>> - commons-logging.jar
>> - jdom-1.0.jar
>>
>>
>> [1] http://issues.apache.org/jira/browse/VFS-74
>> [2] http://sourceforge.net/svn/?group_id=223624
>>
>>
>> cheers,
>> stephan
>>
>>
>>
>>
>>
>>
>>> Thanks a lot for your help,
>>>
>>> Yannick
>>>
>>> 2008/6/5 Stephan Schuster <stsch@wilken.de>:
>>>
>>>  hi yannick,
>>>> the short answer: i had the same problem about a week ago and fixed it!
>>>>
>>>> the long answer: as you probably know commons-vfs uses jakarta slide for
>>>> its webdav support. however, jakarta slide unfortunately retired at the
>>>> of
>>>> 2007. that's why jason harrop startet webdavclient4j [1] a few weeks ago.
>>>> it
>>>> is a new project that basically ports and improves the slide sources, for
>>>> example you can use a newer version of httpclient than 2.0.2. but most
>>>> important it integrates nicely with commons-vfs and vfsjfilechooser. i
>>>> use
>>>> both in my current project.
>>>>
>>>> now, why am i telling you this???
>>>>
>>>> because i experienced the same problem a few weeks ago. the reason is
>>>> that
>>>> the webdav provider (of jakarta slide / webdavclient4j) does not respect
>>>> the
>>>> credentials set via StaticUserAuthenticator and
>>>> DefaultFileSystemConfigBuilder. so i checked out the code of
>>>> webdavclient4j
>>>> and fixed it along with the implementation of an additional provider:
>>>> webdavs (webdav over https). afterwards i posted the patch to the
>>>> website's
>>>> forum [3] and sent it per mail to jason harrop. so far he obviously
>>>> hadn't
>>>> had the time to apply the patch and release a new version of
>>>> webdavclient4j.
>>>> that's why you have to checkout webdavclient4j, patch it with the stuff i
>>>> wrote, build it yourself and then use it with commons-vfs. of course you
>>>> could do the same with jakarta slide but i wouldn't recommend that since
>>>> it's a dead project. besides that i could send you my build of
>>>> webdavclient4j but i'm not sure if that is what jason harrop wants. so i
>>>> can't do this unless he tells me to do so.
>>>>
>>>> hope that helps.
>>>>
>>>>
>>>> cheers,
>>>> stephan
>>>>
>>>> ps: @jason: if you want you could grant me developer rights for your
>>>> projects. then i could do the necessary stuff myself and help yannick.
>>>>
>>>>
>>>> [1] http://sourceforge.net/projects/webdavclient4j/
>>>> [2] http://vfsjfilechooser.sourceforge.net
>>>> [3]
>>>> http://sourceforge.net/forum/forum.php?thread_id=2057078&forum_id=806778
>>>>
>>>>
>>>>
>>>>
>>>> Yannick PIERSON wrote:
>>>>
>>>>  Hi,
>>>>> I'm using commons VFS and  I get a problem.
>>>>>
>>>>> To access to virtual file system, I'm using this authentification :
>>>>> this.auth = new StaticUserAuthenticator(credentials.getDomain(),
>>>>> credentials.getUsername(), credentials.getPassword());
>>>>>
>>>>> This code works whith smb protocol (share windows), but doesn't work
>>>>> with
>>>>> webdav :
>>>>> For it I must write the url -> webdav://user:password@host
>>>>> :port/directory.
>>>>> And this code works...
>>>>>
>>>>> But I want to use the same authentification that I'm using for smb.
>>>>>
>>>>> Do you know why it doesn't work ?
>>>>>
>>>>> I think my problem is on the realm definition.
>>>>>
>>>>> My error trace :
>>>>> ATTENTION: No credentials available for the 'WORKGROUP' authentication
>>>>> realm
>>>>> at host
>>>>> Exception in thread "main" org.apache.commons.vfs.FileSystemException:
>>>>> Could
>>>>> not determine the type of file "webdav://host/directory/testFile.txt".
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1345)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.commons.vfs.provider.AbstractFileObject.getType(AbstractFileObject.java:443)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileObject.java:433)
>>>>>       at test.UserApp.main(UserApp.java:38)
>>>>> Caused by: org.apache.commons.vfs.FileSystemException
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.commons.vfs.provider.webdav.WebdavFileObject.setDavResource(WebdavFileObject.java:190)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.commons.vfs.provider.webdav.WebdavFileObject.doAttach(WebdavFileObject.java:92)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1331)
>>>>>       ... 3 more
>>>>> Caused by: org.apache.commons.httpclient.HttpException
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3517)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3472)
>>>>>       at
>>>>>
>>>>> org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:976)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.webdav.lib.WebdavResource.setDefaultProperties(WebdavResource.java:963)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1923)
>>>>>       at
>>>>>
>>>>>
>>>>> org.apache.commons.vfs.provider.webdav.WebdavFileObject.setDavResource(WebdavFileObject.java:186)
>>>>>       ... 5 more
>>>>>
>>>>> Regards,
>>>>>
>>>>> Thanks,
>>>>>
>>>>>
>>>>>  ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>>
>>>>
>>>>
>> --
>>
>> Viele Grüße,
>> Stephan Schuster
>> __________________________________________________________
>>
>> Abt.: Systementwicklung       Wilken GmbH
>> Tel: (+49)0731/9650-324       Software. Menschen. Service.
>> Fax: (+49)0731/9650-767
>> E-Mail: stsch@wilken.de       Hörvelsinger Weg 25-29
>> Internet: www.wilken.de       D-89081 Ulm
>>
>> Wilken GmbH, HRB Ulm 794, GF: Dr. Andreas Lied
>> __________________________________________________________
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
> 

-- 

Viele Grüße,
Stephan Schuster
__________________________________________________________

Abt.: Systementwicklung       Wilken GmbH
Tel: (+49)0731/9650-324       Software. Menschen. Service.
Fax: (+49)0731/9650-767
E-Mail: stsch@wilken.de       Hörvelsinger Weg 25-29
Internet: www.wilken.de       D-89081 Ulm

Wilken GmbH, HRB Ulm 794, GF: Dr. Andreas Lied
__________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message