[jcifs] Resolution problems

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Tue Aug 6 08:34:01 EST 2002


Try setting baddr=192.168.2.255. On Linux if you don't set this you sometimes get a "Network is unreachable" message (see FAQ). The "Permission denied" message is new to me but that could just be the
equivalent message for FreeBSD. Ultimately Java doesn't provide a way to extract the broadcast address of a machine and trying to send a datagram on 255.255.255.255 can fail.

I suppose it wouldn't be too difficult to determine a reasonable broadcast address based on the local host address and it's IP address classification.

> -----Original Message-----
> From:	Dan Diephouse [SMTP:diephouse at eastnode.com]
> Sent:	Monday, August 05, 2002 4:55 PM
> To:	jcifs at lists.samba.org
> Subject:	[jcifs] Resolution problems
> 
> Hello fellow jcifs users,
> 
> I have downloaded jcifs and am trying to figure out how to use it.  It 
> seems that the "List" program is a good test, so I've been fiddling with 
> that.  Unfortunately, it is not working so hot.  I believe it is having 
> name resolution problems of some sort?
> 
> When I run it, I get the output below.  I am running FreeBSD 4.6 and am 
> trying to connect to a Windows Me machine on my network.  The freebsd 
> machine's address is 192.168.2.36 and the windows machine (presario) is 
> 192.168.2.28 - so they are on the same subnet.  Also, I could use some 
> help deciphering the error messages.  For example, what does this mean:
> 
> Aug 5 16:46:20.969 - name service address cache
>  PRESARIO<1D> 0.0.0.0<00>/0.0.0.0
>  0.0.0.0<00> 0.0.0.0<00>/0.0.0.0
>  JCIFS0_1_7F<20> JCIFS0_1_7F<20>/127.0.0.1
> 
> Here is the output.... I ran another test case which is included after it.
> 
> 
> BEGIN OUTPUT -------------------------------------------
> ocean:70[/home/dan/WDev/jcifs_0.6.5/examples]$ java -classpath $CLASSPATH:../jcifs-0.6.5.jar -Dbaddr=192.168.2.255 -Dlog=ALL List smb://presario
> #properties loaded
> #Mon Aug 05 16:46:20 EDT 2002
> baddr=192.168.2.255
> log=ALL
> java.compiler=NONE
> java.version=1.3.1-p6
> java.home=/usr/local/jdk1.3.1/jre
> java.ext.dirs=/usr/local/jdk1.3.1/jre/lib/ext
> java.vm.version=1.3.1-p6-root-020612-20:16
> java.vm.name=Classic VM
> java.vm.info=green threads, nojit
> java.vm.vendor=Sun Microsystems Inc.
> java.vm.specification.version=1.0
> java.vm.specification.name=Java Virtual Machine Specification
> java.vm.specification.vendor=Sun Microsystems Inc.
> java.class.version=47.0
> java.class.path=.:/usr/local/jdk/lib/tools.jar::../jcifs-0.6.5.jar
> java.runtime.version=1.3.1-p6-root-020612-20:16
> java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
> java.specification.version=1.3
> java.specification.name=Java Platform API Specification
> java.specification.vendor=Sun Microsystems Inc.
> java.io.tmpdir=/var/tmp/
> java.awt.printerjob=sun.awt.motif.PSPrinterJob
> java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
> java.awt.fonts=
> java.library.path=/usr/local/jdk/jre/lib/i386/green_threads:/usr/local/jdk/jre/lib/i386/classic:/usr/local/jdk/jre/lib/i386:/usr/local/jdk/jre/../lib/i386:/usr/lib
> java.vendor.url=http://java.sun.com/
> java.protocol.handler.pkgs=jcifs
> file.separator=/
> file.encoding.pkg=sun.io
> os.version=4.6-STABLE
> os.name=FreeBSD
> os.arch=i386
> user.name=dan
> user.dir=/usr/home/dan/WDev/jcifs_0.6.5/examples
> user.timezone=
> user.home=/home/dan
> user.language=en
> sun.boot.library.path=/usr/local/jdk1.3.1/jre/lib/i386
> sun.boot.class.path=/usr/local/jdk1.3.1/jre/lib/rt.jar:/usr/local/jdk1.3.1/jre/lib/i18n.jar:/usr/local/jdk1.3.1/jre/lib/sunrsasign.jar:/usr/local/jdk1.3.1/jre/classes
> sun.cpu.endian=little
> sun.cpu.isalist=
> sun.io.unicode.encoding=UnicodeBig
> path.separator=:
> line.separator=\n
> 
> Aug 5 16:46:20.954 - name service address cache
>  0.0.0.0<00> 0.0.0.0<00>/0.0.0.0
>  JCIFS0_1_7F<20> JCIFS0_1_7F<20>/127.0.0.1
> 
> Aug 5 16:46:20.962 - nbt name service send:
> java.io.IOException: Permission denied
>         at java.net.PlainDatagramSocketImpl.send(Native Method)
>         at java.net.DatagramSocket.send(DatagramSocket.java:321)
>         at jcifs.netbios.NameServiceClient.send(NameServiceClient.java:222)
>         at jcifs.netbios.NameServiceClient.getByName(NameServiceClient.java:253)
>         at jcifs.netbios.NbtAddress.doNameQuery(NbtAddress.java:311)
>         at jcifs.netbios.NbtAddress.getByName(NbtAddress.java:390)
>         at jcifs.UniAddress$QueryThread.run(UniAddress.java:77)
> Aug 5 16:46:20.969 - name service address cache
>  PRESARIO<1D> 0.0.0.0<00>/0.0.0.0
>  0.0.0.0<00> 0.0.0.0<00>/0.0.0.0
>  JCIFS0_1_7F<20> JCIFS0_1_7F<20>/127.0.0.1
> 
> Aug 5 16:46:20.971 - nbt name service send:
> java.io.IOException: Permission denied
>         at java.net.PlainDatagramSocketImpl.send(Native Method)
>         at java.net.DatagramSocket.send(DatagramSocket.java:321)
>         at jcifs.netbios.NameServiceClient.send(NameServiceClient.java:222)
>         at jcifs.netbios.NameServiceClient.getByName(NameServiceClient.java:253)
>         at jcifs.netbios.NbtAddress.doNameQuery(NbtAddress.java:311)
>         at jcifs.netbios.NbtAddress.getByName(NbtAddress.java:390)
>         at jcifs.UniAddress$QueryThread.run(UniAddress.java:77)
> Aug 5 16:46:20.976 - name service address cache
>  PRESARIO<1D> 0.0.0.0<00>/0.0.0.0
>  0.0.0.0<00> 0.0.0.0<00>/0.0.0.0
>  PRESARIO<20> 0.0.0.0<00>/0.0.0.0
>  JCIFS0_1_7F<20> JCIFS0_1_7F<20>/127.0.0.1
> 
> Exception in thread "main" java.net.UnknownHostException: presario
>         at jcifs.UniAddress.getByName(UniAddress.java:269)
>         at jcifs.smb.SmbURL.parseSmbURL(SmbURL.java:76)
>         at jcifs.smb.SmbFile.<init>(SmbFile.java:371)
>         at jcifs.smb.SmbFile.<init>(SmbFile.java:324)
>         at List.main(List.java:28)
> 
> END OUTPUT -------------------------------------------
> 
> It seems above that it is trying to use 127.0.0.1 instead of 192.168.2.36.  So I also tried one other run, with the "laddr" property defined.  I omitted the java properties this time around...
> 
> BEGIN OUTPUT -------------------------------------------
> ocean:71[/home/dan/WDev/jcifs_0.6.5/examples]$ java -classpath $CLASSPATH:../jcifs-0.6.5.jar -Dbaddr=192.168.2.255 -Dlog=ALL -Dladdr=192.168.2.36 List smb://presario
> #properties loaded
> #Mon Aug 05 16:49:39 EDT 2002
> baddr=192.168.2.255
> laddr=192.168.2.36
> log=ALL
> .
> .
> .
> 
> Aug 5 16:49:39.712 - name service address cache
>  0.0.0.0<00> 0.0.0.0<00>/0.0.0.0
>  JCIFS2_36_52<20> JCIFS2_36_52<20>/192.168.2.36
> 
> Aug 5 16:49:39.718 - nbt name service send:
> java.io.IOException: Permission denied
>         at java.net.PlainDatagramSocketImpl.send(Native Method)
>         at java.net.DatagramSocket.send(DatagramSocket.java:321)
>         at jcifs.netbios.NameServiceClient.send(NameServiceClient.java:222)
>         at jcifs.netbios.NameServiceClient.getByName(NameServiceClient.java:253)
>         at jcifs.netbios.NbtAddress.doNameQuery(NbtAddress.java:311)
>         at jcifs.netbios.NbtAddress.getByName(NbtAddress.java:390)
>         at jcifs.UniAddress$QueryThread.run(UniAddress.java:77)
> Aug 5 16:49:39.723 - name service address cache
>  PRESARIO<1D> 0.0.0.0<00>/0.0.0.0
>  0.0.0.0<00> 0.0.0.0<00>/0.0.0.0
>  JCIFS2_36_52<20> JCIFS2_36_52<20>/192.168.2.36
> 
> Aug 5 16:49:39.725 - nbt name service send:
> java.io.IOException: Permission denied
>         at java.net.PlainDatagramSocketImpl.send(Native Method)
>         at java.net.DatagramSocket.send(DatagramSocket.java:321)
>         at jcifs.netbios.NameServiceClient.send(NameServiceClient.java:222)
>         at jcifs.netbios.NameServiceClient.getByName(NameServiceClient.java:253)
>         at jcifs.netbios.NbtAddress.doNameQuery(NbtAddress.java:311)
>         at jcifs.netbios.NbtAddress.getByName(NbtAddress.java:390)
>         at jcifs.UniAddress$QueryThread.run(UniAddress.java:77)
> Aug 5 16:49:39.730 - name service address cache
>  PRESARIO<1D> 0.0.0.0<00>/0.0.0.0
>  0.0.0.0<00> 0.0.0.0<00>/0.0.0.0
>  PRESARIO<20> 0.0.0.0<00>/0.0.0.0
>  JCIFS2_36_52<20> JCIFS2_36_52<20>/192.168.2.36
> 
> Exception in thread "main" java.net.UnknownHostException: presario
>         at jcifs.UniAddress.getByName(UniAddress.java:269)
>         at jcifs.smb.SmbURL.parseSmbURL(SmbURL.java:76)
>         at jcifs.smb.SmbFile.<init>(SmbFile.java:371)
>         at jcifs.smb.SmbFile.<init>(SmbFile.java:324)
>         at List.main(List.java:28)
> 
> END OUTPUT -------------------------------------------
> 
> Thanks,
> 
> -- 
> Dan Diephouse
> http://eastnode.com
> 
> 
> 





More information about the jcifs mailing list