[jcifs] java.lang.NullPointerException at jcifs.UniAddress.lo okupServerOr Workgroup

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Tue Jun 24 08:32:38 EST 2003



> -----Original Message-----
> From:	Rooij, Bas van [SMTP:basvan_rooij at merck.com]
> Sent:	Monday, June 23, 2003 8:45 AM
> To:	'jcifs at lists.samba.org'
> Subject:	[jcifs] java.lang.NullPointerException at jcifs.UniAddress.lookupServerOr Workgroup
> 
> Hello,
> 
> I'm getting the following error when using the NtlmHttpFilter (jcifs v
> 0.7.3) with Tomcat 4.1.12 on linux (Red Hat 8.0) and XP client desktops with
> IE 6 SP1.
> java.lang.NullPointerException
> 	at jcifs.UniAddress.lookupServerOrWorkgroup(UniAddress.java:184)
> 	at jcifs.UniAddress.getByName(UniAddress.java:258)
> 	at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:87)
> 
	It looks like something is going wrong at a low level meaning below jCIFS.
	The lookup for EUROPE is failing. First, lookup EUROPE using nmblookup
	(preferrably from the target machine if samba is installed on it):

	$ nmblookup -U <winsip> -R europe#1b
	querying amrs on <winsip>
	<domaincontroller> europe<1b>

	If that doesn't work then this has nothing to do with jCIFS and you need to look
	at the host setup more closely. If it does, then now try jCIFS with this trivial
	piece of code:

	import jcifs.*;

	public class SimpleQuery {

	    public static void main(String[] argv) throws Exception {
	        if( argv.length < 1 ) { 
	            System.out.println( "java -Djcifs.netbios.wins=<winsip> SimpleQuery <hostname>" );
	            return;
	        }

	        System.err.println( UniAddress.getByName( argv[0], true ));

	        Runtime.getRuntime().exit(0);
	    }
	}

	If this doesn't work maybe it will provide some insight as to why. You
	might also send me an Ethereal packet capture or at least a -Dlog=ALL
	trace of the above code failing.

	Mike

> This does work on the xp client environment where I developed the web
> application. I have not much knowledge of networking technologie and
> authetication protocols, so I just implemented this api according to the
> documentation and it worked fine localy. But then I migrated it to our linux
> test environment and I got this error (after we changed the resolving of the
> local hostname by deleting 'nano').
> 
	Where did you get 'nano'? I don't think that's in the documentation. Are
	you looking at this:

	http://jcifs.samba.org/src/docs/ntlmhttpauth.html

> The web.xml has the folowing specified:
> <filter>
>     <filter-name>NTLM HTTP Authentication Filter</filter-name>
>     <filter-class>jcifs.http.NtlmHttpFilter</filter-class>
>     <init-param>
>       <param-name>jcifs.netbios.wins</param-name>
>       <param-value>**.***.**.***</param-value>
>     </init-param>
>     <init-param>
>       <param-name>jcifs.smb.client.domain</param-name>
>       <param-value>EUROPE</param-value>
> 
	Try just using the jcifs.smb.client.domainController property with the domain
	controller ip as discovered using the methods above.

>     </init-param>
>   </filter>
>   <filter-mapping>
>     <filter-name>NTLM HTTP Authentication Filter</filter-name>
>     <url-pattern>*.do</url-pattern>
>   </filter-mapping>
> 
> Can anyone tell what to do???????? My guess is that there is still something
> not right in the way the linux server is configured or that I need to set
> some other jcifs props.
> 
	Your config should work which leads me to believe there might be something
	strange with the host setup. Is it running a name server or is the machines
	local name in the /etc/hosts file?

	Mike




More information about the jcifs mailing list