shailesh Kumar

Greenhorn
+ Follow
since Aug 12, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by shailesh Kumar

Hi!


I was trying to use perssimistic exclusive update...

Regards,
Shailesh
Hi,

Has anybody acctually used access Indents in WSAD?

I have gone through the info in IBM white paper ,
But I am unable to simulate a condition to show its benifit!!

Could you somebody state an example where it is helpful?

Thanks and Regards,
Shailesh
Hi,

Hasnt anyone found the need to catch the exception in ejbStore and communicate to client the exact reason of failure?

If i can catch only remote exception, and the e.detail.getMessage
or e.getMessage all return me only "Transaction roll back exception" .

How can i inform the client that the error is because of
1. business condition failure (in my case, unique constraint failure, i need to say to client " your record already exist" ) or

2. some other failure (unable to get connection to db, i need to say to client "please try after some time").


The only workarround I see to use direct sqls instead of entity's setter methods, But then; what is the use of the entity bean?


Does this mean that when entities are being used, we are not using any constriants on the database?

Do BEA or Jboss handle this need?


Thank you for all your replies,

Regards,
Shailesh
Hi,


To catch the exception
1. we had to create an intermediate method with "No transaction" and from there call all methods with "requires"

2. But we always get "transaction roll back exception" , we are unable to retrieve a custom message set in EJBException

Regards,
Shailesh
Hi,

My Entity does have "Requires" set,

My Exact problem is that, the database has a "unique" constraint set on it, So its failure is revealed only when ejbstore is called.

When this cosntraint is viaolated i throw an EJBException("Unique cosntraint violated").

But The remote Exception when caught , always gives me transactionRollBackException, i tried remoteExeption.detail as well.

So, the problems are :

1. Catch the RemoteException when SessionBean is running "requires new" and entity "requires" (works in WSAD 5.0, but i dont know why,it doesnt on WSAD 5.1.2)

2. Catch the Message that i set in EJBException. ( i want to see the message , because there are two unique constraints and i need to diffrenciate between the same)

Regards,
Shailesh
Hi,

True, I should be able to catch the remoteException,
But the problem is that ....

Session Bean is running in "Requires New"

If i change this to "Not Required" , I can catch the Remote Exception.

But I cant do it because ...

I have to insert into one table (using entity) ...
Then log, that the insert is successfull in other table...

Any of the above two fails I need to rollback ...

I guess , the problem is EJBException marks transaction for rollback...
and when the session bean receives another exception...
It again trys to mark the transaction for rollback ...
This results in error .....

Just a guess,

Thanks and regards,
Shailesh
Hi,

I have a simple stateless session bean that has a method
that tries to access an entity bean, The entity bean has all method empty except ejbstore.

public void ejbStore() {
System.out.println("EntityBean.ejbStore()");
throw new EJBException("Lets see if i can catch this");
}

the method in session bean is :

public String testEjbException(){

Context ctx;
try {
ctx = new InitialContext();
EntityHome home = (EntityHome)ctx.lookup("ejb/com/EntityHome");
home.create();

return "Created";
} catch (NamingException e) {
System.out.println(" Naming Exception() NamingException");
return "NamingException";
} catch (RemoteException e) {
System.out.println(" RemoteException");
return "RemoteException";
} catch (CreateException e) {

System.out.println(" CreateException");
return "CreateException";
}
catch (NoSuchEntityException e) {

System.out.println(" NoSuchEntityException");
return "EJBException";
}catch (EJBException e) {

System.out.println("EJBException");
return "EJBException";
}

}

But i am not able to catch this exception in the session bean.
Instead i get a TransactionRolledbackException Exception.

I am using WSAD 5.1.2

Can we catch EjbException this way?

Thanks and regards,
Shailesh
I too used the same article....
And faced the same error too....

The solution is not very elegant ... but it worked ...
Add the Queue connection factory and Queue settings under Server Settings ..
Instead of Node ....

It worked for me...

Let me know if you have found a better solution..

Regards,
Shailesh
19 years ago