报什么异常你catch异常就是了.
我也碰到过奇怪的问题,findByPrimaryKey()我传一个不存在的key结果在session bean里面catch的异常不是FinderException.你就先catch(Exception e)打印出来,然后改成catch那个异常就是了.
我也碰到过奇怪的问题,findByPrimaryKey()我传一个不存在的key结果在session bean里面catch的异常不是FinderException.你就先catch(Exception e)打印出来,然后改成catch那个异常就是了.
我在 catch 块里只是打印一个字符串。字符串并没有打印出来,奇怪!!!为什么会 catch 不到??
session bean:
public void createTest() {
try {
tt = ttHome.create(new Integer(0));
} catch (Exception e) {
System.out.println("exception");
}
}
部分异常代码
<Exception occurred during commit of transaction Name=[EJB testejb.STesttwoBean.createTest()],Xid=BEA1-0006FEF03DC77F28EDB9(9538612),Status=Rolled
back. [Reason=weblogic.utils.NestedRuntimeException: Error writing from beforeC
ompletion - with nested exception:
[javax.ejb.DuplicateKeyException: Bean with primary key: '0' already exists.]],n
umRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=30,X
AServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo
[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=rolledback,assigned=myserver),x
ar=weblogic.jdbc.wrapper.JTSXAResourceImpl@137ef34),SCInfo[mydomain+myserver]=(s
tate=rolledback),properties=({weblogic.transaction.name=[EJB testejb.STestBean()这个异常不是 catch 到的
插入的主键值重复异常为什么 catch 不到????