sandesh bangera

Greenhorn
+ Follow
since Nov 13, 2002
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 sandesh bangera

Thank you everyone for your reply. In this case, the problem was due to the differnt classloaders invovled, that has been introduced in JDK2 onwards.

However, did the following to fix my problem.

//Retrive and store previous Class context.
ClassLoader prevCl = Thread.currentThread().getContextClassLoader();

try{

// Get the current classes Class loader info
ClassLoader classcl = this.getClass().getClassLoader();

//Set class context loader to the current thread
Thread.currentThread().setContextClassLoader(classcl);

Hashtable env = new Hashtable(5, 0.75F);
env.put(Context.INITIAL_CONTEXT_FACTORY,.....)
....

DirContext ctx = new InitialDirContext(env)

}catch(Exception e) {
....
} finally {
// Restore
Thread.currentThread().setContextClassLoader(prevCl);
}

Thanks once again.
14 years ago
Fixed this. this is due to the different class loaders introduced in JDK 2 onwards. Did hte following to fix my problem

//Retrive and store previous Class context.
ClassLoader prevCl = Thread.currentThread().getContextClassLoader();

try{

// Get the current classes Class loader info
ClassLoader classcl = this.getClass().getClassLoader();

//Set class context loader to the current thread
Thread.currentThread().setContextClassLoader(classcl);

Hashtable env = new Hashtable(5, 0.75F);
env.put(Context.INITIAL_CONTEXT_FACTORY,.....)
....

DirContext ctx = new InitialDirContext(env)

}catch(Exception e) {
....
} finally {
// Restore
Thread.currentThread().setContextClassLoader(prevCl);
}

Mods. This thread can be closed now.

Thanks
Sandesh
14 years ago
Could someone help me in resolving the following issue. I am looking at a web server upgrad project and have run into difficulty with LDAP and Servlets part of the code.

WebServer: SunOne 6.0 SP8
Platform : Solaris 8

LDAP: Netscape directory server
Platform: Solaris 2.6

JRE 1.2

Following lines is used to initlise Directory Context

Hashtable env = new Hashtable(5, 0.75F);
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, getProviderUrl());
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=" + getSecurityPrincipal());
env.put(Context.SECURITY_CREDENTIALS, getSecurityCredentials());


DirContext ctx = new InitialDirContext(env);

The system throws the following exception at runtime

"Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory"

com.sun.jndi.ldap.LdapCtxFactory is present in a jar called ldap.jar which i have specifed in my classpath. Also set the nobody as the file owner and its prviligies to 777

Using truss i can confirm that the webserver does resolve and get a filehandle to the ldap.jar file.

has anyone come across a similar problem where the class could not be initiated despite being present in the classpath.

I have also tried using
Thread.currentThread().setContextClassLoader(urlCl) withoug much luck.

Appricate if you could provide some answers.

Thanks in Advance.
Sandesh
14 years ago
Thanks David.

I will try this out first thing on Monday.
14 years ago
hi,

this problem could be more to do with the web server than servlets itself.

WebServer: SunOne 6.0 SP8
Platform : Solaris 8

LDAP: Netscape directory server
Platform: Solaris 2.6

Got a problem with a servlet that interacts with a LDAP server. I use the following line to initlise Directory Context

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

however, the system throws the following exception at runtime

"Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory"

com.sun.jndi.ldap.LdapCtxFactory is present in a jar called ldap.jar which i have specifed in my classpath. Also set the nobody as the file owner and its prviligies to 777

Using truss i can confirm that the webserver does resolve and get a filehandle to the ldap.jar file.

has anyone come across a similar problem where the class could not be initiated despite being present in the classpath.

Appricate if you could provide some answers.

Mods: In case this topic has been answered before, could you point me to the right forum please.

Thanks & Regards
Sandesh
[ January 13, 2006: Message edited by: sandesh bangera ]
14 years ago
Well in oracle, you would enter something like

sql> Select <columns> from <table> where <condition> FOR UPDATE;

This puts a Exclusive lock on the selected rows that will be release by either a commit / rollback;

If you fail to provide a where condition then the entire table is locked.
hi,
have you tried running this code by seleting just a single column from the your table.
try this out and see if you code can handle this.
hi,
the reason its not entering the elseif is because, when you say result returns a row, that row continas all three columns in it.
therefore, every row returned by the result set has SALES1, SALES2, SALES3 in it, thereby always entering the IF condition.
replace the elseif with just if.
Assuming you are usnig Oracle, then the update syntax is wrong.
sql> update <tablename> set
column1 = <updatedvalue>,
column2 = <updatedvalue>
where <condition>
try this
nohup ./start | tee -i logs/console &
cheers
Sandesh
17 years ago
hi,
we had some problems using oracle 8i and iplanet 4.1. Could you more error details.
no errors description no solution
17 years ago
Hi,
We use iPlanet 4.1 service pack 9 as our web server and Oracle 8.1.7 as our database base. The problem with our application is when a user enters invalid username or password ( username => oracle schema) the web server hangs for 10-15 minutes and this effect is cumulative if there are more than one invalid login's.
Earlier we had service pack 5 installed and this is to crash the database maxprocs. With service pack 9, the database problem is rectified by the web server hangs.
We use a thick jdbc connecter to get a database connection handle.
Any help on why this happens would be of great help.
cheers
Sandesh
17 years ago