This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

apache-tomcat  RSS feed

 
manoj r patil
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My request from client is getting duplicated on server...
I'm submitting form by javascript submit. And I've put some SOP (System.out.println) statement in my java classes. So when I invoke java method from jsp on submit, that method is being called twice. Again it happens 80% of the time. But not always!
I'm posting one code for reference. In this code I'm initializing my connection pool and I want it to be done only once. But it gets initialized twice which I can see from the messages on tomcat console:
/*** here goes the code ***********/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Pool Initializing ...</TITLE>
<META NAME="Author" CONTENT="Manoj Patil">
</HEAD>
<%@ page import="com.tattva.pms.database.*, java.sql.*, java.util.*"%>
<%
ConnectionPool lvPool = new ConnectionPool();
try {
lvPool.setDriver("oracle.jdbc.driver.OracleDriver");
lvPool.setUrl( "jdbc racle:thin:@pe2500:1521 msdb");
lvPool.setSize(4);
lvPool.setUserName("cvdpl");
lvPool.setPassword("cvdpl");
lvPool.initializePool();
}
catch(Exception e) {
out.println("Exception in connecting...: "+e);
}
try {
application.setAttribute("ConnectionPool", lvPool);
}
catch(Exception e) {
out.println(e);
}
%>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF">
<%
out.println("<FONT color=\"#800000\"><H3>ConnectionPool: <b>"+application.getAttribute("ConnectionPool"));
out.println("</b><br><blockquote>Connection Pool initialized! Now you can use the database with the optimum speed!</blockquote></H3></FONT>");
%>
</BODY>
</HTML>
/******************************************/
Thanks and Regards,
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that the user isn't double-clicking?
They have a bad habit of doing that, alas.
 
manoj r patil
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here I am the user! So this problem is eliminated! But It has happened with me before also. Still searching for the reason......
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!