Rahul Chaudhari

Greenhorn
+ Follow
since Jul 30, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rahul Chaudhari

I have the following configuration:

<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"
destroy-method="close">
<property name="url" value="ldap://${LDAP_HOST}:${LDAP_PORT}"/>
<property name="base" value="${LDAP_BASEDN}"/>
<property name="pooled" value="false" />
</bean>
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
<constructor-arg ref="contextSource" />
<property name="ignorePartialResultException" value="true" />
</bean>

I have following properties:
LDAP_ENABLE = 1
LDAP_HOST = 10.X.X.X
LDAP_PORT = 389
LDAP_BASEDN = DC=pune,DC=com
LDAP_FILTER =(&(objectClass=person)(sAMAccountName=?))
LDAP_ANONYMOUS = false
LDAP_OBJECT_CLASS = person
LDAP_SEARCH_FILTER = sAMAccountName


I have following source code:

contextSource.setAnonymousReadOnly(Boolean.parseBoolean(utilProperties.getProperty("LDAP_ANONYMOUS")));
LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
ldapTemplate.setIgnorePartialResultException(true) ;
ldapTemplate.afterPropertiesSet();
AndFilter filter1 = new AndFilter();
filter1.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("sAMAccountName", userName));
ldapTemplate.authenticate(contextSource.getBaseLdapPath().toString(), filter1.toString(), password);


But when I attempt to authenticate I get the following error:

org.springframework.ldap.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001CD, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=pune,DC=com' ];
nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001CD, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=pune,DC=com' ];
remaining name 'dc=pune,dc=com'Caused by: javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001CD, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=pune,DC=com' ]; remaining name 'dc=pune,dc=com'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.searchAux(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_search(Unknown Source)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
at javax.naming.directory.InitialDirContext.search(Unknown Source)
at org.springframework.ldap.core.LdapTemplate$3.executeSearch(LdapTemplate.java:231)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:293)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:237)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:624)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:535)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:462)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:483)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:503)
at org.springframework.ldap.core.LdapTemplate.authenticate(LdapTemplate.java:1424)
at org.springframework.ldap.core.LdapTemplate.authenticate(LdapTemplate.java:1410)
at org.springframework.ldap.core.LdapTemplate.authenticate(LdapTemplate.java:1397)
at com.dmsuite.web.user.LoginController.authenticate(LoginController.java:113)
at com.dmsuite.web.user.LoginController.processFormSubmission(LoginController.java:251)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormContro
ller.java:250)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAd
apter.java:45)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)

please let me know if anyone has solution.
thanks in advance..
14 years ago
I have the following configuration:

<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"
destroy-method="close">
<property name="url" value="ldap://${LDAP_HOST}:${LDAP_PORT}"/>
<property name="base" value="${LDAP_BASEDN}"/>
<property name="pooled" value="false" />
</bean>
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
<constructor-arg ref="contextSource" />
<property name="ignorePartialResultException" value="true" />
</bean>

I have following properties:
LDAP_ENABLE = 1
LDAP_HOST = 10.X.X.X
LDAP_PORT = 389
LDAP_BASEDN = DC=pune,DC=com
LDAP_FILTER =(&(objectClass=person)(sAMAccountName=?))
LDAP_ANONYMOUS = false
LDAP_OBJECT_CLASS = person
LDAP_SEARCH_FILTER = sAMAccountName


I have following source code:

contextSource.setAnonymousReadOnly(Boolean.parseBoolean(utilProperties.getProperty("LDAP_ANONYMOUS")));
LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
ldapTemplate.setIgnorePartialResultException(true) ;
ldapTemplate.afterPropertiesSet();
AndFilter filter1 = new AndFilter();
filter1.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("sAMAccountName", userName));
ldapTemplate.authenticate(contextSource.getBaseLdapPath().toString(), filter1.toString(), password);


But when I attempt to authenticate I get the following error:

org.springframework.ldap.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001CD, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=pune,DC=com' ];
nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001CD, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=pune,DC=com' ];
remaining name 'dc=pune,dc=com'Caused by: javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001CD, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=pune,DC=com' ]; remaining name 'dc=pune,dc=com'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.searchAux(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_search(Unknown Source)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
at javax.naming.directory.InitialDirContext.search(Unknown Source)
at org.springframework.ldap.core.LdapTemplate$3.executeSearch(LdapTemplate.java:231)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:293)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:237)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:624)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:535)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:462)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:483)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:503)
at org.springframework.ldap.core.LdapTemplate.authenticate(LdapTemplate.java:1424)
at org.springframework.ldap.core.LdapTemplate.authenticate(LdapTemplate.java:1410)
at org.springframework.ldap.core.LdapTemplate.authenticate(LdapTemplate.java:1397)
at com.dmsuite.web.user.LoginController.authenticate(LoginController.java:113)
at com.dmsuite.web.user.LoginController.processFormSubmission(LoginController.java:251)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormContro
ller.java:250)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAd
apter.java:45)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)

please let me where i am wrong.
thanks in advance..
14 years ago
use fillowing line in your script. It writes the output of FTP in Specified file.

ftp 10.x.x.45 > FILENAME << INPUT_END

# different ftp commands...

INPUT_END
16 years ago
Hi
I have one log file which containt output of ls command. I want to read that file content and get the file name and size then I have to check that if that file size is zero then touch that file locally other wise get that file from ftp.

log file contents are(FileName is filelist.txt):

unknown security mechanism
unknown security mechanism
Passive mode off.
-rwxr----- 1 smartscm System 761 Jun 18 2008 APPayment20080618123001.csv
-rwxr----- 1 smartscm System 0 Jun 19 2008 APPayment20080619123000.csv
-rwxr----- 1 smartscm System 0 Jun 25 2008 APPayment20080625123001.csv
-rwxr----- 1 smartscm System 1961 Jun 30 2008 APPayment20080630123001.csv

How i can read the filename and size?
I want to read filename in loop so I can check the size condition and get the file from FTP accd. to condition.

Thanks....
16 years ago
How to get zero bytes file from ftp.

How I can write ls command output to some file in ftp promte.
I tried using following,

ftp 10.x.x.45 << INPUT_ENDS
cd /home/dynamic/
ls *.csv > /home/dynamic/log/csvfile.txt
quit
INPUT_ENDS

I have full rights to log folder then also I cannot write file and not the output.

Please can any one tell me how to achive it.
Thanks...
16 years ago