[jcifs] RE: Write files to shared location

Michael B Allen ioplex at gmail.com
Mon Dec 8 19:20:57 GMT 2008

On Mon, Dec 8, 2008 at 10:28 AM,  <John.Baker at barclayscapital.com> wrote:
> Hi,
> Why can't you use an SmbFile per thread?

You can use an SmbFile per thread.

My interpretation of what Shushil is doing is using one single SmbFile
instance with multiple threads. That is not thread-safe and could
easily explain the protocol error observed.


>> -----Original Message-----
>> From:
>> jcifs-bounces+john.baker=barclayscapital.com at lists.samba.org
>> [mailto:jcifs-bounces+john.baker=barclayscapital.com at lists.sam
>> ba.org] On Behalf Of Duseja, Sushil
>> Sent: 08 December 2008 15:16
>> To: Michael B Allen
>> Cc: jcifs at lists.samba.org; Rally, Menka
>> Subject: [jcifs] RE: Write files to shared location
>> Hello Mike,
>> Thanks for the response.
>> You are right; I am using multiple threads with one SmbFile
>> instance but that is precisely my requirement. I need to use
>> multiple threads for the processing (that includes creating files).
>> Can you please suggest a workaround? Or else, can you please
>> let me know if I can use java.io.File instance for my purpose
>> (creating files at password protected network location)?
>> Thanks!
>> -----Original Message-----
>> From: Michael B Allen [mailto:ioplex at gmail.com]
>> Sent: Monday, December 08, 2008 12:50 AM
>> To: Duseja, Sushil
>> Cc: jcifs at lists.samba.org
>> Subject: Re: Write files to shared location
>> On Sun, Dec 7, 2008 at 1:45 PM, Duseja, Sushil
>> <sushil.duseja at fiserv.com> wrote:
>> > Hello,
>> >
>> > I am required to write/save (large number of) files
>> (approx. 10000) to
>> a
>> > (secured) shared drive location (using jCIFS 1.3.1). If a file with
>> the same
>> > name already exists, a new file needs to be created with an index
>> higher
>> > than the previous one.
>> >
>> > I am using the constuctor -
>> > SmbFile("smb://domain;username:password@server/..../") or
>> this purpose
>> and I
>> > can connect to the shared location successfully; however during the
>> creation
>> > of files, after generating few files, an Smbexception is thrown.
>> >
>> > Here's the stacktrace:-
>> >
>> > jcifs.smb.SmbException: The parameter is incorrect.
>> >         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
>> >         at jcifs.smb.SmbTransport.send(SmbTransport.java:644)
>> >         at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:356)
>> >         at jcifs.smb.SmbSession.send(SmbSession.java:234)
>> >         at jcifs.smb.SmbTree.treeConnect(SmbTree.java:161)
>> >         at jcifs.smb.SmbTree.send(SmbTree.java:66)
>> >         at jcifs.smb.SmbFile.send(SmbFile.java:729)
>> >         at jcifs.smb.SmbFile.queryPath(SmbFile.java:1308)
>> >         at jcifs.smb.SmbFile.exists(SmbFile.java:1362)
>> Unless you're doing something bad like using multiple threads
>> with the same SmbFile instance, the "parameter is incorrect"
>> error should never occur and thus this would be a bug.
>> The fastest way to find out what's going on is to get a
>> packet capture. If you do get a packet capture of the error,
>> make sure you send it to me directly. Do not post packet
>> captures to public mailing lists.
>> Mike
>> PS: It's considered very bad form to use credentials in the
>> URL. Use (and re-use) an NtlmPasswordAuthentication object.
>> --
>> Michael B Allen
>> PHP Active Directory SPNEGO SSO
>> http://www.ioplex.com/
> _______________________________________________
> This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
> _______________________________________________

Michael B Allen
PHP Active Directory SPNEGO SSO

More information about the jcifs mailing list