Is that possible to catch exception of a form

Hi,
As we know, in ABAP exception handling can be at least 2 ways:
1. For class exception:
try
catch cl_ex into ex.
endcatch.
2. For function module:
call function 'function'
  exceptions
   ex  = 1
   others = 99.
3. is it possible to capture non_class exception from a form?
Thanks and regards,
Said

This link may help you
http://help.sap.com/saphelp_nw04/helpdata/en/83/636d1712fc11d5991e00508b5d5211/content.htm

Similar Messages

  • Catch Exception - End User Form

    Our end user form requires that we display the manger of the end user. We have the manager id stored for the logged in user so we grab the id and get the fullname. This functionality works fine.
    <br><br>
    The issue is if an id pointing to a manger that does not exist! Basically, an invalid id (no corresponding user exists) then the following error is thrown:
    <br><br>
    XPRESS exception ==> com.waveset.util.WavesetException: Can't call method getObject on class com.waveset.ui.FormUtil ==> com.waveset.util.InternalError: ID not passed to ObjectCache.getObjectIfExists
    <br><br>
    How do we capture this or any other error on an end user form (not a workflow)? Or do we need to check to see if the user exists before we try to get the fullname? And if so, how?
    <br><br>
    The last part of my code to get the fullname:
    <br><br>
    <RuleArgument name='mgrPersId'/>
    <cond>
    <notnull>
    <ref>mgrPersId</ref>
    </notnull>
    <invoke name='getObjectNames' class='com.waveset.ui.FormUtil'>
    <new class='com.waveset.session.InternalSession'/>
    <s>User</s>
    <map>
    <s>conditions</s>
    <list>
    <new class='com.waveset.object.AttributeCondition'>
    <s>name</s>
    <s>equals</s>
    <ref>mgrPersId</ref>
    </new>
    </list>
    </map>
    </invoke>
    <null/>
    </cond>
    </Rule>

    Please suggest anyone.... Its Urgent....
    Regards,
    Vinash

  • Possible to catch parameters exceptions in the program ?

    Hi,
    Oracle 10g r2.
    I have some procedures/functions like :
    function insert_op (op_name in varchar2, op_date in date, op_length in number) is
    begin
    end;If I call for example :
    insert_op('test','02/05/2010','hehe')I will get an error (invalid number). Normal.
    My qyestion is, is it possible to catch that exception in the function ?
    The fact is that my function is called from an input button in my apex application, so if user enter wrong values in the form, I can't catch the error except using Javascript.
    Or should I pass all my parameters as varchar2, and then make functions to ckeck if it is valid numbers, dates, etc... :/
    Thanks.
    Yann.

    function insert_op(op_length in number) return varchar2 is
    temp number;
    begin
    temp := TO_NUMBER(op_length);
    return 'ok it is a number';
    exception
    when others then return 'not a number';
    end;Define the op_length as varchar2
    create or replace function insert_op(op_length in varchar2) return varchar2 is
    temp number;
    begin
       temp := TO_NUMBER(op_length);
       return 'ok it is a number';
    exception
    when others then return 'not a number';
    end;And further most important thing is dont use WHEN OTHERS. Use the specific exception. In this case VALUE_ERROR.
    I have done such thing in the past. Here is that code.
    create or replace function is_number(pVal in varchar2) return number
    as
       lNum number;
    begin
       lNum := to_number(pVal);
       return 1;
    exception
       when value_error then
               return 0;
    end;Edited by: Karthick_Arp on Mar 1, 2011 5:26 AM

  • Catch exceptions that occur in the constructor of a managed bean

    Hello,
    I would like to catch exceptions that might occur in the constructor of a managed bean and redirect to an error page. My beans need to get data from a database and if the database is not accessible, an error page is to tell the user "try again later". I don't want to write an action or actionListener that is invoked by a button klick on the previous page to make error handling easier, because an actionListener should not know about the next page and what data the next page will need.
    I read all postings about this topic I could find in this forum. And there are three solutions I tried:
    1) register an error-page in web.xml
    Is there an example for using this in a JSF application? It did not work. I got a "Page not found" exception
    2) Use a phase listener. But how can a phase listener do this? Is there an example? I don't think it can do it in the beforePhase method because this method is called before the constructor of the managed bean is called.
    3) Use a custom ViewHandler. This is my renderView method which creates a "Page not found" Exception.
    public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException {
    ViewHandler outer = context.getApplication().getViewHandler();
    try {
    super.renderView(context, viewToRender);
    } catch (Exception e) {
    context.getExternalContext().redirect("/error.jspx");
    Several people write they've done it one or the other way. Please share your knowledge with us !!
    Regards,
    Mareike

    Hallo Mareike,
    Maybe I should abandon managed beans, create my own
    "unmanaged" ones inside of an action listener and put
    them somewhere my pages can find them.
    Its a pity, because I like the concept of managed
    beans.sure setter injection of JSF is fine!
    well workaround could be using <h:dataTable rendered="#bean.dbAccessible" ...>
    In your constructor you catch the exception and set
    dbAccessible = false;
    or you use error pages of webcontainer,
    but the pages couldn't contain JSF components, IMHO
    only plain JSP files.
    BTW perhaps somebody on MyFaces' list knows the solution:
    http://incubator.apache.org/myfaces/community/mailinglists.html
    Regards,
    Mareike-Matthias

  • [svn:bz-trunk] 8964: Fix LCDS-953 - Add a last ditch catch block to the service() function to avoid any possibility or leaking exception info.

    Revision: 8964
    Author:   [email protected]
    Date:     2009-07-31 12:07:09 -0700 (Fri, 31 Jul 2009)
    Log Message:
    Fix LCDS-953 - Add a last ditch catch block to the service() function to avoid any possibility or leaking exception info.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/LCDS-953
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/MessageBrokerServlet.java

    Dear Pallavi,
    Very useful post!
    I am looking for similar accelerators for
    Software Inventory Accelerator
    Hardware Inventory Accelerator
    Interfaces Inventory
    Customization Assessment Accelerator
    Sizing Tool
    Which helps us to come up with the relevant Bill of Matetials for every area mentioned above, and the ones which I dont know...
    Request help on such accelerators... Any clues?
    Any reply, help is highly appreciated.
    Regards
    Manish Madhav

  • SOAP to FILE using BPM to catch exception and save error into the table

    Hi All
    My scenario SOAP to FILE using BPB is working fine but now I have a requirement to catch an exception if something wrong happened on a runtime and save it into the tracking table, is that possible, if it is please point me to the similar step by step scenario.
    Thanks in advince,
    Yonela

    Yonela:
    As your original requirement is to save the eorr data into your database table, however, you was mis-leaded to alerting field.
    You are using BPM now, then that is the reason that I suggested to use excpetion branch.
    It does not matter SOAP to File seneario, it does not have to be SAP - RFC scenario, your BPM willl interact with database system.
    First you have block which include all the steps that possible generate exception: like Transformation step, and your final Aync send step (which will send data to file).
    Secondly, define a exception handler for that block.
    3. Modify each steps that posssible generate exception: e.g. transformation step, send step, add exception handler to them.
    4. Create exception branch in side the block
    5. Add another send step inside your exception branch, which will call RFC, RFC will write data to your table.
    6. If you want, you can add a control step in exception branch to trigger a alert, or terminate current process.
    At run time, any steps that trigger exeption,will cause your exception branch executed, and RFC will be called to insert data into your database table.
    Regards
    Liang

  • Is it possible to catch ConnectionException in PublishingCacheStore

    Hi All,
    We are using 3 clusters of coherence; where data flow is always one way, i.e Master Cache writes to 2 other redundant caches (these caches are read only.. No writes are expected in these things). We are using PublishingCacheStore along with EventDistribution pattern.
    We have written our own CacheStore which extends PublishingCacheStore (of Push Replication Pattern). Everything works fine. In case of failover, i.e. if there is a connectionException to remote cluster we are not able to catch that exception. However we could see the exception in the system console.
    Please let me know if anyone has any idea how to do it.
    CacheStore Implementation:
    ==================
    @Override
         public void store(BinaryEntry entry) {
              if(logger.isDebugEnabled()) logger.debug("Entry >> store entry "+entry+" for channelName "+channelName+" & cacheName "+cacheName);
              try {
                   super.store(entry);
              }catch (ConnectionException e) {
                   logger.error("ConnectionException occured while store (replicating) the data to channelName "+channelName+" for cacheName "+cacheName,e);
    //Some business logic needs to be added on Exception
                   //Throwing back the exception to make sure that the replicated failure data is requeued again.
                   throw new RuntimeException(e);
              catch (Exception e) {
                   logger.error("Exception occured while store (replicating) the data to channelName "+channelName+" for cacheName "+cacheName,e);
                   //Some business logic needs to be added on Exception
                   //Throwing back the exception to make sure that the replicated failure data is requeued again.
                   throw new RuntimeException(e);
    Coherence cache Config.xml
    =================
    <cache-mapping>
         <cache-name>TEST</cache-name>
              <scheme-name>CacheDB</scheme-name>
                   <event:distributor>
                        <event:distributor-name>{cache-name}</event:distributor-name>
                        <event:distributor-external-name>{site-name}-{cluster-name}-{cache-name}</event:distributor-external-name>
                        <event:distributor-scheme>
                             <event:coherence-based-distributor-scheme />
                        </event:distributor-scheme>
                        <event:distribution-channels>
                             <event:distribution-channel>
                                  <event:channel-name>Active Publisher 1</event:channel-name>
                                  <event:starting-mode system-property="channel.starting.mode">enabled</event:starting-mode>
    <event:restart-delay>12000</event:restart-delay>
                                  <event:channel-scheme>
                                       <event:remote-cluster-channel-scheme>
                                            <event:remote-invocation-service-name>remote-site1</event:remote-invocation-service-name>
                                            <event:remote-channel-scheme>
                                                 <event:local-cache-channel-scheme>
                                                      <event:target-cache-name>TEST</event:target-cache-name>
                                                 </event:local-cache-channel-scheme>
                                            </event:remote-channel-scheme>
                                       </event:remote-cluster-channel-scheme>
                                  </event:channel-scheme>
                             </event:distribution-channel>
                             <event:distribution-channel>
                                  <event:channel-name>Active Publisher 2</event:channel-name>
                                  <event:starting-mode system-property="channel.starting.mode">enabled</event:starting-mode>
    <event:restart-delay>12000</event:restart-delay>
                                  <event:channel-scheme>
                                       <event:remote-cluster-channel-scheme>
                                            <event:remote-invocation-service-name>remote-site2</event:remote-invocation-service-name>
                                            <event:remote-channel-scheme>
                                                 <event:local-cache-channel-scheme>
                                                      <event:target-cache-name>TEST</event:target-cache-name>
                                                 </event:local-cache-channel-scheme>
                                            </event:remote-channel-scheme>
                                       </event:remote-cluster-channel-scheme>
                                  </event:channel-scheme>
                             </event:distribution-channel>
                        </event:distribution-channels>
                   </event:distributor>
              </cache-mapping>
    </caching-scheme-mapping>
         <!--
                   The following scheme is required for each remote-site when using a
                   RemoteInvocationPublisher
              -->
         <remote-invocation-scheme>
         <service-name>remote-site1</service-name>
                   <initiator-config>
                        <tcp-initiator>
                             <remote-addresses>
                                  <socket-address>
                                       <address>localhost</address>
                                       <port>20001</port>
                                  </socket-address>
                             </remote-addresses>
                             <connect-timeout>2s</connect-timeout>
                        </tcp-initiator>
                        <outgoing-message-handler>
                             <request-timeout>5s</request-timeout>
                        </outgoing-message-handler>
                   </initiator-config>
              </remote-invocation-scheme>
              <remote-invocation-scheme>
                   <service-name>remote-site2</service-name>
                   <initiator-config>
                        <tcp-initiator>
                             <remote-addresses>
                                  <socket-address>
                                       <address>localhost</address>
                                       <port>20002</port>
                                  </socket-address>
                             </remote-addresses>
                             <connect-timeout>2s</connect-timeout>
                        </tcp-initiator>
                        <outgoing-message-handler>
                             <request-timeout>5s</request-timeout>
                        </outgoing-message-handler>
                   </initiator-config>
              </remote-invocation-scheme>
              <distributed-scheme>
                   <scheme-name>UserCacheDB</scheme-name>
                   <service-name>DistributedCache</service-name>
                   <serializer>
                        <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                        <init-params>
                             <init-param>
                                  <param-type>String</param-type>
                                  <param-value>pof-config.xml</param-value>
                             </init-param>
                        </init-params>
                   </serializer>
                   <backing-map-scheme>
    <read-write-backing-map-scheme>
    <internal-cache-scheme>
    <local-scheme>
    </local-scheme>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>au.com.vha.cpg.cachestore.publishing.CPGPublishingCacheStore</class-name>
    <init-params>
    <init-param>
    <param-type>java.lang.String</param-type>
    <param-value>{cache-name}</param-value>
    </init-param>
                                            <init-param>
    <param-type>java.lang.String</param-type>
    <param-value>TEST</param-value>
    </init-param>
    </init-params>
    </class-scheme>
    </cachestore-scheme>
    </read-write-backing-map-scheme>
    </backing-map-scheme>
                   <listener />
                   <autostart>true</autostart>
              </distributed-scheme>

    Hi,
    As it's possible many things could fail - eg: one site may fail but the other may still remain working - it's best to let the PublishingCacheStore do it's own recovery. If you'd like to additionally use a CacheStore with Push Replication you can configure a separate Event Channel for the CacheStore using a CacheStore Event Channel.
    The configuration options are here:
    http://tinyurl.com/aporpcx
    The source code (for a test) is available here:
    http://tinyurl.com/axse83s
    -- Brian
    Brian Oliver | Architect | Oracle Coherence 

  • Catching exception of a super constructor

    Is it possible to catch the exception thrown by a super class
    constructor in a sub clas constructor?
    public class A
         public A() throws Exception
              throw new Exception("Exception from A");
    class B extends A
         public B()
              try
                   super();
              catch(Exception e)
    }I get an error saying,
    A.java:16: call to super must be first statement in constructor
    super();
    ^
    Any thoughts?

    More on this here,
    http://archive.devx.com/free/tips/tipview.asp?content_i
    =2384&Java=ONThanks for that link. I completely agree to what it says.
    In other words, not being able to successfully construct our super class implies that we cannot create our derived class.
    But I feel this must be mentioned clearly somewhere in JLS. And the error message that we get must be "You cannot catch exceptions thrown by a super class constructor".

  • Catch exception

    hi,
    I not really understand how the JSP handle the exception error. for instance:
    Example 1:
    public Vector getData()
    {  if (rs == null)
    return null ;
    Vector rows = new Vector() ;
    try {
    boolean morerecords = rs.next() ;
    if (morerecords)
    do {
    rows.addElement(getNextRow()) ;
    while(rs.next()) ;
    catch(SQLException sqlex)
    {  System.out.println("Get data failed") ;
    rows = null ;
    return rows ;
    Example 2
    public Vector getData()
    {  if (rs == null)
    return null ;
    Vector rows = new Vector() ;
    try {
    boolean morerecords = rs.next() ;
    if (morerecords)
    do {
    rows.addElement(getNextRow()) ;
    while(rs.next()) ;
    catch(Exception e){}
    return rows ;
    My question are:
    1.) For the second example, does the getData return the rows if there has error occured???
    2.) Will the program continue be executing if there has error occur??

    My answers are:
    1. The method will return something. It is possible that it will be bad data.
    2. Yes, the execution will be continued after a CATCHED exception.
    All Exceptions are Throwables.
    There are more types of Throwables:
    -Thhrowable
    --Error
    ---<errors>
    --Exception
    ---RuntimeException
    ---<other exceptions>
    --<other throwables>
    An Error is created when we try to make an intance of an abstract class or interface, or when we try to access a class, which is unaccessable (deleted, etc.), and so on.
    An Exception is created by a method, if an error occured, for example:
    double Divide(double a, double b) throws Exception {
    if (b == 0) throw new Exception("DIVIDE BY ZERO!!!");
    reurn a / b;
    void callDivide {
    double x;
    try {
    x = Divide(16, 0);
    } catch (Exception ex) {
    System.out.println("Divide by zero error.");
    System.out.println("Cats eat mice.");
    This program will print the message
    "Divide by zero error.
    Cats eat mice."
    If we skip the try/catch block, the compiler will print an error message, and no CLASS file will be created.
    BUT if we use a RuntimeException, and we skip the try/catch block, the compiler will create a CLASS file, and it will print an error message and the call stack.
    So, we don't need to catch RuntimeExceptions.
    If there is a method that calls callDivide(), and callDivide doesn't catch RuntimeException but that method does, the execution will be continued, but the "Cats eat mice" sentence will not be printed.

  • Catching exceptions

    Maybe a stupid question but is there any common practice when it comes to handling exceptions in Java? Should I declare throws for the whole method or should I use a try-catch construction? I can see the advantage of passing exception to the calling methods but this means that many methods must be throwables or catch the exceptions so it's kind of a circle of exceptions...
    /P

    You usually don't want to do
    catch (Exception e) {}
    Somewhat less onerous is
    catch (Exception e) { //handle it }
    Normally what you'd do is define your own exception classes that extend Exception. A common approach is to use a package-based hierarchy, with specific exceptions for specific types of errors.
    // package com.mycompany.dbstuff might have these
    public class DatabaseException extends Exception { /*...*/}
    public class NoSuchTableException extends DatabaseException { /*...*/ }
    public class  LoginFailedException extends DatabaseException { /*...*/}
    // package com.mycompany.accountmanagement package may have these
    public class AccountException extends Exception {/*...*/}
    public class IllegalAccountNumberExceptoin extends AccountException {/*...*/}
    // etc.Each exception simply has constructors that call super(same args), and possibly the ability to take another Throwable as a constructor arg, which is then mapped to a member variable so you can later call getCause() or getWrappedException to see which exception led to this one.
    At any given layer, you catch exception thrown by the layers it uses, and wrap them in an exception for your current layer.
    // in the AccountClass
    public AccountInfo getAccountInfo(int acctId) throws AccountException {
        if (acctId < 0) {
            throw new IllegalAccountNumberException("No negative account numbers");
        try {
            database.login(uname, passwd);
            databse.getAccountInfo(acctId);
        catch (DatabaseException exc) {
            exc.printStackTrace();
            throw new AccountException(exc);
    }This way, the user of the accountmanagement package doesn't need to know what database package accountmanagement uses. If I call an accountmanagement method, I only have to deal with an account relatd exception. If it's IllegalAccountNumber, I can prompt the user to reenter the acct number. If it's other, I can say "Couldn't retrieve account info, please try again" or some such thing.
    And yes, I know, if the login failed, you'd want to propagate that, so the user could reenter the password. I'd make a separate AccountLoginFailedException and wrap that around the DBLoginFailed, because the user of the Account class is trying to access the account, not the database.
    Also, you often do want to print stack traces. Not in your user's face--off in a log file somehwere. If you've got exceptions that are ocurring for reasons other than user typos, you want to record as much info as you can about them.

  • Catch exception inside function arguments

    Class A is a core class in my application. When users create it with bad name format, they get an exception.
    public class A{
        public A(String name) throws FormatException{
            // Check if the name the user entered is valid or not.
    }But during the startup of my application I also create some instances of A. At startup time, any exception caught means that my source code is wrong: a bug on my own!
    In this context I got myself with the following problem, how to catch an exception (that should not happen, because it comes from inside my source code) inside a function call:
        // Create an instance of B that wraps A.
        B b = B( new A("a_name_in_a_good_format") , some_other_parameter); // Possible exception from the constructor of A.Is there any way to catch that, or I'm obliged to create the instance of A before calling any function?
    Edited by: ffrantz on Apr 1, 2010 10:15 AM
    Edited by: ffrantz on Apr 1, 2010 10:17 AM

    Thanks. I guess that is the only solution.
    My problem is that I'm using that in the initialization of an enum, and there's no way to put that construction inside a try/catch block. Code looks like.
    public static enum myReferenceInstancesToClone {
        SIGNAL_MAGNITUDE(new C("mag"), some_other_parameters), // C extends A
        SIGNAL_FREQUENCY(new D("freq"), some_other_parameters), // D extends A
        RESISTIVITY     (new A("R")), some_other_parameters),
        INDUCTANCE      (new A("L") , some_other_parameters),
        CAPACITANCE     (new A("C"), some_other_parameters);
        // FIELDS
        private A _referenceInstance;
        private Object[] _refParameters; // A set of private fields that interest me
        // METHODS
        private OutputPropertiesA property, Object[] some_other_parameters){
         _value = property;
            _refParameters = some_other_parameters
        // Other methods that are convenient to get fields.I'm doing it that way because i'm designing the data model for our application and it is uncertain what is the number and nature of properties that we will need to use. This construction with enums seemed good for me because:
    1) Other designers can add properties in a single line. Without looking around on the rest of the source code.
    2) The initialization process keeps probing the same enumeration, independent on the number/nature of the elements contained in it.
    It is in this context that I cannot catch the exception thrown by the constructor of A:
    public static enum myReferenceInstancesToClone {
        SIGNAL_MAGNITUDE(new C("mag"), some_other_parameters), // Java compiler tells me I have an unhandled exception from 'new C()'
        // ...If there is no way to catch that exception or propagate it.. then I'll do it with static arrays and static initialization blocks... but this means that I'll have to break my 'some_other_parameters' in different arrays.

  • How to catch exception into a String variable ?

    I have a code
    catch(Exception e)
                e.printStackTrace();
                logger.error("\n Exception in method Process"+e.getMessage());
            }when i open log i find
    Exception in method Process null.
    But i get a long error message in the server console !! I think thats coming from e.printStackTrace().
    can i get the error message from e.printStackTrace() into a String variable ?
    I want the first line of that big stacktrace in a String variable.
    How ?

    A trick is to issue e.printStackTrace() against a memory-based output object.
    void      printStackTrace(PrintStream s)
             // Prints this throwable and its backtrace to the specified print stream.
    void      printStackTrace(PrintWriter s)
    //          Prints this throwable and its backtrace to the specified print writer.Edited by: BIJ001 on Oct 5, 2007 8:54 AM

  • How to catch exception while validating the username and password in hbm

    Hi,
    I do want to set the username and password dynamically in hibernate.cfg.xml
    Here below is my configuration file.
    {code<hibernate-configuration> 
    <session-factory> 
           <property name="hibernate.bytecode.use_reflection_optimizer">false</property> 
           <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> 
           <property name="hibernate.connection.pool_size">10</property> 
           <property name="show_sql">true</property> 
           <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property> 
           <property name="hibernate.hbm2ddl.auto">update</property> 
           <property name="current_session_context_class">thread</property> 
           <property name="show_sql">true</property> 
         </session-factory> 
    </hibernate-configuration>{code}
    Also im getting that session factory object like the below code.
    public class Sessions {        private static SessionFactory sessionFactory;      private static Configuration configuration = new Configuration();        static {          try {              String userName = GuigenserviceImpl.userName;              String password = GuigenserviceImpl.password;              String hostName = GuigenserviceImpl.hostName;              String portNo = GuigenserviceImpl.portNo;              String sId = GuigenserviceImpl.sId;                  configuration                      .setProperty("hibernate.connection.username", userName);              configuration                      .setProperty("hibernate.connection.password", password);              configuration.setProperty("hibernate.connection.url",                      "jdbc:oracle:thin:@" + hostName + ":" + portNo + ":" + sId);                try {              configuration.configure("/hibernate.cfg.xml");              sessionFactory = configuration.buildSessionFactory();              GuigenserviceImpl.strAccpted = "true";              }              catch (Exception e) {                    e.printStackTrace();                  GuigenserviceImpl.strAccpted = "false";              }            }          catch (HibernateException hibernateException) {              GuigenserviceImpl.strAccpted = "false";              hibernateException.printStackTrace();          }          catch (Throwable ex) {                GuigenserviceImpl.strAccpted = "false";              ex.printStackTrace();              throw new ExceptionInInitializerError(ex);          }      }          public static SessionFactory getSessionFactory() {          return sessionFactory;      } 
    So, in this above scenario, suppose if im giving the wrong password means exception should be caught and the string variable "GuigenserviceImpl.strAccpted" should be assigned to false.
    But im getting the SQL Exception only in console like wrong username and password. And finally i couldn't able to catch the exception in Sessions class, static block.
    Anyone can help me in catching that SQL Exception in my Sessions class and i need to handle that SQL Exception in my class.
    Im getting this following exception message in my console.
      INFO: configuring from resource: /hibernate.cfg.xml  Apr 6, 2009 2:47:00 PM org.hibernate.cfg.Configuration getConfigurationInputStream  INFO: Configuration resource: /hibernate.cfg.xml  Apr 6, 2009 2:47:00 PM org.hibernate.cfg.Configuration doConfigure  INFO: Configured SessionFactory: null  Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure  INFO: Using Hibernate built-in connection pool (not for production use!)  Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure  INFO: Hibernate connection pool size: 10  Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure  INFO: autocommit mode: false  Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure  INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@192.168.1.12:1521:orcl  Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure  INFO: connection properties: {user=scott, password=****}  Apr 6, 2009 2:47:01 PM org.hibernate.cfg.SettingsFactory buildSettings  WARNING: Could not obtain connection metadata  java.sql.SQLException: ORA-01017: invalid username/password; logon denied        at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)      at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204)      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:406)      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)      at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:799)      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:368)      at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)      at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)      at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)      at java.sql.DriverManager.getConnection(DriverManager.java:525)      at java.sql.DriverManager.getConnection(DriverManager.java:140)      at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)      at com.beyon.ezygui.server.Sessions.<clinit>(Sessions.java:39)      at com.beyon.ezygui.server.GuigenserviceImpl.testRPC(GuigenserviceImpl.java:322)      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    Thanks in advance.
    Thanks & Regards,
    Kothandaraman N.

    Hi,
    Myself hardcoded that username and password checking like the below code.
    String name = loginData.get("userName").toString();
              String pswd = loginData.get("pswd").toString();
              String hstName = loginData.get("hName").toString();
              String prtNo = loginData.get("portNo").toString();
              String sid = loginData.get("sId").toString();
              SessionFactory sessionFactory = null;
              try {
                   if (name.trim().equals(userName) && pswd.trim().equals(password)
                             && hstName.trim().equals(hostName)
                             && prtNo.trim().equals(portNo) && sid.trim().equals(sId)) {
                        sessionFactory = Sessions.getSessionFactory();
                        strAccpted = "true";
                   } else {
                        strAccpted = "false";
              } catch (Exception e) {
                   e.printStackTrace();
                   strAccpted = "false";
              }I have my own values in string objects, then comparing that values with the values from login form. If both values are matching, then i will do configurations in hibernate.
    ResourceBundle resourceBundle = ResourceBundle
                   .getBundle("com.beyon.ezygui.server.Queries");
         public static final String connection_url = resourceBundle
                   .getString("connection.url");
         public static final String userName = resourceBundle.getString("userName");
         public static final String password = resourceBundle.getString("password");
         public static final String hostName = resourceBundle.getString("hostName");
         public static final String portNo = resourceBundle.getString("portNo");
         public static final String sId = resourceBundle.getString("sId");The above are the String objects i'm checking for the match with values from login form.
    Thanks & Regards,
    Kothandaraman N.

  • How to catch exception of JMS when call onMessage()?

    I write a consumer client implement onMessage(),
    in my main() method ...
    try {
    _adapter = new Adapter(checkConsumer,env);
    _adapter.setSelector("client = 'Receive1'");
    _adapter.start();
    System.out.println("Hello...");
    } catch(Exception e) {
    _adapter = null;
    System.out.println("Unable to start adapter: " + e.getMessage());
    _adapter.start() will call onMessage() my onMessage like this
    public void onMessage(Adapter adpt, Message message) {
    try {
    if(message instanceof TextMessage) {
    // Write the text out as read String text = ((TextMessage)message).getText();
    // Do CHECK Process adpt.demoOut("Receive CHECK Text is :" + text);
    //System.out.println("class name is " + consumerName);
    } else {
    // This is just a message (no particular type) } } catch (Exception e) {
    try {
    adpt.warn("Error outputing data: " + message.getJMSMessageID());
    } catch(Exception ignore) {
    } adpt.warn("\tError: " + e.getMessage());
    // Do some exception process }
    If the JMS Server shutdown, how can I catch the exception?

    You might want to try with exception listener that JMS specification provides.

  • How to catch exception when have max connection pool

    hi,
    i have define in oracle user that i could have max 10 sessions at the same time.
    I have jdbc datasource & connection pool defined at glassfish server(JSF application).
    now, if in application is too many queries to the database then i have error: nullpointer exception - becouse when i try to do:
    con = Database.createConnection(); - it generates nullpointer exception becouse there isn't free connection pool
    i try to catch exception like this:
    public List getrep_dws_wnioski_wstrzymane_graph() {     int i = 0;     try {     con = Database.createConnection();     ps =    (Statement) con.createStatement();     rs = ps.executeQuery("select data, klasa, ile_dni_wstrzymana, ile_wnioskow from stg1230.dwsww_wstrzymane_dws8 order by data, klasa, ile_dni_wstrzymana, ile_wnioskow");     while(rs.next()){       rep_dws_wnioski_wstrzymane_graph.add(i,new get_rep_dws_wnioski_wstrzymane_graph(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4)));       i++;     }     } catch (NamingException e) {         e.printStackTrace();     } catch (SQLException e) {         e.printStackTrace();     } catch (NullPointerException e) {         e.printStackTrace();         throw new NoConnectionException();  // catch null 1     } finally {     try {         con.close();     } catch (SQLException e) {         e.printStackTrace();     } catch (NullPointerException e) {         e.printStackTrace();         throw new NoConnectionException();  // catch null 2     }     } return rep_dws_wnioski_wstrzymane_graph; }
    but at line:
    con.close();
    i have nullpointerexception
    and
    at line
    throw new NoConnectionException(); // catch null 2
    i have: caused by exception.NoConnectionException
    what's wrong with my exception class? how to resolve it?
    public class NoConnectionException extends RuntimeException{     public NoConnectionException(String msg, Throwable cause){       super(msg, cause);     }     public NoConnectionException(){       super();     } }
    at web.xml i have defined:
    <error-page>         <exception-type>exception.NoConnectionException</exception-type>         <location>/NoConnectionExceptionPage.jsp</location>     </error-page>

    thanks,
    i did it and i have error:
    java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit
    at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
    at logic.Database.createConnection(Database.java:37): conn = ds.getConnection();
    public class Database {
         public static Connection createConnection() throws NamingException,
                    SQLException {
                Connection conn = null;
                try{
                    Context ctx = new InitialContext();
              if (ctx == null) {
                   throw new NamingException("No initial context");
              DataSource ds = (DataSource) ctx.lookup("jdbc/OracleReports");
              if (ds == null) {
                   throw new NamingException("No data source");
              conn = ds.getConnection();  // here's exception when max connections to database
              if (conn == null) {
                   throw new SQLException("No database connection");
                } catch (NamingException e) {
                    e.printStackTrace();
                    throw new NoConnectionException(); 
             } catch (SQLException e) {
                 e.printStackTrace();
                    throw new NoConnectionException(); 
                catch (NullPointerException e) {
                 e.printStackTrace();
                    throw new NoConnectionException();  // obsluga bledy na wypadek jesli braknie wolnych polaczen do bazy
            return conn;
    }and at my ealier code i have error:
    at logic.GetDataOracle.getrep_dws_wnioski_wstrzymane_graph(GetDataOracle.java:192)
    at line: con = Database.createConnection();
    in code:
    public List getrep_dws_wnioski_wstrzymane_graph() {
        int i = 0;
        try {
        con = Database.createConnection();
        ps =    (Statement) con.createStatement();
        rs = ps.executeQuery("select data, klasa, ile_dni_wstrzymana, ile_wnioskow from stg1230.dwsww_wstrzymane_dws8 order by data, klasa, ile_dni_wstrzymana, ile_wnioskow");
        while(rs.next()){
          rep_dws_wnioski_wstrzymane_graph.add(i,new get_rep_dws_wnioski_wstrzymane_graph(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4)));
          i++;
        } catch (NamingException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
            throw new NoConnectionException();
        } finally {
        try {
            if(con != null)
            con.close();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
            throw new NoConnectionException(); 
    return rep_dws_wnioski_wstrzymane_graph;
    }so what's wrong?
    i have limit max sessions 10 at oracle so i set at my connection pool 5 connections as max. But when i get max 5 sesssins and try to execute next query then i can't catch exception..

Maybe you are looking for

  • Can not view all the thumbnails in version 9 adobe standard

    Hello, I recently installed adobe standard 9 running parallel with adobe standard 5. My end user is claiming of the view setting for patient data. She can not scroll all the way to the bottom as she could in adobe 5. She can see all the thumbnails mi

  • All songs erased from ipod and itunes

    I'm trying to help a friend and learn in the process. When he turned on his ipod all the songs were gone and when itunes was opened to see about putting the 3000+ songs back on to the ipod the library had disappeared as well. He said he hadn't done a

  • Can I create an email form that includes a field for uploading and image?

    I'd like to create an email form in Muse that allows people to submit the usual text but also allows them to browse for and upload an image that would be emailed (attached or inline) to me along with the text. Does anyone know if there's a way to do

  • Byte array in JSON reply

    Hi guys, I'm exchanging some data between .net webservice and flex with JSON. This is a JSON reply: <string> {"uid":"23","photos":[[255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,72,0,72,0,0,255,219,0,67 ,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12,20 </string> It

  • Set One Display as 'Default' on Startup?

    I have a Mac Pro 2.66 GHz Dual-Core that I have connected primarily to one external display (22" LCD monitor by Insignia) and two LCD projectors. The projectors are not always plugged in, because the primary use of this computer is in the tech booth