Catch exception, but continue try{ ?

I have a http timeout error that is handled by a printing of the stack trace, but how do I continue it so the while loop still continues?
try {
while(rs.next()) {
httpConection.setConnectTimeout(15000);
httpConnection.connect();
    }//end while loop
      con.close();
     catch(Exception e)
     continue; // <--- Won't let me do this, since it is not in a loop
     }//end catch
    thanks in advance

        public static void main(String[] args) {
     try {
      Statement stmt;
      ResultSet rs;
      Class.forName("com.mysql.jdbc.Driver");
      System.out.println("URL: " + url);
      System.out.println("Connection: " + con);
      stmt = con.createStatement();
      stmt = con.createStatement(
               ResultSet.TYPE_SCROLL_INSENSITIVE,
                     ResultSet.CONCUR_READ_ONLY);
      while(rs.next()){
        int theInt= rs.getInt("id");
        String URLs = rs.getString("url");
        String urlString = URLs;
              URL httpurl = new URL(urlString);
            URLConnection connection =
            httpurl.openConnection();
            if (connection instanceof HttpURLConnection) {
                HttpURLConnection httpConnection =
                 (HttpURLConnection)connection;
                 httpConnection.setConnectTimeout(15000);
                 httpConnection.connect();
              } // End IF
             // Continue
      // End If(connection instanceof)...
      } // End While
      con.close();
     } // End TRY
    catch(Exception e) { }
        }Thats how I have the exception now.. If i try anything else it says need catch or finally for try?

Similar Messages

  • Catch exception and continue the execution

    Hi Team,
    I require the action(such as insert/Update/Delete) for each row of table/table variable and also Error/Exception details as new column if occured any.
    Please refer below sample input and output.
    i was using merge, when exception occurs it fails to fit my requirement.
    My input data will be huge(such as 10k-15k), please suggest me optimized way to achieve this
    Kindly assist me.
    Thanks

    Hi,
    1. We don't know what make wrong and what exception occurs! We only have a nice story here :-)
    2. We don't have any information about your DDL and/or your source data an destination table, therefor we cant tell you  what is the best option.
    3. For 10-15K records doing a loop as suggested can be slow (for a 1000k it will be take for ever). It is highly faster most of the time for a big SET of data to use 3 queries (if MERGE is not an optioned), one for each operation (insert,update,delete),
     and to work with bulk insert! In this case the only heavy operation will be the fact that you need to use 3 time filtering but if your index fit the query this might be the best solution sometimes (again if merge is not an option). If the data come from
    external Data as CSV for example, then You can split the data into 3 sources before the queries, using 1 query or a small shell script prepering 3 sources. There can be several option fit your needs and uses which might fit better, but ont go to fast to work
    with looping record by record. try to thing of working with SETs of data.
    As mentioned, please post more information, In order to get the best solution for your specific case
    [Personal Site] [Blog] [Facebook]

  • Exception handling with try/catch in acrobat

    Hi
    I have a problem using a try/catch block in my acrobat document-script. Try to enter the following into the debugger-console:
    try{nonexistentFunction();}catch(e){console.println('\nacrobat can't catch')}
    and run it. The output will be:
    nonexistentFunction is not defined
    1:Console:Exec
    acrobat can't catch
    true
    The whole point of a rty/catch block is for the application  NOT to throw an exception, but instead execute the catch-part of the  statement. However, acrobat does both: It throws an exception AND  executes the catch-block.
    Is there another way to suppress the exception, or to make the try/catch-block work as it's supposed to?

    > Also Adobe provides for free the JS or compiled file for Acrobat Reader to support the JS console.
    Where is that file located ? How to install it or where to place it ?
    What is the method referred by try67 on his site where he sells a product ?
    Is that the same as the compiled file you refer to ? or did he sell his solution to adobe ?
    It is helpful if people can get an idea of the nature of choices available and make informed decisions, than a cloak and dagger approach.
    For some jobs that we have, I have been very frustrated by a consultant who wont even give basic info for transparent billing despite all assurances for privacy, as a result we are forced to do the job ourselves.
    Dying Vet

  • Catch Exception shape - working in inner loop but not in outer loop

    Hello,
    I'm trying to use the catch exception shape for the first time.  My orchestration has 3 loops.  I'll call them loop1, loop2, loop3 where loop3 is my inner most loop.  I'm able to catch the exact same error on the inner most loop3 but the outer
    loop2 doesn't catch it and just puts a warning in the event viewer ( have no catch or scope on loop1 yet). 
    I can't figure out what the difference is.  
    The one that is not caught just has the dehydrated message and orchestration saying it will try again.  then 5 mins later it does log an error and terminates but my catch is still not catching it.
    Below in bold is the 'uncaught' warning message and the caught error message respectively.  They look exactly the same to me, so why would the inner be caught but outer NOT caught?  they're both catching the same type which is System.SystemException.
     I couldn't get either to catch a System.FormatException but that's a different issue I'll solve later.
    this is the warning from the UNCAUGHT error:
    The adapter failed to transmit message going to send port "WcfSendPort_SqlAdapterBinding_TypedProcedures_dbo_uspEncounterAdd" with URL "mssql://sqldev1//AllianceDB?InboundId=uspEncounterAdd". It will be retransmitted after the retry interval
    specified for this Send Port. 
    Details:"Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The input data for the field/parameter "sTransactionId" is invalid according to the expected SqlDbType BigInt. ---> System.FormatException: Input string was
    not in a correct format.
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
       at System.Int64.Parse(String s, NumberStyles style, IFormatProvider provider)
       at Microsoft.Adapters.Sql.MetadataHelper.ConvertXmlValueToDotNetObject(String xmlString, String fieldParameterName, SqlDbType sqlDbType, Int32 maxLength, Int32 precision)
       --- End of inner exception stack trace ---
    Server stack trace: 
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".
    This is the error message that I'm writing to the event viewer when CATCHING the error in loop3:
    Error from ScopeGetEncounterResponse: message = An error occurred while processing the message, refer to the details section for more information 
    Message ID: {1781C639-DB28-4306-B701-783E069A0403}
    Instance ID: {8E1084F2-00EE-43B2-A112-BF80702A167A}
    Error Description: Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The input data for the field/parameter "sRefID" is invalid according to the expected SqlDbType BigInt. ---> System.FormatException: Input string was not
    in a correct format.
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
       at System.Int64.Parse(String s, NumberStyles style, IFormatProvider provider)
       at Microsoft.Adapters.Sql.MetadataHelper.ConvertXmlValueToDotNetObject(String xmlString, String fieldParameterName, SqlDbType sqlDbType, Int32 maxLength, Int32 precision)
       --- End of inner exception stack trace ---
    Server stack trace: 
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)
    Thank you so much for your excellent advice!
    Jean Stiles
    jRenae.s

    It turns out that my outer loop2 was catching the error.  It was just retrying 3 times before it would catch it (I forgot that I had set the retry count to 0 on the loop3 inner port).  I was so impatient that I was stopping my orchestration
    before it was actually catching it!
    jRenae.s
    HI jRenae.s,
    Congratulations! I’m glad to hear that you have solved this issue by yourself, and it is very appreciated to share your solution to us. It will be helpful for others, and welcome to post your question on this forum.
    Best regards
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Catch a JBO-26041 error on insert, but continue processing

    re-post:
    Does anyone know if this is possible?
    I'm creating new rows in a ViewObject within a loop. It's possible that the record that I'm trying to create already exists, so I want to catch a JBO-26041 error and basically ignore it (don't insert/create new row) and continue processing/creating rows within the loop. Committing at the end of the loop.
    Is this possible?
    Thanks!
    -Teri Kemple
    I've tried the following:
    for (int i = 1; i < objectIdList.length; i++) {
    try {
    row = vo.createRow();
    row.setAttribute("ScreenObjectId", objectIdList);
    row.setAttribute("AccessId", accessId);
    am.getTransaction().postChanges();
    } catch (JboException je) {
    if ("26041".equals(je.getErrorCode)))) {
    // ignore error, don't insert
    ????? what can I do here?
    } /// for loop
    if (am.getTransaction().isDirty()) {
    am.getTransaction().commit();

    Teri:
    This looks like a duplicate thread. Please refer to
    Catch a JBO-26041 error on insert, but continue processing
    Thanks.
    Sung

  • Try catch exception handling

    Hi there,
    Was wondering if you could assist in me getting my head around try catch exception handling? I have this code:
    JOptionPane.showMessageDialog(null, "A subject consists of term names and definitions.\nYou should indicate the size and name of the subject");
             inputSubName = JOptionPane.showInputDialog(null, "Enter the Subject Name:");
             inputSubSize = JOptionPane.showInputDialog(null, "Enter the Subject's Term Size:");
             try {
                  size = Integer.parseInt(inputSubSize);
                  catch (NumberFormatException e) {
                            JOptionPane.showMessageDialog(null, "'" + inputSubSize + " is invalid " + " Please enter digits only");
                            inputSubSize = JOptionPane.showInputDialog(null, "Enter the Subject's Term Size:");
                            size = Integer.parseInt(inputSubSize);
             //create a new Subject object and pass in its name and size
             Subject sub = new Subject(inputSubName, size);
    ...My query is, if I catch an exception, how do I get the code to repeat the try again until the user inputs a correct data type? If the user above inputs something other than a number, it will catch it once and repeat the joptionpane inputbox, but if they do the same thing twice round - then the program bombs out. Is there a way i can get the code to retry the try until they input correctly?
    Cheers.

    eg.
    int size = 0;          
    while (true) {
         try {
              size = Integer.parseInt(inputSubSize);
              break;
         catch (NumberFormatException e) {
              JOptionPane.showMessageDialog(null, "'" + inputSubSize
                        + " is invalid " + " Please enter digits only");
              inputSubSize = JOptionPane.showInputDialog(null,
                        "Enter the Subject's Term Size:");
    }

  • OutOfMemory Exceptions on Servlets, Try-Catch unable to help

    Hi, I'm playing with Java servlets right now and I seem to be getting some OutOfMemory errors. The weird thing is that even though I had identify the souce of error and tried to enclose it with a try-catch, the exception still occurs. Why is that so?

    OutOfMemoryError is actually a java.lang.Error, not a RuntimeException. So if you use a try/catch like this
    try {
      // stuff
    } catch (Exception e) {..}Errors will fall through, since Error is not a subtype of Exception. (Check the API.)
    You can catch it by catching Error or Throwable, like this:
    try {
      // stuff
    } catch (Error e) { //  this is rarely a good idea
    }But you normally wouldn't want to do this. When there's no memory left, there's not a whole lot you can do about it, and most of the code you might want to put inside the catch block will merely throw another OutOfMemoryError.
    As voronetskyy said, you're either creating too many (or too large) objects (typically in an endless loop), or you have specified too little memory for your application.

  • I just downloaded ilife every things working fine except, when i try to open iPhoto it said ''You can't open the application iPhoto because it may be damaged or incomplete. i tried to re-download it but my password didn't work for some reason. HELPPPP!!!

    i just downloaded ilife every things working fine except, when i try to open iPhoto it said ''You can't open the application iPhoto because it may be damaged or incomplete. i tried to re-download it but my password didn't work for some reason. HELPPPP!!!

    Make a temporary, backup copy (if you don't already have a backup copy) of the library and apply the two fixes below in order as needed:
    Fix #1
    Launch iPhoto with the Command+Option keys held down and rebuild the library.
    Select the options identified in the screenshot. 
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    Download iPhoto Library Manager and launch.
    Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
    Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option
    In the next  window name the new library and select the location you want it to be placed.
    Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    Happy New Year

  • Doubt on try/catch exception object

    why it is not advisable to catch type exception in try catch block. Its confusing me. If i catch exception object then it will show whatever exception occured.
    btw, i was just go through duke stars how it works and saw this
    http://developers.sun.com/forums/top_10.jsp
    Congrats!

    Because there are many different kinds of Exception. If you have some specific local strategy for dealing with a particular excepion then you should be using a specific catch block.
    If you don't then you should allow the expection to end the program, and ideally you should deal with all the expceptions in one top-level handler, so you should throw, rather than catch the exceptions in your methods. Often at the outer most level of the program or thread you will actually catch Throwable (not just Exception) to deal with any unanticipated problems in a general kind of way.
    Also, you should be keeping track of what exceptions might be thrown, so that rather than using Exception in a throws clause or catch block, you should use the particular exceptions. Exceptions, generally, indicate a recoverable error that you really ought to be recovering from rather than just printing a stacktrace.
    That's why exceptions are treated differently from runtime errors.

  • My apple tv works great except when I try to play a dvd on my macbook. have sound but no video.

    My apple tv and airplay works great except when I try to play a dvd on my macbook. Have sound but no video.

    You won't be able to view them via Apple TV, correct. It is not meant for this function, if that's your intended purpose its best to get a DVD player

  • HT1725 I try download movie from purchased items on itunes but continues to stop. A box pops up saying connection has been reset. How do I fix problem?

    I try download movie from purchased items on itunes but continues to stop. A box pops up saying connection has been reset. How do I fix problem?

    kapots3v4,
    if your MacBook Pro doesn’t stay active long enough to perform an OS X Internet Recovery, then you should make an appointment at your nearest Apple store or Apple-authorized service provider to have them diagnose what’s ailing it.

  • Try catch exceptions

    I got this:public void fileIO() {
            try {
                File file = new File("aNewFile.txt");
                System.out.println(file.exists());
            } catch (IOException ioe) {
                System.out.println("IOException");
        }which tells me : exception java.io.IOException is never thrown in body of corresponding try statement, if I change the catch to } catch (Exception ioe) {, the error goes away.
    My question is why is it giving the error and why is it not giving the error after changing the catch line ?

    Read the API!!!!!!!!!
    new File(String) may through a NullPointerException
    and
    file.exists() may through a SecurityException
    Neither of those are based on an IOException, hence the error message when you use IOException.
    All exceptions are based (somewhere down the line) on Exception, hence no error when you use Exception.

  • 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.

  • 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 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 URL opening by pasting on the web page be re-enabled in Firefox 5?

    Under Linux, in previous versions of Firefox (and Seamonkey, all the way back to Mozilla), I could open a URL by selecting the text in an xterm, then using the middle mouse button "paste" it anywhere in web page document window. That text would then

  • HD Movie / TV episode download issue / problem / difficulty

    The issue is that the download is extremely slow. I purchased both the HD and the SD versions of Lost - "the Final Journey" - (2.56 GB and 1.11 GB respectively), as they are free. The download was proceeding in parallel. While the SD episode was down

  • 3GS with ios 4 always lost wifi credentials

    Upgrading iPhone 3GS to ios 4 was hard (recovery mode, reinstall iTunes and AMDS, using two computers) but did it and got all information back. I've internet access in 3G and with wifi; however everytime i try to connect wifi i have to select the net

  • New DSL install for modem 12/31. Today my landline went dead (1/3/14)

    Hi, New DSL install  for modem only12/31.  Today my landline went dead after having a whistling noise. (1/3/14).  I've checked service box.  Exterior line is dead.  How can I notify service? Thanks, cnewton Richmond, VA, 23223

  • GB   Audiogram 6: multitrack problem

    I have a problem with my audiogram 6. I'm really new in home recording and I've always recorded one track per time (guitar first then the bass then drums then vocals). I read that GB allows you to record in multitrack...this is great to me but...I JU