File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Unnatural behaviour of JBOSS EAP6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Unnatural behaviour of JBOSS EAP6" Watch "Unnatural behaviour of JBOSS EAP6" New topic
Author

Unnatural behaviour of JBOSS EAP6

Riyaz Mohd
Greenhorn

Joined: Oct 28, 2013
Posts: 6
In my EJB 2.0 applcation that is running in JBOSS EAP 6,i have a jsp page in which i had 4 buttons,upon clicking on any of the buttons,will display a popup window with some customer information(only informational window),the above described functionality will work fine if server is up for 2/3 hours after it gets bounced,after time duration the popup windows does not fetch any information because it could not get connection object,apart from that functionality, remaining things will work absolutely fine(all the remaining transactions ),i:e i can able to get the connection object for remaining stuff.The above issue gets resolved after doing a server bounce but it stays for only few hours,only the popup window functioanlity is behaving unnaturally,



Any help would be great..
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

Riyaz, welcome to CodeRanch.

What kind of a connection is it? A connection to the database? Do you hold on to the connection all the time or do you fetch from the datasource whenever you want to show that popup information? What do the relevant code and configurations look like?

[My Blog] [JavaRanch Journal]
Riyaz Mohd
Greenhorn

Joined: Oct 28, 2013
Posts: 6


Hi Jaikiran,

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);
}
 
 
subject: Unnatural behaviour of JBOSS EAP6