-
1. Re: Unnatural behaviour of JBOSS EAP6
wdfink Oct 28, 2013 10:18 AM (in response to riyazmohd)Could you share the relevant code and the exact error messages?
-
2. Re: Unnatural behaviour of JBOSS EAP6
sjunejo Nov 3, 2013 6:39 PM (in response to riyazmohd)I think code would really help on how you are loading this pop-up but as you have mentioned that getConnection() is failing, are you properly closing the connection once it is used by other requests? Could you please verify that .close() is getting executed once you are done with it? Might be this popup is opening a connection to fetch data and not closing it?
-
3. Re: Unnatural behaviour of JBOSS EAP6
riyazmohd Nov 5, 2013 8:02 AM (in response to sjunejo)Below is the code through which my popup window gets displayed:
The connection which i mentioned in the post is a database connection,im getting the connection from the datasource whenever i need to display the popup window
JSP code is pasted below:
if (btnname == "viewral")
{
window.open('','viewral','scrollbars=yes,toolbar=no,menubar=yes,width=800,height=550,top=75,left=300');
document.reviewFrn.target="viewral";
document.reviewFrn.formtype.value="RAL";
document.reviewFrn.frn_action.value="viewforms";
document.reviewFrn.action="/usf/FundingRequestServlet";
document.reviewFrn.submit();
}Portion of code from Servlet where the popup window is getting called:
String sJSPAction = (String) request.getParameter("frn_action");
if ( sJSPAction.equals("viewforms") )
{
Vector forms_vector = new Vector();
// Read the Form type for which view screen is needed.
if( request.getParameter("formtype").equals("RAL"))
{
// Obtaining the Value of the FRN from the JSP editfrn.jsp
frnNo = request.getParameter("formfrn");
USFEnv.getLog().writeDebug( "FRN #"+frnNo, this,null );
// Create db connection for EJB
frnInfoEJBean.connect();
// Get the FRN data
forms_vector = frnInfoEJBean.getRalDataByFrn(frnNo);
// Release db connection for EJB
frnInfoEJBean.release();
// Set the data that has been retreived.
request.setAttribute( "forms_vector",forms_vector);
request.setAttribute( "countForm","false");
// Include the JSP
includeJSP( request, response, FRN_JSP_PATH, "viewral" );
}From the above code connect() and release() methods are pasted below:
public void connect() throws ConnectException,RemoteException
{
USFEnv.getLog().writeDebug( "creating db connection()" , this , null );
ejbConn = null;
ejbConn = dbconn.open();if ( ejbConn == null )
{
throw new ConnectException( "Database connection failure" );
}
}
public void release() throws ConnectException,RemoteException
{try
{
USFEnv.getLog().writeDebug( " release db connection()", this, null );
if ( ejbConn != null )
ejbConn.close();
ejbConn = null;
}
catch( Exception ex )
{
throw new ConnectException( "Database connection not released" );
}
}The below method is getting called from servlet:
public Vector getRalDataByFrn( String frnNo )
{
StringBuffer query = new StringBuffer( "" );
Vector rals_vector = new Vector();
PreparedStatement pstmt = null;
ResultSet rs = null;query.append( "select * from stage_ral_form where frn = ? order by email_date" );
USFEnv.getLog().writeDebug( " Get ral form by FRN Query: " + query.toString() , this, null );try
{
USFEnv.getLog().writeDebug( " Get ral form by FRN Query conn obj: " +conn , this, null );
pstmt = conn.prepareStatement( query.toString() );pstmt.setString(1,frnNo);
rs = pstmt.executeQuery();
while( rs.next() )
{……
}Database Connection:
private static DataSource ds = null;
private static java.sql.Connection conn=null;static {
// Load the type 2 driver
try {ds = (DataSource)USFEnv.ic.lookup("java:/jboss/datasources/usfdev");
} catch (Exception e) {
USFEnv.getDefaultLog().writeWarn("DataSource could not be found using JNDI ",null,null);
}
-
4. Re: Unnatural behaviour of JBOSS EAP6
wdfink Nov 6, 2013 4:57 PM (in response to riyazmohd)I don't understand the code right now.
But if you lookup a Datasource you can call getConnection(), after you finish the work you have to close the ResutSet, Statement and the connection itselfe.
Otherwise you might run into problems b/c of opend cursors or connection leaking