• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error while Deploying EJB

 
M Sharma
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D:\pramatiStudio\temp\Impl\PayScribe_Combine\PayScribe_Customer\java\CustomerServiceImpl_353177033.java:557: catch not reached.
}catch(javax.ejb.ObjectNotFoundException appExcep){
^
D:\pramatiStudio\temp\Impl\PayScribe_Combine\PayScribe_Customer\java\CustomerServiceImpl_353177033.java:587: catch not reached.
}catch(javax.ejb.ObjectNotFoundException appExcep){
^
2 errors

I am new to EJB. I am using Pramati Application server to complile and deploy the EJB. While compiling i am not getting any errors. But when i deploy my ear file, i get the error pasted above. Please suggest some solution
Below i am pasting the two functions, which contain line 557 and 587 in which i am encountering the errors.
TIA
Manish
private Collection selectDeactivateCustomer() throws ObjectNotFoundException, SQLException
{
Debug.traceln("selectDeactivateCustomer: Entered");
Connection con = this.getConnection();
PreparedStatement prepStmt = null;
ResultSet rs = null;
ArrayList array = new ArrayList();
try
{
String selectStatement = "select objectid, customerid, name from customer where currentstate = ?";
prepStmt = con.prepareStatement(selectStatement);
prepStmt.setString(1, "D");
rs = prepStmt.executeQuery();
Debug.traceln("selectDeactivateCustomer:Query Executed");
while(rs.next())
{
CustomerStatusInfo statusInfo = new CustomerStatusInfo();
statusInfo.objectId = rs.getString(1);
statusInfo.customerId = rs.getString(2);
statusInfo.name = rs.getString(3);
array.add(statusInfo);
}
if(array.size() == 0)
{
Debug.traceln("selectDeactivateCustomer:No such entity exception");
throw new ObjectNotFoundException("Row for Deactivated Customer not found in database.");
}
else
{
return array;
}
}
catch(SQLException sq)
{
Debug.traceln("selectDeactivateCustomer Thrown SQL Exception");
throw new SQLException("selectDeactivateCustomer has raised Exception: " +
sq.getMessage());
}
finally
{//LINE 557
rs.close();
prepStmt.close();
con.close();
}
}
private void modifyCustomer(ArrayList list) throws SQLException
{
Debug.traceln("modifyCustomer: Entered");
Connection con = this.getConnection();
PreparedStatement prepStmt = null;
String updateStatement = "update customer set currentstate='E' where objectid=?";
try
{
for(int i=0; i < list.size(); i++)
{
prepStmt = con.prepareStatement(updateStatement);
prepStmt.setString(1, (String)list.get(i));
int rowCount = prepStmt.executeUpdate();
Debug.traceln("modifyCustomer: Query Executed");
if (rowCount == 0)
{
Debug.traceln("modifyCustomer: EJB Exception");
throw new EJBException("Updating row for objectid " + (String)list.get(i) + " failed.");
}
}
}
catch(SQLException sq)
{
Debug.traceln("modifyCustomer Thrown SQL Exception");
throw new SQLException("Store Row has raised Exception: " + sq.getMessage());
}
finally
{//LINE 587
prepStmt.close();
con.close();
}
}
[ July 01, 2003: Message edited by: Manish Sachdev ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was the code you posted from D:\pramatiStudio\temp\Impl\PayScribe_Combine\PayScribe_Customer\java\CustomerServiceImpl_353177033.java (i.e. the Pramati-generated source) or the original CustomerServiceImpl.java?
 
M Sharma
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The two functions which i have posted are from CustomerServiceEJB.java file. I don't get any errors while compiling this java file but when i deploy my final ear file i get 2 errors which i mentioned in my post.
Can you help me out...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Locate the server-generated source file mentioned in the exception and see what the lines 557 and 587 contain. The compilation error you're seeing comes from the appserver trying to compile code it generated based on your code. Post the server-generated code and maybe someone finds the cause.
 
M Sharma
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The server generated code is :
public java.util.Collection getBlackListedCustomerBank(int param0, int param1)
throws java.rmi.RemoteException, javax.ejb.FinderException,
javax.ejb.ObjectNotFoundException, java.sql.SQLException
{
java.util.Collection value = null;
beanHandler.preInvokeRemote(this, "getBlackListedCustomerBank:int;int;");
try
{

value = ejb.getBlackListedCustomerBank(param0, param1);
}
catch(Throwable th)
{
Class[] appExceptions = {javax.ejb.FinderException.class, javax.ejb.ObjectNotFoundException.class, java.sql.SQLException.class};
try
{
beanHandler.handleRemoteException(th, appExceptions, this);
}
catch(javax.ejb.FinderException appExcep)
{
throw appExcep;
}
catch(javax.ejb.ObjectNotFoundException appExcep)
{
throw appExcep;
}
catch(java.sql.SQLException appExcep)
{
throw appExcep; LINE 557
}
catch(Exception ex)
{
throw (RemoteException)ex;
}
}
finally
{
beanHandler.postInvokeRemote(this, "getBlackListedCustomerBank:int;int;" );
}
beanHandler.unlockEJB(this);
return (java.util.Collection)Cloner.clone (value);
}
public java.util.Collection getBlackListedCustomerBank()
throws java.rmi.RemoteException, javax.ejb.FinderException,
javax.ejb.ObjectNotFoundException, java.sql.SQLException
{
java.util.Collection value = null;
beanHandler.preInvokeRemote(this, "getBlackListedCustomerBank:");
try
{
value = ejb.getBlackListedCustomerBank();
}
catch(Throwable th)
{
Class[] appExceptions = {javax.ejb.FinderException.class, javax.ejb.ObjectNotFoundException.class, java.sql.SQLException.class};
try
{
beanHandler.handleRemoteException(th, appExceptions, this);
}
catch(javax.ejb.FinderException appExcep)
{
throw appExcep;
}
catch(javax.ejb.ObjectNotFoundException appExcep)
{
throw appExcep;
}
catch(java.sql.SQLException appExcep)
{
throw appExcep;
}catch(Exception ex) LINE 587
{
throw (RemoteException)ex;
}
}
finally
{
beanHandler.postInvokeRemote(this, "getBlackListedCustomerBank:" );
}
beanHandler.unlockEJB(this);
return (java.util.Collection)Cloner.clone (value);
}
[ July 02, 2003: Message edited by: Manish Sachdev ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, Manish. I'm not getting any ideas.
 
saahil sinha
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi manish,
unreachable cathc is only got when ur throwin a parent exception before a child exception also when ur throwin an exception u need a corresponding catch there is not catch when ur throwing the object not found exception coz u only have a sql exception catch so my guess is either dont throw exceptions tht ur not catchin or catch the exceptions u throw.
Hope tht works out
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!