[jcifs] Exception: Invalid access to memory location

Richard Caper rcaper at gmail.com
Thu May 12 17:05:00 GMT 2005


I think this happens if the challenge and response does not match. 
Are you using the NtlmPasswordAuthentication object to access a file
on the same server that is acting as the filter domain controller? 
With the filter the password is not available so I think you can only
access files on the server giving out the challenge.

On 5/12/05, Maher Martin <MMaher at webasto.de> wrote:
>  
>  
> 
> JCIFS Version  1.1.11 
> 
>   
> 
> Hi, 
> 
>   
> 
> I'm playing around with Ntlm Authentication & SmbFile and I'm getting an
> "Invalid access to memory location" exception when invoking the
> "smbFile.exists()" method when trying to access a file on an NTFS server.
> I've checked that the server name, file location, etc is valid so I'm 100%
> sure that this isn't the problem. The problem comes when I use the
> NtlmPasswordAuthentication object instance from the NtlmHttpFilter. 
> 
> I'm using the NtlmHttpFilter example that comes with version 1.1.11 of
> jcifs. 
> 
>   
> 
> I've included the exception and a snippet of the code I'm using below. Any
> help would be really appreciated. 
> 
>   
> 
> Thanks, 
> 
> Martin 
> 
>   
> 
> jcifs.smb.SmbAuthException: Invalid access to memory location. 
> 
>         at
> jcifs.smb.SmbComSessionSetupAndX.<init>(SmbComSessionSetupAndX.java:46)
> 
>         at
> jcifs.smb.SmbSession.sessionSetup(SmbSession.java:255) 
> 
>         at jcifs.smb.SmbSession.send(SmbSession.java:228) 
> 
>         at jcifs.smb.SmbTree.treeConnect(SmbTree.java:134) 
> 
>         at jcifs.smb.SmbFile.connect(SmbFile.java:827) 
> 
>         at jcifs.smb.SmbFile.connect0(SmbFile.java:797) 
> 
>         at jcifs.smb.SmbFile.queryPath(SmbFile.java:1202) 
> 
>         at jcifs.smb.SmbFile.exists(SmbFile.java:1285) 
> 
>         at
> com.webasto.ntlmtest.SmbHelper.debufSmbFile(SmbHelper.java:60)
> 
>         at
> com.webasto.ntlmtest.SmbHelper.smbFile2Html(SmbHelper.java:53)
> 
>         at
> com.webasto.ntlmtest.NtlmHttpAuthExample.doGet(NtlmHttpAuthExample.java:113)
> 
>         at
> com.webasto.ntlmtest.NtlmHttpAuthExample.doPost(NtlmHttpAuthExample.java:128)
> 
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
> 
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> 
>         at
> com.webasto.ntlmtest.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:214)
> 
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
> 
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> 
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> 
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 
>         at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
> 
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
> 
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
> 
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
> 
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
> 
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> 
>         at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
> 
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
> 
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
> 
>         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> 
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
> 
>         at java.lang.Thread.run(Thread.java:534) 
> 
>   
> 
> When executing the following code: 
> 
>   
> 
> public class NtlmHttpAuthExample extends HttpServlet { 
> 
>   
> 
>   /** 
> 
>    * <p> 
> 
>    * Refer to method javadoc in super class 
> 
>    * </p> 
> 
>    * 
> 
>    * @param arg0 
> 
>    * @throws javax.servlet.ServletException 
> 
>    * @see
> javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
> 
>    */ 
> 
>   public void init(ServletConfig arg0) throws ServletException { 
> 
>     super.init(arg0); 
> 
>   } 
> 
>   
> 
>   public void doGet(HttpServletRequest req, HttpServletResponse resp) throws
> IOException, 
> 
>       ServletException { 
> 
>> 
>         smbFile =
> SmbHelper.getSmbFile((NtlmPasswordAuthentication)req.getUserPrincipal(),
> 
>             reqServerName, 
> 
>             reqFileName); 
> 
>   
> 
>         
> 
>         out.println(smbFile.exists()); 
> 
>         
> 
>   } 
> 
>   
> 
> } 
> 
>   
> 
> public class SmbHelper { 
> 
>   public static SmbFile
> getSmbFile(NtlmPasswordAuthentication ntlmPwdAuth, 
> 
>       String servername, 
> 
>       String filename) throws MalformedURLException { 
> 
>     String completeUrl = "smb://" 
> 
>       + servername 
> 
>       + filename.replace('\\', '/'); 
> 
>     
> 
>     System.out.println("SMB URL=" + completeUrl); 
> 
>     SmbFile smbFile = new SmbFile(completeUrl,ntlmPwdAuth);
> 
>     return smbFile; 
> 
>   } 
> 
> } 
> 
>   
> 
>   
> 
>   
> 
>   
> 
>   
> 
>


More information about the jcifs mailing list