[jcifs] JCIFS with Windows Vista / IE 7

shibaram dunumania at yahoo.co.in
Tue Jan 6 22:34:53 GMT 2009


Thanks Mike, Chuck and John.

@ John,  
No, its not like that.
using the 1.3.1 jar file and  directly setting the properties in the web.xml
under <filter> under <init-param>   I am able to run everything fine even in
eclipse development phase. 
This is only breaking when I try to read the properties from an external
property file.

@ Mike:
I am setting the property as said by Mike like below:

-Djcifs.properties=<System Full Path>\jcifs.properties
e.g. (in my case) :
-Djcifs.properties=C:\Workspace_Eclipse33_SBC\JCIFS\WebContent\WEB-INF\opt\jcifs.properties
in the server (Tomcat here) as command line setting.

And now in Development phase in Eclipse IDE , when I access the property in
my custom Ntlmfilter
like below:

public class NtlmCustomisedHttpFilter extends NtlmHttpFilter {

     public void init( FilterConfig filterConfig ) throws ServletException {
          
         String justGet = System.getProperty("jcifs.properties");

         String propFile =
filterConfig.getInitParameter("jcifs.properties");
 //        Config.setProperty("jcifs.properties", propFile);
        
        
System.out.println("-----------========================----------------------");
         System.out.println("justGet = "+justGet);
         System.err.println("Path of property file = "+propFile);
         System.err.println(Config.getProperty("jcifs.netbios.wins", null));
         System.err.println(Config.getProperty("jcifs.smb.client.domain",
null));
        
System.out.println("-----------========================----------------------");
         super.init(filterConfig);
     }
}

I am getting below outputs from above in the eclipse consol : 

INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
-----------========================----------------------
justGet = null
Path of property file =
C:\Workspace_Eclipse33_SBC\JCIFS\WebContent\WEB-INF\opt\jcifs.properties
null
null
-----------========================----------------------
Jan 6, 2009 5:28:14 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 6, 2009 5:28:14 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Jan 6, 2009 5:28:14 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 397 ms
Jan 6, 2009 5:28:15 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
jcifs.smb.SmbException: A domain was not specified
	at jcifs.smb.SmbSession.getChallengeForDomain(SmbSession.java:90)
	at jcifs.http.NtlmHttpFilter.negotiate(NtlmHttpFilter.java:157)
	at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:121)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)


As you can see when I launch the tomcat within the eclipse ide and test the
application.
still I get a Null   for  System.getProperty("jcifs.properties").

BUT, if I deploy the application as a war file and launching the Tomcat out
side eclipse and access the application, it executes fine without error.
Means in this case System.getProperty("jcifs.properties")   manages to read
from the 
-Djcifs.properties=C:\Workspace_Eclipse33_SBC\JCIFS\WebContent\WEB-INF\opt\jcifs.properties
from the command line proerty set in the tomcat server.

But in the former case (Launching the application Run/ Debug mode in Eclipse
with Tomcat), System.getProperty("jcifs.properties") does not read the
settings by default.

I looked up some help in Eclipse itself, and found that (probably) we need
to pass the system settings in the "eclipse.ini" file as
-Djcifs.properties=<System Full Path>\jcifs.properties

But again System.getProperty("jcifs.properties") does not reading the
settings in the Eclipse development environment.

Note: I must clear, In my development phase, Relationship between eclipse
and tomcat is, my application stays in the eclipse workspace only. Means
neither the application directory get copied nor the application war file
get copied to inside the "webapps" directory of tomcat.  
So thats why may be -Djcifs.properties=<System Full Path>\jcifs.properties
in the Tomcat as command line might not be working.

Thanks
Shibaram



