cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent help! address already in use error with alfresco-jlan

wanderwang168
Champ in-the-making
Champ in-the-making
Hello, Everyone,

I am trying to develop an Android samba server application with alfresco-jlan library. I always met the below error after I stop/restart samba server if client failed to connect my server, could anyone help me? Thank you very much!!!

I/System.out( 3769): NetBIOSNameServer setup error:java.net.BindException: The address is already in use
E/WiFi IP ( 3769): 192.168.2.6
E/CifsServer( 3769): ++ServerStartup++
E/CifsServer( 3769): ServerStartup, Server name:server
E/CifsServer( 3769): ++ServerStartup++, after show notification
I/System.out( 3769): [SMB] CIFS Server DROID starting
I/System.out( 3769): [SMB] Version 5.0.0, Java VM 1.1.0, OS Linux, version 2.6.29-omap1
I/System.out( 3769): [SMB] Using authenticator org.alfresco.jlan.server.auth.LocalAuthenticator, mode=USER
I/System.out( 3769): [SMB] Server timezone offset = 0hrs
I/System.out( 3769): [SMB] Dialects enabled = [Core,CorePlus,DOS LANMAN 1.0,LANMAN1.0,DOS LANMAN 2.1,LM1.2X002,LANMAN2.1,NT LM 0.12]
I/System.out( 3769): [SMB] Shares:
I/System.out( 3769): [SMB]  [mile,DISK,ACLs=1,[/sdcard]] [/sdcard]
E/CifsServer( 3769): ++ configurationChanged ++
E/CifsServer( 3769): Configure ID Change is:  131075
E/CifsServer( 3769): ServerError: java.net.BindException: The address is already in use
E/CifsServer( 3769): ServerActive
E/CifsServer( 3769): ++NetBIOSNameServer ServerShutdown++
E/CifsServer( 3769): ++ configurationChanged ++
E/CifsServer( 3769): Configure ID Change is:  131075
I/System.out( 3769): [SMB] Added NTServer flag to host announcement
I/System.out( 3769): [SMB] Server error : org.alfresco.jlan.server.config.InvalidConfigurationException: Error initializing TCP-IP SMB session handler, The address is already in use
I/System.out( 3769): org.alfresco.jlan.server.config.InvalidConfigurationException: Error initializing TCP-IP SMB session handler, The address is already in use
I/System.out( 3769):    at org.alfresco.jlan.smb.server.nio.NIOCifsConnectionsHandler.initializeHandler(NIOCifsConnectionsHandler.java:256)
I/System.out( 3769):    at org.alfresco.jlan.smb.server.SMBServer.run(SMBServer.java:513)
I/System.out( 3769):    at java.lang.Thread.run(Thread.java:1096)
E/CifsServer( 3769): ServerError: org.alfresco.jlan.server.config.InvalidConfigurationException: Error initializing TCP-IP SMB session handler, The address is already in use
I/System.out( 3769): [SMB] SMB Server shutting down …
2 REPLIES 2

wanderwang168
Champ in-the-making
Champ in-the-making
I attach my config file. Thanks.


<?xml version="1.0" standalone="no"?>
<!– <!DOCTYPE jlanserver SYSTEM "jlanserver.dtd"> –>

<jlanserver>
  <servers>
    <SMB/>
    <noFTP/>
    <noNFS/>
  </servers>
   
  <SMB>
    <host name="droid" domain="WORKGROUP">
      <broadcast>255.255.255.255</broadcast>
     
      <smbdialects>Core,LanMan,NT</smbdialects>
     
      <comment>Samba Server</comment>
      <bindto adapter="tiwlan0"/>
<!–        
     <bindto>192.168.0.100</bindto>
–>
   
      <!– Requires running the server using the root account –>
      <!–
      <netBIOSSMB platforms="linux,macosx,solaris"/>
      <tcpipSMB platforms="linux,macosx,solaris"/>
     –>
      <Win32NetBIOS/>
      <Win32Announce interval="5"/>
      <!– To run the server using a non-root account on linux, Mac OS X, Solaris –>
      
      <tcpipSMB port="1445" platforms="linux,macosx,solaris"/>
      <netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,macosx,solaris"/>

      <hostAnnounce interval="5"/>
     
    </host>
<!– 
    <HostAnnouncerPort> 1138 </HostAnnouncerPort>
–>     
<!–
    <sessionDebug flags="Negotiate,Socket,State,Lock,Tree,Info,Search,Netbios,Error,File,Fileio,Transact,Ipc,Notify,Pkttype,Dcerpc"/>
–>    
    <sessionDebug flags="Negotiate,Socket,State,Lock,Tree,Info,Search,Netbios,Error,Transact,Ipc,Notify,Pkttype,Dcerpc"/>

    <netbiosDebug/>
    <announceDebug/>
   
   <authenticator type="enterprise">   
      <class>org.alfresco.jlan.server.auth.LocalAuthenticator</class>
      <mode>USER</mode>
      <allowGuest/>     
       <Debug/>
   </authenticator>
     
  </SMB>

  <FTP>
    <port>21</port>
    <allowAnonymous/>
    <debug flags="File,Search,Error,DataPort,Directory"/>
  </FTP>
   
  <NFS>
    <enablePortMapper/>
    <debug flags="File,FileIO"/>
  </NFS>



  <shares>
    <diskshare name="mile" comment="Android Phone Share Directory">
      <driver>
        <class>org.alfresco.jlan.smb.server.disk.JavaFileDiskDriver</class>
        <LocalPath>/sdcard</LocalPath>
      </driver>
     <accessControl default="Write">
         <user name="jlan" access = "Write"/>
     </accessControl>
    </diskshare>
  </shares>      


  <security>
    <JCEProvider>cryptix.jce.provider.CryptixCrypto</JCEProvider>
    <authenticator>
      <class>org.alfresco.jlan.server.auth.LocalAuthenticator</class>
      <mode>USER</mode>
     <allowGuest/>
    </authenticator>
   
    <globalAccessControl default="Write">
        <user name = "jlan" access = "Write"/>
   
    </globalAccessControl>
  
  <!–    
   <accessControlManager>
      <class>org.alfresco.jlan.server.auth.acl.DefaultAccessControlManager</class>
      <debug/>
      <rule>org.alfresco.jlan.server.auth.acl.UserAccessControlParser</rule>
   </accessControlManager>
–>   
   
    <users>
      <user name="jlan">
        <password>jlan</password>
        <realname>Administrator</realname>
        <comment>System administrator</comment>
        <administrator/>
      </user>

    </users>

  </security>
</jlanserver>

wanderwang168
Champ in-the-making
Champ in-the-making
Also some of my source code.

Start server thread:
        if ( srvConfig.numberOfServers() > 0) {
          
            //   Clear the shutdown flag
   
            m_shutdown = false;
   

          //   Start the servers
   
             for ( int i = 0; i < srvConfig.numberOfServers(); i++) {
      
              srvConfig.getServer(i).startServer();
              }
   
       //   Wait for shutdown request
   
        while ( m_shutdown == false) {
             try {
                 Thread.sleep(250);
             }
             catch (Exception ex) {
             }
         }



Stop server thread;
      m_shutdown = true;
            //   Check if the server list is valid
      
      try{
            
            if ( srvConfig.numberOfServers() > 0) {

               //   Shutdown the servers
                  
               for ( int i = 0; i < srvConfig.numberOfServers(); i++) {
                     
   
                  srvConfig.getServer(i).shutdownServer(false);
               }            

         }
      }catch(Exception ex){
         Log.e(TAG, "Shutdown error: " + ex);
      }