[jcifs] JCIFS error

Benjamin Farr Benjamin.Farr at mim.com.au
Mon Jul 22 12:27:36 EST 2002


Michael,

I setup a properties file and that is working fine. I removed the timeout
settings. 


I believe the server is Novell.

The file does get created on the server but has an exception with
f.exists();

This is the exeption output of checking for f.exists();

S : Timeout waiting for response from server.
dev.holdings.mim.com.au/158.54.111.195 Jul 22 12:19:10.211 - exception
reading from socket input java.net.SocketException: Descriptor not a socket:
JVM_recv in socket input stream read 	int
java.net.SocketInputStream.socketRead(byte[], int, int) 	int
java.net.SocketInputStream.read(byte[], int, int) 	int
jcifs.netbios.SessionServicePacket.readPacketType(java.io.InputStream,
byte[], int) 	int jcifs.netbios.SocketInputStream.read(byte[], int, int)
int jcifs.netbios.SocketInputStream.read() 	int
java.io.FilterInputStream.read() 	int
java.io.PushbackInputStream.read() 	void jcifs.smb.SmbTransport.run()
void java.lang.Thread.run() jcifs.smb.SmbException: Timeout waiting for
response from server. dev.holdings.mim.com.au/158.54.111.195 	void
jcifs.smb.SmbTransport.sendTransaction(jcifs.smb.SmbComTransaction,
jcifs.smb.SmbComTransactionResponse) 	void
jcifs.smb.SmbSession.sendTransaction(jcifs.smb.SmbComTransaction,
jcifs.smb.SmbComTransactionResponse) 	void
jcifs.smb.SmbTree.sendTransaction(jcifs.smb.SmbComTransaction,
jcifs.smb.SmbComTransactionResponse) 	void
jcifs.smb.SmbFile.sendTransaction(jcifs.smb.SmbComTransaction,
jcifs.smb.SmbComTransactionResponse) 	jcifs.smb.Info
jcifs.smb.SmbFile.queryPath(int) 	boolean jcifs.smb.SmbFile.exists()
void com.mim.mimsj.hr.HREmpPhotos.createFile(java.io.InputStream,
java.lang.String, java.lang.String, java.lang.String, java.lang.String,
java.lang.String) 	java.lang.String
com.mim.mimsj.hr.HREmpPhotos.uploadFile(javax.servlet.http.HttpServletReques
t) 	void _HREmpPhoto3._jspService(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) 	void
oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) 	void
oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequ
est, javax.servlet.http.HttpServletResponse, java.lang.String) 	void
oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServl
etRequest, javax.servlet.http.HttpServletResponse) 	void
oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletReques
t, javax.servlet.http.HttpServletResponse) 	void
javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) 	void
com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.Servl
etRequest, javax.servlet.ServletResponse) 	void
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.serv
let.ServletRequest, javax.servlet.http.HttpServletResponse) 	boolean
com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.serv
er.ApplicationServerThread,
com.evermind.server.http.EvermindHttpServletRequest,
com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream,
java.io.OutputStream, boolean) 	void
com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread) 	void
com.evermind.util.ThreadPoolThread.run() 



// Function 
public static void createFile(InputStream aSrc,String aHost,String
aUserName,String aPassword,String aPath,String aFilename) throws
MimException{
    SmbFileOutputStream smbOut = null;

    try { 
      SmbFile f = new SmbFile("smb://"+aUserName+":" + aPassword +
"@"+aHost+aPath+ "/" +aFilename);
      smbOut = new  SmbFileOutputStream(f);
       try {
          if( f.exists()) { 
          } 
          else {
          }    
         }
         catch(Exception e){
           System.out.println("S : " + e.getMessage());
           e.printStackTrace();
           throw new MimException(e);
         }
      byte[] b = new byte[1024];
      int n;
      while(( n = aSrc.read( b )) > 0 ) {    
         System.out.println(n + " bytes read this time");
         try {
              smbOut.write(b, 0, n );
         }
         catch (Exception e) {
            System.out.println("A : " + e.getMessage());
              e.printStackTrace();
    
         }
      }
      smbOut.close();
    }
    catch(Exception e) {
      throw new MimException(e);
    }
  }

-----Original Message-----
From: Allen, Michael B (RSCH) [mailto:Michael_B_Allen at ml.com]
Sent: Monday, 22 July 2002 11:15
To: 'Benjamin Farr'; 'jcifs at samba.org'
Subject: RE: [jcifs] JCIFS error




> -----Original Message-----
> From:	Benjamin Farr [SMTP:Benjamin.Farr at mim.com.au]
> 
> 
>     try {
>       
>       /*
>       if( f.exists()) { 
	[Allen, Michael B (RSCH)]  

	If you test f.exists(), that will result in an additional network
message. If you want to delete the file just call try { f.delete() } catch(
SmbException se ) { // do nothing }.

>         // should delete it ????  
>       } else {
> 
>       }    */
>     }catch(Exception e){
>       throw new MimException(e);
>     }
>     try { 
>     
>       System.setProperty( "jcifs.smb.client.username", "meo" );
>       System.setProperty( "jcifs.smb.client.password", "meo123" );
>       System.setProperty( "jcifs.smb.client.domain", "mimh" );
>       System.setProperty( "jcifs.smb.client.responseTimeout", "50000" );
>       System.setProperty( "jcifs.smb.client.soTimeout", "50000" );
>       System.setProperty( "jcifs.netbios.soTimeout", "15000" );
>       
	[Allen, Michael B (RSCH)]  You cannot set properties like this. Read
the
	javadoc page on Setting Client Properties. In short you cannot set
properties after
	you have referenced Smb* classes. It would be best if you used a
properties file and
	specified it's location *before* referencing any jcifs classes like:

	  System.setProperty( "jcifs.properties", "myjcifs.prp" );
	  SmbFile f = new SmbF...

	Technically the above might work but not always so the general rule
is don't do it. As for
	the Exception, that might mean jCIFS is incompatible with the
server. What type of server
	is it? Is it NetApp? Novell? Jim's Smb Server 2.0?

	Also, you shouldn't have to mess with responseTimeout or soTimeout.
If it takes longer
	than 2 seconds for the client to do it's thing there's something
wrong.

	Fix that and let us know if the problem persists.

	Mike


**********************************************************************
The information contained in this e-mail is confidential and is
intended only for the use of the addressee(s).
If you receive this e-mail in error, any use, distribution or
copying of this e-mail is not permitted. You are requested to
forward unwanted e-mail and address any problems to the
MIM Holdings Limited Support Centre.

For general enquires:	++61 7 3833 8000
Support Centre e-mail:	supportcentre at mim.com.au
Support Centre phone:  	Australia 1800500646
        				International ++61 7 38338042
**********************************************************************





More information about the jcifs mailing list