[jcifs] NtlmServlet Authentication Problem

eglass1 at comcast.net eglass1 at comcast.net
Tue Jun 8 12:31:10 GMT 2004





> 
> I tried various settings for domain and domainController but i end up 
> getting either a StackOverflow on super.service(req,res) or this:
> 
You shouldn't have to override init just to set jCIFS properties; the
superclass will automatically set them from the deployment descriptor.
So you can just put (in web.xml):

    <servlet>
        <servlet-name>myservlet</servlet-name>
        <servlet-class>MyNtlmServlet</servlet-class>
        <init-param>
            <param-name>jcifs.smb.client.domain</param-name>
            <param-value>KOGIT</param-value>
        </init-param>
        <init-param>
            <param-name>jcifs.netbios.wins</param-name>
            <param-value>192.168.0.223</param-value>
        </init-param>
        .... etc.
    </servlet>

Also, you shouldn't call super.service; the NtlmServlet .service method is
invoked by the container, and calls super.service (HttpServlet.service), which
in turn calls doGet, doPost, etc.  If you call super.service within doGet,
you'll get the stack overflow due to infinite recursion.

You should just be able to put the appropriate settings in web.xml and do:

    public class MyNtlmServlet extends NtlmServlet {

        public void doGet(HttpServletRequest req, HttpServletResponse res)
                throws IOException, ServletException {
            String user = req.getSession().getAttribute("ntlmuser");
            res.getWriter().println(user);
            res.flushBuffer();
        }

    }


The connection issue might be something else; it looks like it just isn't able to
connect to the host in question.


Eric


More information about the jcifs mailing list