How to catch SQLException  in the hibernate ?

Hi ~ , I am a newbie to java , recently I do a project that need to use hibernate to do insert data into database(db2) , but my program always encounter a DB deadlock problem , which throw an exception indicated that
"{code}DB2 SQL error: SQLCODE: -911, SQLSTATE: 40001, SQLERRMC: 2{code}"
so, in this case , i want to try catch block handle this exception , and the code is as follows:
public static void main(String[] args){
try {
Configuration cfg =
new Configuration().configure();
SessionFactory sf = cfg.buildSessionFactory();
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
try {
session.save(obj1);
session.save(obj2);
tx.commit();
session.close();
}catch (SQLException se) {
// ***** here it indicate an error that "This exception is never thrown from the try statement body" *****
}catch (HibernateException e) {
e.printStackTrace();
}but in fact , while running the programe , it does throw a SQLException that abend the program , how would I not be able to catch it ? , here I provide the error info :
Hibernate: insert into TBCUSRPQ (CUST_NAME, CUST_SALUT, LAST_UPDT_BY, LANG, VER, FNL_RSK_LVL_CDE, SYS_RSK_LVL_CDE, CUS_RSK_LVL_CDE, NO_OF_ANS, ANS_REF_ID, DTL_INFO, BANK_NO, CTRY_CDE, RPQ_GP, CUST_ID_TYPE, CUST_ID_NO, LAST_UPDT_DT, LAST_UPDT_TM) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into TBCUSANS (ANS_LIST, ANS_REF_ID, QUEST_NUM) values (?, ?, ?)
Nov 5, 2008 12:04:17 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: -911, SQLState: 40001
Nov 5, 2008 12:04:17 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: DB2 SQL error: SQLCODE: -911, SQLSTATE: 40001, SQLERRMC: 2
Nov 5, 2008 12:04:17 PM net.sf.hibernate.impl.SessionImpl execute
SEVERE: Could not synchronize database state with session
net.sf.hibernate.exception.GenericJDBCException: could not insert: [com.hsbc.rpq.importer.vo.ris.CustomerAnswer#com.hsbc.rpq.importer.vo.ris.CustomerAnswer@87235980]
at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:80)
at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at com.hsbc.rpq.importer.TestDB.main(TestDB.java:78)
{color:#ff0000}Caused by: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -911, SQLSTATE: 40001, SQLERRMC: 2{color}
at com.ibm.db2.jcc.c.fg.e(fg.java:1596)
at com.ibm.db2.jcc.b.gb.o(gb.java:727)
at com.ibm.db2.jcc.b.gb.g(gb.java:143)
at com.ibm.db2.jcc.b.gb.a(gb.java:39)
at com.ibm.db2.jcc.b.w.a(w.java:34)
at com.ibm.db2.jcc.b.vb.g(vb.java:139)
at com.ibm.db2.jcc.c.fg.n(fg.java:1177)
at com.ibm.db2.jcc.c.gg.eb(gg.java:1862)
at com.ibm.db2.jcc.c.gg.d(gg.java:2295)
at com.ibm.db2.jcc.c.gg.W(gg.java:457)
at com.ibm.db2.jcc.c.gg.executeUpdate(gg.java:440)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462)
... 8 moreI tried a lot , but couldn't solve the problem, could anyone help me , how to catch a SQLExcepion in this case , thanks in advance !!

Hi,
as corlettk said, you may only catch exceptions that are thrown at you directly (at least for checked exceptions...). If you really want to handle this specific error situation in any reasonable way, there is the possibility to catch what is thrown at you and inspect the cause of the exception provided.
try {
    // some hibernate calls
} catch (GenericJdbcException ge) {
    if(ge.getCause() != null && ge.getCause() instanceof SQLException) {
        SQLException se = (SQLException)ge.getCause();
        if(se.getErrorCode() == -911) {
            // your error handling for this case
        }else{
            throw ge; // do not swallow unhandled exceptions
    }else{
        throw ge // do not swallow unhandled exceptions
}But such things quickly get quite ugly, e.g. if the SQLException is not the direct cause of the GenericJdbcException...so you should be aware what you are doing.
Bye.

Similar Messages

  • OC4J 10.1.3: EJB3 - How to catch SQLExceptions in a SessionBean

    Hi,
    originally I posted this a few minutes ago in the toplink forum, but I'm
    unsure if this better suits here. So exceptionally, I post it here as well with a
    reference to:
    EJB3 - How to catch SQLExceptions from within a stateful session bean
    I would like to catch any exception while persisisting the data right in my stateful
    session bean and don't have to wait until the client receives an SQLException
    wrapped in a bunch of other exceptions.
    Here some code fragments to illustrate my problem:
    // in Client:
    InitialContext ctx = new InitialContext();
    statefulWork =  (StatefulWork) ctx.lookup("StatefulWork");
    try {
      statefulWork.doIt();
    } catch (Throwable t) {
      // don't want to implement db-failover here, even though this works
    // in SSB
    @Resource
    private EntityManager em;
    public void doIt() {
            try {
                // create some entites here, do some loops, long running transaction
                em.persist(oneOfMyEntityObjects);
                // set some state in the SSB here
            } catch (Throwable t) {
                // I want to catch all exceptions the persistence provider (toplink) gets
                // but I don't get any here :-(
                // this should be to implement proper retry after reconnect (RAC with TAF)
    }In my testcase I issue a shutdown abort while insert statements are executed.
    The client receives an EJBException, but within the SSB nothing...
    How to change this behavior?
    Here is what one can find in the OC4J log:
    [TopLink Warnung]: 2006.03.27 03:25:32.220--UnitOfWork(13386)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Interne Exception: java.sql.SQLException: ORA-25402: transaction must roll back
    Fehlercode:25402
    Call:INSERT INTO T_RUN_DETAILS (ID, INS_TIME, COUNTER, RUN_ID) VALUES (105781, '2006.03.27 03:23:55', 450, 801)After that the transaction is properly rolled back (automatically) and the client
    could implement the failover code, but I could not find a possibility to control this
    at server side. Even with BMT I could not manage to catch this exception. I
    wouldn't have a problem if I had to call ctx.setRollbackOnly() myself.
    Hope someone can help. I'm getting a little desperate here.
    Thanks,
    Eric

    Thanks to the help of James Sutherland I managed to get this working.
    I had to add a call to em.flush() and use BMT for the SSB. For details please follow my link to the toplink-forum!
    James thinks OC4J can handle automatic transaction retries but wasn't sure about how to configure this in OC4J. Anyone can help?
    Regards,
    Eric

  • How to catch SQLException from a session bean

    Hello
    I have a stateless session bean which has a method to persist an entity (User) in the database. In User there is a foreign key (addressId) from another entity (Address). While i was persisting User, i entered a value of addressId which was not present in the Address table. Since there was a foreign key constraint on this field in User i got the following exception:
    8:49:49,421 ERROR [JDBCExceptionReporter] ORA-02291:
    integrity constraint (FK_USER_ADD) violated - parent key not
    found 18:49:49,421 ERROR [AbstractFlushingEventListener]
    Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: could
    not insert: [com.User] at org.hibernate.exception.SQLStateConverter.convert(SQLState
    Converter.java:71)So i placed the persist code inside a try block and was catching all the exceptions thrown by persist() method. But these exception are not caught. Instead the exception is sent to the Client end and printed on the client console.
    Any clue on how to catch the ConstraintViolationException in the session bean?
    Thanks

    The problem is that the qry is not executed until you leave your method, so, the exception is catched by the Container. You should issue a entityManager.flush(); rigth "before" leaving the method and you are going to catch all the exceptions given
    Cheers

  • How to catch SQLException in CMP bean

    Hi there,
    I am using CMP beans to set columns, one of which has referential integrity.
    Because the abstract set() method does not declare to throw SQLException, I
    can not catch SQLException in my session bean (which calls local CMP bean
    for creating and setting entity beans), the compiler complains "unreachable
    block".
    I can only try catching RemoteException in my delegate class. I do not like
    that, I even tried to catch all exceptions, i.e., catch Exception, in my
    session bean, I still did not catch the SQLException.
    The update calls are made into DB probably right before the transaction
    completes, however, since it is the container generated classes that does DB
    calls and throw SQLException, I could not catch it there since I do not have
    the source code for generated classes.
    Call stack is attached.
    Any suggestion is welcome. Basically I would like to catch SQLException in
    session bean.
    Thanks.
    Yan
    <Oct 18, 2004 10:09:06 AM EDT> <Error> <EJB> <BEA-010026> <Exception
    occurred during commit of transaction Name=[EJB com.med
    lus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(java.util.A
    rrayList,long,java.lang.String)],Xid=BEA1-0153A4
    2892EE25246C3(29499284),Status=Rolled back.
    [Reason=weblogic.utils.NestedRuntimeException: Error writing from
    beforeCompleti
    n - with nested exception:
    [java.sql.SQLException: ORA-02291: integrity constraint
    (DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
    ]],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds
    left=30,XAServerResourceInfo[weblogic.jdbc.wrappe
    .JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceI
    mpl]=(state=rolledback,assigned=myserver),xar=we
    logic.jdbc.wrapper.JTSXAResourceImpl@1a7491e,re-Registered =
    false),SCInfo[hubservices+myserver]=(state=rolledback),properti
    s=({weblogic.transaction.name=[EJB
    com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(jav
    a.util.ArrayL
    st,long,java.lang.String)], weblogic.jdbc=t3://172.18.15.54:7001}),local
    properties=({modifiedListeners=[weblogic.ejb20.inte
    nal.TxManager$TxListener@71de6e]}),OwnerTransactionManager=ServerTM[ServerCo
    ordinatorDescriptor=(CoordinatorURL=myserver+172
    18.15.54:7001+hubservices+t3+,
    XAResources={},NonXAResources={})],CoordinatorURL=myserver+172.18.15.54:7001
    hubservicest3+)
    java.sql.SQLException: ORA-02291: integrity constraint
    (DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
    at
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
    at
    oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:18
    1)
    at
    oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatemen
    t.java:543)
    at
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
    :1027)
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedSta
    tement.java:2885)
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
    ment.java:2957)
    at
    weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java
    :115)
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS._
    WLstore(Pharmacy_i7s2ww__WebLogic_C
    P_RDBMS.java:3564)
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS.e
    jbStore(Pharmacy_i7s2ww__WebLogic_CMP
    RDBMS.java:3390)
    at
    weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:965)
    at
    weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java
    :653)
    at
    weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInf
    o.java:1010)
    at
    weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCI
    nfo.java:115)
    at
    weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(
    ServerTransactionImpl.java:1184)
    at
    weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerT
    ransactionImpl.java:1910)
    at
    weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTra
    nsactionImpl.java:273)
    at
    weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransaction
    Impl.java:244)
    at
    weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:299)
    at
    weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObject.jav
    a:140)
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl.updatePharm
    acy(PharmacyMgr_kb6mwa_EOImpl.java:16
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl_WLSkel.invo
    ke(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:363)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    --------------- nested within: ------------------

    Hi there,
    I am using CMP beans to set columns, one of which has referential integrity.
    Because the abstract set() method does not declare to throw SQLException, I
    can not catch SQLException in my session bean (which calls local CMP bean
    for creating and setting entity beans), the compiler complains "unreachable
    block".
    I can only try catching RemoteException in my delegate class. I do not like
    that, I even tried to catch all exceptions, i.e., catch Exception, in my
    session bean, I still did not catch the SQLException.
    The update calls are made into DB probably right before the transaction
    completes, however, since it is the container generated classes that does DB
    calls and throw SQLException, I could not catch it there since I do not have
    the source code for generated classes.
    Call stack is attached.
    Any suggestion is welcome. Basically I would like to catch SQLException in
    session bean.
    Thanks.
    Yan
    <Oct 18, 2004 10:09:06 AM EDT> <Error> <EJB> <BEA-010026> <Exception
    occurred during commit of transaction Name=[EJB com.med
    lus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(java.util.A
    rrayList,long,java.lang.String)],Xid=BEA1-0153A4
    2892EE25246C3(29499284),Status=Rolled back.
    [Reason=weblogic.utils.NestedRuntimeException: Error writing from
    beforeCompleti
    n - with nested exception:
    [java.sql.SQLException: ORA-02291: integrity constraint
    (DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
    ]],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds
    left=30,XAServerResourceInfo[weblogic.jdbc.wrappe
    .JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceI
    mpl]=(state=rolledback,assigned=myserver),xar=we
    logic.jdbc.wrapper.JTSXAResourceImpl@1a7491e,re-Registered =
    false),SCInfo[hubservices+myserver]=(state=rolledback),properti
    s=({weblogic.transaction.name=[EJB
    com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(jav
    a.util.ArrayL
    st,long,java.lang.String)], weblogic.jdbc=t3://172.18.15.54:7001}),local
    properties=({modifiedListeners=[weblogic.ejb20.inte
    nal.TxManager$TxListener@71de6e]}),OwnerTransactionManager=ServerTM[ServerCo
    ordinatorDescriptor=(CoordinatorURL=myserver+172
    18.15.54:7001+hubservices+t3+,
    XAResources={},NonXAResources={})],CoordinatorURL=myserver+172.18.15.54:7001
    hubservicest3+)
    java.sql.SQLException: ORA-02291: integrity constraint
    (DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
    at
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
    at
    oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:18
    1)
    at
    oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatemen
    t.java:543)
    at
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
    :1027)
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedSta
    tement.java:2885)
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
    ment.java:2957)
    at
    weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java
    :115)
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS._
    WLstore(Pharmacy_i7s2ww__WebLogic_C
    P_RDBMS.java:3564)
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS.e
    jbStore(Pharmacy_i7s2ww__WebLogic_CMP
    RDBMS.java:3390)
    at
    weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:965)
    at
    weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java
    :653)
    at
    weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInf
    o.java:1010)
    at
    weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCI
    nfo.java:115)
    at
    weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(
    ServerTransactionImpl.java:1184)
    at
    weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerT
    ransactionImpl.java:1910)
    at
    weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTra
    nsactionImpl.java:273)
    at
    weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransaction
    Impl.java:244)
    at
    weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:299)
    at
    weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObject.jav
    a:140)
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl.updatePharm
    acy(PharmacyMgr_kb6mwa_EOImpl.java:16
    at
    com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl_WLSkel.invo
    ke(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:363)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    --------------- nested within: ------------------

  • How to catch error in the Active Sync process

    Hi, we are using Flat File active sync to update IDM user attribute. Once IDM found matched record, it builts view. However, during this period, the the matched user is locked, for example. Then IDM stop processing this record then go to next record. How can I catch this error? In log file I saw error message but how can use workflow or other way to know the error? How can get ResultItem that contains error message during AS?

    Hi,
    I am doing the following....
    Assume a main workflow which calls many sub workflows ...
    1. Define two global variables as follows
    <Variable name='anyErrorOccured'><Boolean>false</Boolean></Variable>
    <Variable name='allErrorMsg'><s>Error..</s></Variable>
    2. In the all main and sub workflows, add an special 'Action' to check the errors after each Action
    <Action id='1' name='doSomething'>
    </Action>
    <Action id='2' name='checkForErrors'>
    <cond>
    <isTrue><ref>WF_ACTION_ERROR</ref></isTrue>
    set the anyErrorOccured variable to true
    Append a custom error message(hard coded) to allErrorMsg variable - error message may contain workflow name and in which action error occured
    </cond>
    </Action>
    3. Before ending the main workflow, if anyErrorOccured is true, then send an email to IDM administartor with allErrorMsg
    <Activity id='3' name='CheckOverallError'>
    <Transition to='SendOverallErrorNotificationToIDM'>
    <ref>anyErrorOccured</ref>
    </Transition>
    <Transition to='end'/>
    </Activity>
    Hope, this helps.
    Furthermore, I tried to catch the actual error trace from IDM using the following in each 'checkForErrors' Action and append all IDM error messages for email notification.
    <invoke name='getMessage'>
    <get>
    <invoke name='getErrorMessages'>
    <ref>WF_CASE_RESULT</ref>
    </invoke>
    <i>1</i> ???????
    </get>
    </invoke>
    But , it was not successful, as I could not extract the right error mesage at the right place from WF_CASE_RESULT

  • How to catch Exception inside the native code

    Hello,
    I have an error of unexpected exception during running native code,it occurrs randomly, not every time.
    the error text is:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x9535F359
    Function=acy_match+0xC6
    Library=/usr/lib/libNegativeMatcher.so
    I don't know what exactly cause the crash inside the c code but I think it might be memory leak . What I'm concern is that this exception cause program termination.
    I have few questions:
    1. This exception cause the java program to end. How can I catch this exception and avoid program termination?
    2. What is 0xC6 in:
    Function=acy_match+0xC6
    and PC=0x9535F359?
    Can it help me track the problem inside the native code?
    Thanks for your help.

    An unexpected exception has been detected in native
    code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x9535F359
    Function=acy_match+0xC6
    Library=/usr/lib/libNegativeMatcher.so
    I don't know what exactly cause the crash inside the
    c code but I think it might be memory leak . What
    I'm concern is that this exception cause program
    termination.I doubt it is a memory leak (actually I am rather certain that another error would occur if it was just memory exhaustion.)
    I have few questions:
    1. This exception cause the java program to end. How
    can I catch this exception and avoid program
    termination?I suspect that would be a really bad idea. That particular signal very likely indicates that you have corrupted memory. Continuing is unlikely to work.
    2. What is 0xC6 in:
    As a guess it is an offset into the compiled code which indicates where the memory problem was detected.
    That it unlikely to help you with a pointer/memory problem because that is where it was detected and not where it happened. By comparing the source you might be able to determine what was bad and then trace it back.

  • How to catch the value in sum(control break statement).

    hi,
    can any one tell me how to catch the value in sum in control break satament.
    ex.
    at end of brtwr.
    sum.
    endat.
    I need to print the value in sum only.
    I tried to declare a varaible of type i and assigned sum to this variable.
    it is giving syntax error that sum is not identified.
    How should i do this.
    regards.

    Hi Siva,
    In control break statement when we use SUM. it added all the amount fields and stores its in the work area of that field.
    look below code.
    DATA : BEGIN OF itab OCCURS 0,
               name(10),
               num TYPE i,
           END OF itab.
    DATA : num TYPE i .
    itab-name = 'salman'.
    itab-num  = 100.
    APPEND itab.
    itab-name = 'salman'.
    itab-num  = 200.
    APPEND itab.
    itab-name = 'akshay'.
    itab-num  = 500.
    APPEND itab.
    LOOP AT itab.
      AT END OF name.
        SUM.
        WRITE : / itab-num.
      ENDAT.
    ENDLOOP.
    here the SUM value is stored in Workarea,
    the output will be 300 & 500.
    regards
    Kumar M

  • How to catch the error occurred in Integration Process, and then save it?

    1. how to catch the error occurred in Integration Process, and then save the detailed error message to the file?
    2. there are fault message type for inbound message interface, how to use the fault message type in IR?
    Thanks,
    Michael
    Message was edited by: Spring Tang
    inital
    Message was edited by: Spring Tang
    detailed message output
    Message was edited by: Spring Tang
    fault message type

    Hi Spring,
    If u give an exception step along with your Transformation Step, whenever some error occurs in your message mapping, this exception block wil be triggered.
    You can configure your exception block to do all exception processing that you want. This exception handling is like any other java Exceptio n Handler. You can do anything that you want in your exception handler block on the basis of your requirements.
    <i>If an exception is triggered at runtime, the system first searches for the relevant exception handler in surrounding blocks. If it does not find the correct exception handler, it continues the search in the next block in the block hierarchy.
    When the system finds the correct system handler, it stops all active steps in the block in which the exception handler is defined and then continues processing in the exception handler branch. Once the exception handler has finished processing, the process is continued after the block.
    If the system fails to find an exception handler, it terminates the integration process with an error.</i>
    Regards,
    Bhavesh

  • How to catch the return object

    this one is my code
    private static select(){
    String URL = "jdbc:mysql://localhost/Chat";
    String username = "root";
    String password = "";          
    Vector result = new Vector();
    try {
         Class.forName("com.mysql.jdbc.Driver").newInstance();
            } catch (Exception e) {
                System.out.println("Failed to load MySQL driver.");
    Statement stmt = null;
    Connection con=null;
    try {
    con = DriverManager.getConnection(URL,username,password);
    stmt = con.createStatement();
    ResultSet RS = stmt.executeQuery("SELECT * FROM message;");        
             while(RS.next()){
                String command = RS.getString("command");
                String source = RS.getString("source");
                String target = RS.getString("target");
                String message = RS.getString("message");
                String typeuser = RS.getString("typeuser");
                String photouser = RS.getString("photouser");              
                String temp = command+"?"+source+"?"+target+"?"+message+"?"+typeuser+"?"+photouser;
            result.addElement(temp);
               RS.close();
            stmt.close();
               con.close();                
    } catch(SQLException e) {
                System.err.println("******SQLException : *******");
                while (e != null)
                  System.out.println("Message : "+e.getMessage());
                  System.out.println("Etat : "+e.getSQLState());
                  System.out.println("Code Erreur : "+e.getErrorCode()+"\n");
                  e = e.getNextException();
    return *******?; // what should i write here since i want to catch the value of vector, and use it in somewhere else       
        }

    Okay, this method makes no sense. But, if you want it to return a Vector, then it needs to have a return type of Vector.private static Vector select()Then use the return statement as such:return result; // as result is the name of you VectorYou then call the method as such:Vector v = select();I still don't understand the purpose of the method. Why is it static?
    Methinks someone needs to go back to basics of Java programming.
    Hope that helps, though.
    James

  • How to catch the user defined  exception in application service

    Hi All,
    How to catch the user defined  exception in application service  when it is throwed by the external service..
    Regards,
    Thirumurugan.

    Hi,
        Thanks for your reply,
            Actually I  am calling validate Login method of External service from the application service. When the login fails, my external service will throw user defined Exception.I want to catch the user defined Exception.
        But in the application service , validate Login method can catch  only Invocation Exception and Engine Exception.
       These two exception are present in the Application service remote interface.
      public com.sap.comptest.extsrv.accrjavawsvi__document.output.
    Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException;
    User defined exception is not present there. When i include the webservice as external service in CAF, it suppossed to generate the java file for the custom exception of validate Login method and this generated file should be included in the application service remote interface..
    public com.sap.comptest.extsrv.accrjavawsvi__document.output.
    Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException,
    (generated file name of user defined Excpetion.
      Then only  validate login method  of application service can catch  the user defined Exception which is thrown by the  external service.
    regards,
    Thirumurugan.p

  • How to catch the photos left on the cloud?

    Can you explain how to catch all my photos I have left on the cloud. I can't get them anymore.
    Can somebody help me?

    Hello MrMorten,
    I will get you in touch with the relevant team to have more information.
    Thank you.
    Arnaud.

  • How to catch a SQLException like this

    HI,guys
    I'm now connection a mysql database with jdbc.for I had set a column unique,if I insert the column with same word twice,it will throw a SQLException.the Exception Message is below:
    ----------------------------------------------------------------------------------------------------------------------------------------java.sql.SQLException: Invalid argument value, message from server: "Duplicate entry 'cat1' for key 2"
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:1874)
         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1700)
         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1569)
         at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:233)
         at com.genech.admin.utils.AddCategory.addcategory(AddCategory.java:52)
         at com.genech.admin.actions.AddCategoryAction.doBusiness(AddCategoryAction.java:47)
         at com.genech.admin.actions.AbstractAction.execute(AbstractAction.java:51)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
         at filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:169)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Unknown Source)
    now I want to catch it.but I cannot make sure if I can ONLY catch this Exception but not others.who can help me?Thanks.

    try {
         con = DriverManager.getConnection("jdbc:mysql://computerName/databaseName",userName,password);
         stmt = con.createStatement();
         return true;
         catch(SQLException ex) {
         if(ex.getMessage().toUpperCase().compareTo("SERVER CONFIGURATION DENIES ACCESS TO DATA SOURCE")==0)
              createErrorWindow("Somebody is already logged in, please try again later");
         else
              createErrorWindow("Error establishing connection to remote machine!");
         return false;
    I do this do decide between different types of SQLExceptions - use exception.getMessage() and compare the string returned.
    Steve.

  • How to catch attachment info. in the Business Activity Doc.?

    Hi experts,
    How to catch attachment info. in the Business Activity Doc.? For example, I want to get how many attachments in the Activity. and the description of attachments.Is there any SAP table or FM for it ? Thank you.
    Best regards,
    Gavin

    Hi,
      Go to the table CRMD_ORDERADM_H give your trnsaction( Activity ) no in the OBJECT_ID field, you will get GUID corresponding to the transaction.
    Pass the GUID in the SMOATTACHLNK Table in the PARENTID field, then you will get PHIO_ID.
    Pass PHIO_ID in the table CRMORDERPHIO Table in the field PHIO_ID, then you will get LOIO_ID.
    Finally pass youe LOIO_ ID into CRMORDERLOIO table in the field LOIO_ID then you will get how many attachments are there for particula transaction
    Tables
    CRMORDERLOIO
    CRMORDERLOIOT
    Regards
    Srinu

  • How to catch the ApplicationStart event??

    how to catch the application start event??
    i want to do some actions (Java code) that will be run once when the application started
    this like ApplicationStart event in ASP.NET
    how ???

    Google for javax.servlet.ServletContextListener. You need to write a class that implements this interface and register it in web.xml.
    Please ask questions like this in the JDeveloper or OC4J forum since they are not related to JHeadstart.
    Steven Davelaar,
    JHeadstart Team.

  • How to Catch the state of the Entity Object

    I have Location Entity object. With JClient I am testing it.
    I want to insert the data,
    due to validations (wrong data) insert fails.
    Then I am correcting data, still to another view object it is passing old data.
    After correcting the data when I try to click commit it is not executing the code from getEntityState = STATUS_NEW
    Can someone also please let me know how to catch the state of the entity
    Thanks

    Hi Juli,
    I am totally new to using Jdeveloper and I need ur humble help letting me know how to access an Entity object for invoking the insert, update and delete statements. It would be great if u can provide me with some error-free sample code.
    Waiting for some help from U.

Maybe you are looking for

  • CUP - Issue regarding creation of New SAP ID in CUP.

    System :  SAP GRC 5.3 SP 12.. We have requirement where in we need to design a workflow for creation of New SAP ID. The Naming convention followed for SAP ID is FIRST LETTER of FIRST NAME and LAST NAME with maximum 8 characters. For Eg JOHN SMITH wou

  • Getting Body Tag Error When Updating Template In Dreamweaver

    I get an error message when I have tried to update the template, it says "unbalanced body tag" on line 138. Code is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  • How to trigger data recording to a text file for multiple channels for a certain voltage threshold?

    I am working with 6 channels, from each of which I am obtaining voltage values ranging from 0.6-6 V.  I am using the DAQ Assistant to acquire and write the data to a text file.  However, I only want the data to be written to the text file when the di

  • Mounting Xserve Raid Volumes

    I'm relatively new to Xserve RAID and I hope this isn't a topic that's already been covered. If I unmount (or eject) a RAID volume, how do I re-mount it. Other than rebooting the system. The RAID volumes don't appear in /etc/fstab. Where exactly does

  • Hierarchy from flat file loading with errors - duplicate node names

    Hello experts, I am loading a product hierarchy from a flat file into a custom hierarchy object.  The issue is that it errors out saying I am loading duplicates within nodes, however all node IDs within a level are unique. It seems to be looking at t