Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Duplicate local variable ERROR in JSP

908641Oct 5 2012 — edited Oct 5 2012
Hi,
I have a datasource in WebLogic which I need to use inside a JSP to query a database table.
The problem is, I keep on getting the following error:
“Duplicate local variable env: InitialContext env = new InitialContext(ht);”
The first time I had this problem it made sense, I renamed the “env” variable to “thatos” and I still had the same problem where the error message kept referring to duplicate variable, “env”. I also commented out the entire line “InitialContext env = new InitialContext(ht);”, hoping to get a different error message, but I’m still getting the same error message: “Duplicate local variable env: InitialContext env = new InitialContext(ht);”
Any Ideas as to what could be the issue?

Here's my JSP Snippet:

try
{ Context ic = null;

String SiteSectionToken = new String("'"+siteSection+"'");

Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"http://<server>:7001");

ic = InitialContext(ht);
DataSource ds = (DataSource)ic.lookup("jdbc/ucmConnection");
Connection conn = ds.getConnection();

Statement st1=conn.createStatement();
String sql_retrive = "select "+selectionToken+" from intranetnavlist where value = "+SiteSectionToken+"";

ResultSet rs=st1.execute(sql_retrive);
ResultSetMetaData meta = rs.getMetaData();
int numColumns = meta.getColumnCount();
while( rs.next()){
outputs = rs.getString(selectionToken);
}

} catch(Exception e) {
out.println("!----------------------------------------------------------");
}
conn.close();
st1.close();

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 2 2012
Added on Oct 5 2012
1 comment
2,651 views