Michael B Allen wrote:
> 
> On Tue, Jan 6, 2009 at 3:34 AM,  <John.Baker at barclayscapital.com> wrote:
>> Mike,
>>
>> I did provide a re-producable scenerio - simply enable logging through
>> the web.xml filter (if I recall), which encourages the defaults to be
>> loaded before the settings from the web.xml.
>>
>> The static configuration properties are broken and it won't take a lot
>> of effort to fix them.  I'm unsure to why we can't fix them?
>>
>> I don't think that asking people to use VM properties is a particularly
>> great way to configure the product.  It's clearly something that should
>> be done via the web.xml, and it's currently broken.
> 
> No. Nothing is "broken". If I were to do what you want it *would* be
> broken. I have taken a lot of time to explain this to you *twice*
> before but you simply refuse to accept it. No more.
> 
> Mike
> 
>>> -----Original Message-----
>>> From:
>>> jcifs-bounces+john.baker=barclayscapital.com at lists.samba.org
>>> [mailto:jcifs-bounces+john.baker=barclayscapital.com at lists.sam
>>> ba.org] On Behalf Of Michael B Allen
>>> Sent: 05 January 2009 18:09
>>> To: shibaram
>>> Cc: jcifs at lists.samba.org
>>> Subject: Re: [jcifs] JCIFS with Windows Vista / IE 7
>>>
>>> Hi Shibaram,
>>>
>>> This page describes how to set JCIFS properties:
>>>
>>>   http://jcifs.samba.org/src/docs/api/overview-summary.html#scp
>>>
>>> Note that jcifs.properties cannot be specified by any means
>>> other than as a System property. That is why you are getting
>>> the error you are seeing. So to use the JCIFS properties
>>> file, you must modify the Tomcat command-line to include
>>> -Djcifs.properties=myproperties.prp.
>>>
>>> There is another very good reason to a command-line option to
>>> specify the JCIFS properties file as shown above. As
>>> described on the above page, JCIFS properties set using
>>> jcifs.Config.setProperty *must be set before JCIFS classes
>>> are loaded*. All JCIFS 1.x properties are static globals. The
>>> JCIFS NTLM HTTP filter uses jcifs.Config.setProperty to set
>>> properties supplied in the web.xml. This creates the
>>> potential for properties to be ignored if the Servlet
>>> container were to load JCIFS classes before it processed the
>>> <filter> section. In practice this does not seem to occur but
>>> someone once reported having a problem that was believed to
>>> be caused by classes being loaded before the filter
>>> properties were processed. Therefore, the best way to
>>> guarantee that JCIFS properties are loaded properly is to set
>>> a properties file using a servlet container command-line option:
>>>
>>>   java -Djcifs.properties=myproperties.prp ...
>>>
>>> And then modify the properties from the myproperties.prp file instead.
>>> Note that you still need to restart the container after
>>> modifying the JCIFS properties file.
>>>
>>> Mike
>>>
>>> On Mon, Jan 5, 2009 at 12:24 PM, shibaram
>>> <dunumania at yahoo.co.in> wrote:
>>> >
>>> > I am trying to put all the properties in the property file
>>> "jcifs.properties"
>>> > and configured it in the init-param  tag of the filter tag
>>> in web.xml
>>> > file like below.
>>> >
>>> >
>>> > <filter>
>>> >    <filter-name>NtlmHttpFilter</filter-name>
>>> >    <filter-class>jcifs.http.NtlmHttpFilter</filter-class>
>>> >        <init-param>
>>> >           <param-name>jcifs.properties</param-name>
>>> >           <param-value>/WEB-INF/opt/jcifs.properties</param-value>
>>> >        </init-param>
>>> > </filter>
>>> >
>>> > But I my application is failing to access the properties
>>> file I think.
>>> > Because I am getting below exceptions:
>>> >
>>> > jcifs.smb.SmbException: A domain was not specified
>>> >        at jcifs.smb.SmbSession.getCha
>>>
>>> --
>>> Michael B Allen
>>> PHP Active Directory SPNEGO SSO
>>> http://www.ioplex.com/
>>>
>> _______________________________________________
>>
>> This e-mail may contain information that is confidential, privileged or
>> otherwise protected from disclosure. If you are not an intended recipient
>> of this e-mail, do not duplicate or redistribute it by any means. Please
>> delete it and any attachments and notify the sender that you have
>> received it in error. Unless specifically indicated, this e-mail is not
>> an offer to buy or sell or a solicitation to buy or sell any securities,
>> investment products or other financial product or service, an official
>> confirmation of any transaction, or an official statement of Barclays.
>> Any views or opinions presented are solely those of the author and do not
>> necessarily represent those of Barclays. This e-mail is subject to terms
>> available at the following link: www.barcap.com/emaildisclaimer. By
>> messaging with Barclays you consent to the foregoing.  Barclays Capital
>> is the investment banking division of Barclays Bank PLC, a company
>> registered in England (number 1026167) with its registered office at 1
>> Churchill Place, London, E14 5HP.  This email may relate to or be sent
>> from other members of the Barclays Group.
>> _______________________________________________
>>
> 
> 
> 
> -- 
> Michael B Allen
> PHP Active Directory SPNEGO SSO
> http://www.ioplex.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/JCIFS-with-Windows-Vista---IE-7-tp6057570p21320706.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.



More information about the jcifs mailing list