Dharmakumar Gajendran

Greenhorn
+ Follow
since Feb 22, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dharmakumar Gajendran

Hi Joanne,

Thanks for your suggestion. I have tried this. But still getting the same error.

Thanks.
12 years ago
Hi,

I have written a program to authenticate the login user with my organisations ldap directory. I have given the code below,

public boolean authenticate() {

String userName = "username";
String password = "password";
Hashtable<String, String> env = new Hashtable<String, String>();

env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.PROVIDER_URL, "ldap://simple.com.au/DC=simple,DC=com,DC=au");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
/***
* Review : Please Move the domain name to the properties file.
*/
env.put(Context.SECURITY_PRINCIPAL,"userName");
env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = null;
NamingEnumeration results = null;
try {
try {
ctx = new InitialDirContext(env);

} catch (AuthenticationException authEx) {
authEx.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}


The authentication is successful with the above code. Now I am trying to authenticate with ldaps://simple.com.au and using 'ssl' instead of 'simple'. But the authentication has failed and I am getting the below error.

javax.naming.AuthenticationNotSupportedException: ssl
at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:100)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2694)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:198)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:83)
at SimpleLdapClient.authenticate(SimpleLdapClient.java:69)
at SimpleLdapClient.main(SimpleLdapClient.java:142)

Can any one please help to resolve this issue.

Thanks in advance.
12 years ago
Hi,

I am writing a program to authenticate the login user with my organisations ldap directory. I have given the code below,

public boolean authenticate() {

String userName = "username";
String password = "password";
Hashtable<String, String> env = new Hashtable<String, String>();

env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.PROVIDER_URL, "ldap://simple.com.au/DC=simple,DC=com,DC=au");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
/***
* Review : Please Move the domain name to the properties file.
*/
env.put(Context.SECURITY_PRINCIPAL,"userName");
env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = null;
NamingEnumeration results = null;
try {
try {
ctx = new InitialDirContext(env);

} catch (AuthenticationException authEx) {
authEx.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}


The authentication is successful with the above code. Now I am trying to authenticate with ldaps://simple.com.au and using 'ssl' instead of 'simple'. But the authentication has failed and I am getting the below error.

javax.naming.AuthenticationNotSupportedException: ssl
at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:100)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2694)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:198)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:83)
at SimpleLdapClient.authenticate(SimpleLdapClient.java:69)
at SimpleLdapClient.main(SimpleLdapClient.java:142)

Can any one please help to resolve this issue.

Thanks in advance.
12 years ago
Hi,

I am writing a program to authenticate the login user with my organisations ldap directory. I have given the code below,

public boolean authenticate() {

String userName = "username";
String password = "password";
Hashtable<String, String> env = new Hashtable<String, String>();

env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.PROVIDER_URL, "ldap://simple.com.au/DC=simple,DC=com,DC=au");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
/***
* Review : Please Move the domain name to the properties file.
*/
env.put(Context.SECURITY_PRINCIPAL,"userName");
env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = null;
NamingEnumeration results = null;
try {
try {
ctx = new InitialDirContext(env);

} catch (AuthenticationException authEx) {
authEx.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}


The authentication is successful with the above code. Now I am trying to authenticate with ldaps://simple.com.au and using 'ssl' instead of 'simple'. But the authentication has failed and I am getting the below error.

javax.naming.AuthenticationNotSupportedException: ssl
at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:100)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2694)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:198)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:83)
at SimpleLdapClient.authenticate(SimpleLdapClient.java:69)
at SimpleLdapClient.main(SimpleLdapClient.java:142)

Can any one please help to resolve this issue.

Thanks in advance.
Thanks a lot for your valuable suggestions.

12 years ago
Here is the query


-------------------------------------------------------------------------------------------

select *
from ( select /*+ FIRST_ROWS(25) */
a.*, ROWNUM rnum
from ( /*** my query **/
ORDER BY 1 desc
) a
where ROWNUM <=25)
where rnum >= 1

-----------------------------------------------------------------------------------------------------------------

What's happening here is for ORDER BY 1 the query returns the result fast. But while sorting other than 1st column its taking more time.

Thanks .
12 years ago
Hi

Now I have one more challenge. I need to sort the column for the given data. the requirement is to sort(asc or desc) for the selected column and then select the 25 records.

Can any give the sql query format.

Thanks.
12 years ago
Martin, you are right. We do have option for the filter. So the user can depend on the filters.

Thanks for your reply.
12 years ago

Hi,

I will be grateful if any one could help me out to sort this issue.

I am using rownum for pagination in oracle sql. I am fetching 25 records in each request. There are 50000 records. for first 5000 records that is records between 4976 and 5000 the time consumption to fetch the data is fine. But
when i am trying to fetch beyond 20000 records that is records between 19976 and 20000 the time consumption is huge (taking around 5 mts) which is not feasible in the application. can any one has the solution to fix this please post your comments.

Thanks & Regards,
Dharmakumar G
12 years ago
Hi,

I am facing the below exception in my web appliaction. I have configured spring-hibernate-mysql with apache tomcat.
If any one can trace the root cause. Please help.

[11-23 14:15:45] ERROR AbstractFlushingEventListener [http-5546-1]: Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:85)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:70)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:90)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
at org.hibernate.persister.entity.AbstractEntityPersister.processGeneratedProperties(AbstractEntityPersister.java:3977)
at org.hibernate.persister.entity.AbstractEntityPersister.processUpdateGeneratedProperties(AbstractEntityPersister.java:3966)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:146)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:180)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:407)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:737)
at com.hp.vms.dao.BadgesDAO.add(BadgesDAO.java:29)
at com.hp.vms.controller.BadgesFormController.onSubmit(BadgesFormController.java:90)
at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:272)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:268)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
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.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)

Thanks,
Dharmakumar G
1. In jsp file add '.do' to the action action="addEmployee.do"
2.In the Spring config file add the mapping for this url
<bean name="/addEmployee.do" class="<give your controller class location with full package structure>"/>

Try this and let me know.
13 years ago
Thanks a lot dude! I love your solution
13 years ago
I have configured hibernate with spring frame work and have written a simple web application to fetch the data from the data base and display it in the jsp. I have put the hibernate.cfg.xml in WEB-INF/classes folder. I have deployed the appliaction in apache-tomcat 6.I start the server and run the application, the application is not able to fetch the data. It displays a message 'Invalid Configuration' in the tomcat log. Please help me to rectify this problem. Im attaching the hibernate.cfg.xml . find the tomcat logs below.

tomcat logs
-------------------

Oct 21, 2010 11:15:05 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Oct 21, 2010 11:15:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Oct 21, 2010 11:15:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory projects
Oct 21, 2010 11:15:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Oct 21, 2010 11:15:06 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 21, 2010 11:15:07 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Oct 21, 2010 11:15:07 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Oct 21, 2010 11:15:07 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 15154 ms
invalid configuration


hibernate.cfg.xml
--------------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" >
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
<property name="username" value="dharma"/>
<property name="password" value="dharma"/>
</bean>

<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="myDataSource"/>
<property name="mappingResources">
<list>
<value>/WEB-INF/employee.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect
</prop>
<prop key="show_sql">true</prop>
</props>
</property>
</bean>

<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="mySessionFactory"/>
</property>
</bean>

<bean id="employeeDao" class="servlet.dao.EmployeeDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>


</beans>
13 years ago
Can any please explain what is the difference between ArrayList and Vector?
I know thay Vector is synchronized and ArrayList is not synchronized. Can anybody elaborately explain this difference?
Is there any other difference apart from this one?


Thanks.
14 years ago
What is an Enum and its usage?
14 years ago