Differentiating between same exception thrown from 2 different methods

Suppose I have a class CodeDAO which has 2 methods who both throw SQLException
public int getLocationCode(String locationName) throws SQLException;
public int getDepartmentCode(String departmentName) throws SQLException;Now I have a business method in which I have to use both of the above DAO methods.
public int process() {
   try {
      CodeDAO codeDAO = new CodeDAO();
      int locationCode = codeDAO.getLocationCode("NJ");
      int departmentCode = codeDAO.getDepartmentCode("Sales");
   catch (SQLException e) {
}If SQLException is thrown how will I know if it is thrown by the getLocationCode method or getDepartmentCode method?
What are the different choices I have in differentiating between same exception thrown from different methods? And which choice do you guys prefer?
Thanks

srhcan wrote:
maheshguruswamy wrote:
srhcan wrote:
gimbal2 wrote:
baftos wrote:
Put each method invokation in its own try/catch block.Or in fact not use SQLException, but exceptions that are unique.So each DAO method has its own exception?
public int getLocationCode(String locationName) throws GetLocationCodeException;
public int getDepartmentCode(String departmentName) throws GetDepartmentCodeException;would not that means I have to create a lot of exception classes?
Edited by: srhcan on Aug 9, 2012 2:54 PMLet me ask you this, what do you plan to do in the catch block? Do some sort of recovery? rollback? If it is just for logging purposes, I am pretty sure the exception message will give you enough information to find out where the error was.* I would like to give user a specific message based on which method fails. So if getLocationCode("NJ") fails the message can be: Unable to find code for Location "NJ". And if getDepartmentCode("Sales") fails the message can be: Unable to find code for Department "Sales".
* I would like to print the exception's stacktrace in the log file.
* I may do a rollback depending on if its an INSERT/UPDATE/DELETE statement.Well, in that case why not log it in the DAO methods themselves...inside getLocationCode and getDepartmentCode. Instead of trying to do the recovery/logging in the process method, do it in the individual dao methods. The calling classes should not be responsible for logging/recovery etc. It should be done in the DAO classes themselves and the DAO method should return an appropriate message/code to the consumer tier classes indicating the status of the transaction. Just my 0.02$.

Similar Messages

  • Help Me, How to catch exception thrown from ejbStore

    Hi,
    I am working on application running on Iplanet Application Server 4.0. Problem is the application exception thrown from the ejbStore don't reach the calling servlet, calling servlet receive TransactionRollback exception which is system exception. But there is no sign of my application exception thrown from ejbStore. Can anybody tell me how I can get my ApplicationException thrown from ejbStore in my calling servlet.
    I am calling entity beans set method in servlet and in entity bean ejbStore method I am throwing Application exception.
    in entity bean
    public void ejbStore() throws MyException
    if(true) throw new MyException();
    in servlet
    try {
    MyEntityHome home = .......
    MyEntityRemote remote = home.findBy.....
    remote.setMyValue(MyValue value); //Transaction required Container managed
    }catch(MyException e) {
    e.printStackTrace(); // Not cahcing My Exception
    }catch(Exception e) {
    e.printStackTrace(); //catching TransactionRolledBackException
    Thanks
    Shakti

    Hi Ravi
                                    Try this
                                                try
                    Object retMsgs = output.get(bapiretrunmsgobject);
                      if(result != null )
    IrecordSet rmsg = (IrecordSet) result
                   catch(Exception ex)
                        printException(ex, "Error getting function result");
    Lemme know for any further questions.
    Regards
    Praveen

  • Exception thrown from servlet function

    Hi,
    I have a servlet "main.java" which connects to a database and displays a table. The table contains a check box in front of each table row. It has three buttons at the bottom "add" modify" "delete". When the user clicks on some check boxes and clicks on "delete" button how can i know in the script delete.java that these are the check boxes that have been checked or selected. I tried to do in the following way
                           String[] checkedBoxes = new String[100];
                           checkedBoxes = req.getParameterValues("sel");where sel is the name of the checkboxes
    but I am getting the following error:
    [21/Aug/2001:10:36:54] failure ( 1118): Internal error: exception thrown from the servlet service function (uri=/servlet/delete.class):java.lang.NullPointerException, Stack: java.lang.NullPointerException
    Any help would be appreciated.
    Thanks

    Does every checkbox have the same name, i.e. "sel".
    In this case you're dealing with a checkbox group. Similar to a select-style dropdown or radio button group.
    I know I've had problems with dropdowns in Netscape where the select parameter was not being passed at all, so I'd get null values. I got around this by having the form submission re-assign the value from the select list to a hidden variable and then getting the value from the request.getParameter("hiddenFieldName") instead of the "dropdownFieldName".
    You could try to name each checkbox individually using an appended ID, such as sel1, sel2, etc. and then have these parameters picked up using a loop construct, request.getParameter("sel" + i) -- you may want to pass some value back that would also indicate how many total checkboxes you had so you could determine how many iterations of the loop to go through.
    On the form side, you could probably set the checkboxes up using a similar looping mechanism so that you wouldn't have to explicitly write each checkbox name.
    If this is in fact similar to the Netscape issue I was having with dropdowns, I'd be interested to hear if it'll work in IE.
    I got a bit off-topic, but hope it helps.

  • ERROR: ProviderCaller.run(): exception thrown from IMChannel

    Not sure whether this is better addressed here or in the Instant Messaging forum.
    Basically we're having a problem with the presence service in Portal Server, and it throws a huge exception stack when you do anything except have a blank contact list with noone logged in.
    Portal Server, Access Manager, and IM Server are all installed on the same server in this configuration, and I've tried applying patches to the IM Server APIs to fix the problems to no avail.
    JES 2005Q1
    IM Server patched: 118787-01 118790-01
    Portal server unpatched
    Basically all of this is still a default install, with only minimal customization so customers don't have to configure anything.
    tail -f /var/opt/SUNWam/debug/desktop.debug says:
    07:34:25,192 INFO xmppd [com.sun.im.service.util.Worker 4] Authenticating using Identity Server SSO
    06/20/2005 07:34:25:310 AM PDT: Thread[Thread-677,5,main]
    ERROR: ProviderCaller.run(): exception thrown from IMChannel
    com.sun.portal.providers.ProviderException: JSPProvider.processJSPFile(): jsp=IMContent.jsp, java.lang.NoSuchMethodError: org.jaxen.BaseXPath.<init>(Ljava/lang/String;Lorg/jaxen/Navigator;)V
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:916)
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:810)
    at com.sun.portal.providers.jsp.JSPProvider.getContent(JSPProvider.java:579)
    at com.sun.im.portal.provider.IMProvider.getContent(IMProvider.java:94)
    at com.sun.portal.desktop.context.ReusableProviderCaller.run(ReusableProviderCaller.java:160)
    java.lang.NoSuchMethodError: org.jaxen.BaseXPath.<init>(Ljava/lang/String;Lorg/jaxen/Navigator;)V
    at net.outer_planes.jso.xpath.JSOXPath.<init>(JSOXPath.java:81)
    at net.outer_planes.jso.xpath.JSOXPath.<init>(JSOXPath.java:78)
    at net.outer_planes.jso.DataFactory.createXPath(DataFactory.java:128)
    at net.outer_planes.jso.DataFactory.createXPath(DataFactory.java:117)
    at net.outer_planes.jso.AbstractElement.getLocaleXPath(AbstractElement.java:175)
    at net.outer_planes.jso.AbstractElement.findElementsForLocale(AbstractElement.java:629)
    at net.outer_planes.jso.AbstractElement.findElementsForLocale(AbstractElement.java:626)
    at net.outer_planes.jso.PresencePacket.getStatus(PresencePacket.java:155)
    at net.outer_planes.jso.PresencePacket.getStatus(PresencePacket.java:152)
    at com.sun.im.service.xmpp.XMPPPresenceService.getPresence(XMPPPresenceService.java:374)
    at com.sun.im.service.xmpp.XMPPPresenceService.fetchPresence(XMPPPresenceService.java:164)
    at com.sun.im.service.xmpp.XMPPPresenceSession.fetch(XMPPPresenceSession.java:47)
    at com.sun.im.service.xmpp.XMPPPresenceSession.fetch(XMPPPresenceSession.java:55)
    at com.sun.im.portal.taglib.GetContactGroupTag.doStartTag(GetContactGroupTag.java:51)
    at jsps.etc._opt._SUNWps._desktop._sampleportal_en_US._IMChannel._html._IMContent_jsp._jspService(_IMContent_jsp.java:799)
    at com.sun.portal.providers.jsp.jasper3.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    at com.sun.portal.providers.jsp.JspServletWrapper.service(JspServletWrapper.java:182)
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:896)
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:810)
    at com.sun.portal.providers.jsp.JSPProvider.getContent(JSPProvider.java:579)
    at com.sun.im.portal.provider.IMProvider.getContent(IMProvider.java:94)
    at com.sun.portal.desktop.context.ReusableProviderCaller.run(ReusableProviderCaller.java:160)
    We're looking to implement JES in the next month or so. I've seen mention of this error with other jaxen flavors, but none mentioning the JES Instant Messaging or Portal Servers

    Does every checkbox have the same name, i.e. "sel".
    In this case you're dealing with a checkbox group. Similar to a select-style dropdown or radio button group.
    I know I've had problems with dropdowns in Netscape where the select parameter was not being passed at all, so I'd get null values. I got around this by having the form submission re-assign the value from the select list to a hidden variable and then getting the value from the request.getParameter("hiddenFieldName") instead of the "dropdownFieldName".
    You could try to name each checkbox individually using an appended ID, such as sel1, sel2, etc. and then have these parameters picked up using a loop construct, request.getParameter("sel" + i) -- you may want to pass some value back that would also indicate how many total checkboxes you had so you could determine how many iterations of the loop to go through.
    On the form side, you could probably set the checkboxes up using a similar looping mechanism so that you wouldn't have to explicitly write each checkbox name.
    If this is in fact similar to the Netscape issue I was having with dropdowns, I'd be interested to hear if it'll work in IE.
    I got a bit off-topic, but hope it helps.

  • Exception thrown from the servlet service function (uri=/servlet/auth)

    iam getting foll. error when i try logging in to iDA -
    [28/Mar/2005:15:39:38] failure (12538): Internal error: exception thrown from the servlet service function (uri=/servlet/auth): java.lang.NullPointerException, Stack: java.lang.NullPointerException
    at netscape.nda.servlet.NDAAuth.execute(NDAAuth.java:306)
    at netscape.nda.servlet.NDAServlet.doPost(NDAServlet.java:117)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897)
    at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:464)
    we're using iplanet messaging server 5.2 with iDA.
    we have two webservers one on each nodes where messaging services are running in cluster.
    the webmail is running fine.
    the webservers are running fine without errors.
    i tried shifting mesaging services on to both nodes, but the error persists.
    can any one pl. help me ??

    Hi,
    I hope below link will help you.
    http://knowledgebase.iplanet.com/ikb/kb/articles/4761.html
    Thanks,
    Daks.

  • Exception thrown from action: createLink

    Hi,
    I am trying to install Application server on Red Hat Enterprise Linux 4.
    I got the folowing error
    Starting install Install Phase 2 of component Oracle Client Required Support Files
    Calling Action unixActions10.1.0.4.0 createLink
    source = /u01/app/oracle/product/10.1.3.1/OracleAS_1/lib/libclntsh.so.10.1
    destination = /u01/app/oracle/product/10.1.3.1/OracleAS_1/lib/libclntsh.so
    overwriteExistingLink = true
    Exception thrown from action: createLink
    Exception Name: FileNotFoundException
    Exception String: File not found: %fileName%
    Kinldy let me know how to proceed.
    Regards,
    Anu

    This is a documented bug : 5029782.
    Take a look at this metalink note:
    Install of Oracle Database 10g Companion Products Fails With : File Not Found: %Filename%
         Doc ID:      Note:566889.1
    ~ Madrid
    http://hrivera99.blogspot.com

  • Internal error: exception thrown from the servlet service function

    when i invoke the servlet in unix iplanet server i got the error
    Kindly let me get the solution .i am in 11th hour.
    [06/Jan/2006:09:30:28] info (10646): Internal Info: loading servlet
    /servlet/Ipl
    XmlServlet
    [06/Jan/2006:09:30:28] info (10646): /servlet/IplXmlServlet: init
    [06/Jan/2006:09:30:28] failure (10646): Internal error: exception thrown
    from the servlet service function (uri=/servlet/IplXmlServlet/):
    java.lang.NullPointerException, stack: java.lang.NullPointerException
    at IplXmlReqHandler.generateRsp(IplXmlReqHandler.java:452)
    at IplXmlReqHandler.processRequest(IplXmlReqHandler.java:168)
    at IplXmlServlet.processRequest(IplXmlServlet.java:219)
    at IplXmlServlet.doGet(IplXmlServlet.java:184)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:701)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:826)
    at
    com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRun
    ner.java:513)
    Thanking you
    brindasanth

    you are in the wrong forum for this kind of question/product,
    goto:
    http://swforum.sun.com/jive/forum.jspa?forumID=16
    (in case you don't like "goto" - look at it like a "forward" :-) )
    additionally don't forget to mention
    - OS version
    - WebServer version + SP
    - .. the more the better
    rgds.
    /u

  • Internal error: exception thrown from the servlet service function (uri=/servlet/auth)

    I am getting the follow error in my webserver error log very offen. I am running iPlanet Delegated Administrator 4.5 and iPlanet WebServer 4.1 SP5. Sometimes I have to stop and start the web server because users can no longer authenticate to Delegated Admin. Does anyone know what this means.
    Internal error: exception thrown from the servlet service function (uri=/servlet/auth): javax.servlet.ServletException, Stack: javax.servlet.ServletException
    at netscape.nda.servlet.NDAAuth.execute(NDAAuth.java, Compiled Code)
    at netscape.nda.servlet.NDAServlet.doPost(NDAServlet.java, Compiled Code)
    at netscape.nda.servlet.NDAServlet.doGet(NDAServlet.java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
    at com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRunner.java, Compiled Code)"

    Hi,
    I hope below link will help you.
    http://knowledgebase.iplanet.com/ikb/kb/articles/4761.html
    Thanks,
    Daks.

  • Internal error: exception thrown from the servlet service function (uri=/login))

    I have done an install of iPlanet Portal Server on a Solaris 8 machine and when I try to access the main Page I get:
    [26/Apr/2002:16:15:27] failure (21872): Internal error: exception thrown from the servlet service function
    (uri=/login): java.lang.NullPointerException, stack: java.lang.NullPointerException
    at com.iplanet.portalserver.auth.service.AuthD.isClientDetectionEnabled(AuthD.java:520)
    at com.iplanet.portalserver.auth.service.AuthD.getClientType(AuthD.java:532)
    at com.iplanet.portalserver.auth.service.AuthRequest.<init>(AuthRequest.java:102)
    at com.iplanet.portalserver.auth.service.AuthRequest.getAuthRequest(AuthRequest.java:177)
    at com.iplanet.portalserver.auth.service.LoginServlet.doGetPost(Compiled Code)
    at com.iplanet.portalserver.auth.service.LoginServlet.doGet(LoginServlet.java:990)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:701)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:826)
    at com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:507)
    , root cause:
    Suggestions? I have sucessfully installed IPS before, but I cannot figure out the cause of this error.
    Mike

    Looks like a patch conflict ..
    Check /var/sadm/patch and see
    if this patch 108875-07 is present, if you have a later patch than that then you might run into the above problem ..

  • Strange exception thrown from Client (Scanner has tokens)

    Hi,
    I am getting a really strange exception thrown from my client. It seems to be
    about a class that the wsgen generated. Has anyone ever seen something like that
    before? Maybe it is because I am using JBuilder(5.1)? I am operating on a WL6.1
    server. It is only a test webservice. So there are only standard return types,
    etc.
    Any comments/suggestions are appreciated
    cheers Stephan
    Scanner has tokens:
         [OPENTAGBEGIN]
         [NAME]     (META)
         [NAME]     (NAME)
         [CHARDATA]     (GENERATOR)
         [NAME]     (CONTENT)
         [CHARDATA]     (WebLogic htmlKona WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
         [TAGEND]
         [SPACE]     (
         [CLOSETAGBEGIN]
         [NAME]     (HEAD)
         [TAGEND]
         [SPACE]     (
         [OPENTAGBEGIN]
         [NAME]     (BODY)
         [NAME]     (bgcolor)
         [CHARDATA]     (white)
         [NAME]     (alink)
         [CHARDATA]     (#397F70)
         [NAME]     (link)
         [CHARDATA]     (#640078)
         [NAME]     (vlink)
         [CHARDATA]     (#DE7E00)
         [TAGEND]
         [SPACE]     (
         [OPENTAGBEGIN]
         [NAME]     (FONT)
         [NAME]     (FACE)
    E7E00">
    <FONT FACE=e <-- bad character
    java.lang.reflect.UndeclaredThrowableException: Error at line:8 col:13 Line:8
    ''' expected, got char[72]
         at weblogic.xml.babel.baseparser.SAXElementFactory.createSAXParseException(SAXElementFactory.java:60)
         at weblogic.xml.babel.parsers.StreamParser.streamParseSome(StreamParser.java:130)
         at weblogic.xml.babel.parsers.BabelXMLEventStream.parseSome(BabelXMLEventStream.java:46)
         at weblogicx.xml.stream.XMLEventStreamBase.hasNext(XMLEventStreamBase.java:135)
         at weblogicx.xml.stream.XMLEventStreamBase.hasStartElement(XMLEventStreamBase.java:258)
         at weblogicx.xml.stream.XMLEventStreamBase.hasStartElement(XMLEventStreamBase.java:171)
         at weblogicx.xml.stream.XMLEventStreamBase.startElement(XMLEventStreamBase.java:164)
         at weblogic.soap.codec.SoapMessage.read(SoapMessage.java:86)
         at weblogic.soap.WebServiceProxy.receive(WebServiceProxy.java:464)
         at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:430)
         at weblogic.soap.SoapMethod.invoke(SoapMethod.java:186)
         at weblogic.soap.wsdl.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:31)
         at $Proxy0.getAusgabe(Unknown Source)
         at webclient.Client.main(Client.java:36)
    Exception in thread "main"

    Hi, thanks, manoj!
    The problem was that eventhough I had the correct login, the server had another
    security layer, that prevented me from doing the lookup. So I guess I was supposed
    to get an error html page and so the SAX-Parser got messed up.
    Stupid mistake, but thank you very much.
    "manoj cheenath" <[email protected]> wrote:
    It looks like the server is sending back a html page instead
    of the soap response (text/xml). Can you check the URL
    you are trying?
    If you are using a WSDL file, then the URL will be inside
    the service->port->soap:address-location element.
    regards,
    -manoj
    "Stephan" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I am getting a really strange exception thrown from my client. It seemsto
    be
    about a class that the wsgen generated. Has anyone ever seen somethinglike that
    before? Maybe it is because I am using JBuilder(5.1)? I am operatingon a
    WL6.1
    server. It is only a test webservice. So there are only standard returntypes,
    etc.
    Any comments/suggestions are appreciated
    cheers Stephan
    Scanner has tokens:
    [OPENTAGBEGIN]
    [NAME] (META)
    [NAME] (NAME)
    [CHARDATA] (GENERATOR)
    [NAME] (CONTENT)
    [CHARDATA] (WebLogic htmlKona WebLogic Server 6.1 SP2 12/18/2001 11:13:46#154529
    [TAGEND]
    [SPACE] (
    [CLOSETAGBEGIN]
    [NAME] (HEAD)
    [TAGEND]
    [SPACE] (
    [OPENTAGBEGIN]
    [NAME] (BODY)
    [NAME] (bgcolor)
    [CHARDATA] (white)
    [NAME] (alink)
    [CHARDATA] (#397F70)
    [NAME] (link)
    [CHARDATA] (#640078)
    [NAME] (vlink)
    [CHARDATA] (#DE7E00)
    [TAGEND]
    [SPACE] (
    [OPENTAGBEGIN]
    [NAME] (FONT)
    [NAME] (FACE)
    E7E00">
    <FONT FACE=e <-- bad character
    java.lang.reflect.UndeclaredThrowableException: Error at line:8 col:13Line:8
    ''' expected, got char[72]
    atweblogic.xml.babel.baseparser.SAXElementFactory.createSAXParseException(SAXE
    lementFactory.java:60)
    atweblogic.xml.babel.parsers.StreamParser.streamParseSome(StreamParser.java:13
    0)
    atweblogic.xml.babel.parsers.BabelXMLEventStream.parseSome(BabelXMLEventStream
    ..java:46)
    atweblogicx.xml.stream.XMLEventStreamBase.hasNext(XMLEventStreamBase.java:135)
    atweblogicx.xml.stream.XMLEventStreamBase.hasStartElement(XMLEventStreamBase.j
    ava:258)
    atweblogicx.xml.stream.XMLEventStreamBase.hasStartElement(XMLEventStreamBase.j
    ava:171)
    atweblogicx.xml.stream.XMLEventStreamBase.startElement(XMLEventStreamBase.java
    :164)
    at weblogic.soap.codec.SoapMessage.read(SoapMessage.java:86)
    at weblogic.soap.WebServiceProxy.receive(WebServiceProxy.java:464)
    at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:430)
    at weblogic.soap.SoapMethod.invoke(SoapMethod.java:186)
    atweblogic.soap.wsdl.WebServiceInvocationHandler.invoke(WebServiceInvocationHa
    ndler.java:31)
    at $Proxy0.getAusgabe(Unknown Source)
    at webclient.Client.main(Client.java:36)
    Exception in thread "main"

  • How to catch exception thrown from a function module?

    Hi all,
             When we are calling a function module from JSPDynpage setting some import parameters, If in some case an exception is thrown in the function module.  How can we catch the same exception in the JSPDynpage program?
    Thanks & Regards,
    Ravi

    Hi Ravi
                                    Try this
                                                try
                    Object retMsgs = output.get(bapiretrunmsgobject);
                      if(result != null )
    IrecordSet rmsg = (IrecordSet) result
                   catch(Exception ex)
                        printException(ex, "Error getting function result");
    Lemme know for any further questions.
    Regards
    Praveen

  • Catching an exception thrown from another thread

    I have a SocketServer that creates new threads to handle incoming clients. If one of the threads throw a SQLException is it possible to catch that exception in the SocketServer that created that thread.
    I tried implementing this code and I cannot get the server to catch an exception thrown in the thread. Are my assumptions correct?
    I was reading something about Thread Groups and implementing an uncoughtException() method, but this looked like overkill.
    Thanks for your time!
    Some Example code would be the following where the ClientThread will do a database query which could cause an SQLException. I'd like to catch that exception in my Socket Server
          try
                 new ClientThread( socketServer.accept() , host, connection ).start();
          catch( SQLException e )
                 System.out.println( "DataSource Connection Problem" );
                  e.printStackTrace();
          }

    hehe, why?
    The server's job is to listen for an incoming message from a client and pass it off to a thread to handle the client. Otherwise the server will have to block on that incoming port untill it has finished handling the client and usually there are many incoming clients continuously.
    The reason I would want to catch an exception in the server based on the SQLException thrown in the thread is because the SQLException is usually going to be due to the fact the datasource connection has become unavalable, or needs to be refreshed. This datasource connection is a private variable stored in the socket server. The SocketServer now needs to know that it has to refresh that datasource connection. I would normally try to use somesort of flag to set the variable but to throw another wrench into my dilemma, the SocketServer is actually its own thread. So I can't make any of these variables static, which means I can't have the thread call a method on teh socket server to change the status flag. :)
    I guess I need implement some sort of Listener that the thread can notify when a datasource connection goes down?
    Thanks for the help so far, I figured java would not want one thread to catch another thread's exceptions, but I just wanted to make sure.

  • Exceptions thrown by a method

    Hi,
    In JDI is there a way to get the list of exceptions that can be thrown by a method? I want to find out when a method exits but MethodExitEvent is not generated when a method quits by throwing an exception, so in addition to MethodExitRequest I am also inserting breakpoints in exceptions that can be thrown by the method. But while there is a java.lang.reflect.Method.getExceptionTypes(), I wasn't able to find a corresponding call in com.sun.jdi.Method. Is there some way of achieving the same thing?
    Thanks, Alvin

    Hi,
    In JDI is there a way to get the list of exceptions that can be thrown by a method? I want to find out when a method exits but MethodExitEvent is not generated when a method quits by throwing an exception, so in addition to MethodExitRequest I am also inserting breakpoints in exceptions that can be thrown by the method. But while there is a java.lang.reflect.Method.getExceptionTypes(), I wasn't able to find a corresponding call in com.sun.jdi.Method. Is there some way of achieving the same thing?
    Thanks, Alvin

  • Paint from different method

    Hi,
    I have class which extends JPanel. I want to draw a string from a public method in the same class which is different from paint(Graphics g) method.
    But, the string does not appear when I do:
    g2.drawString("hello",50,50);
    I had declared Graphics2D g2 in the class and I have in paint(Graphics g)
    g2 = (Graphics 2D)g
    I also used repaint(); validate() after drawString, but no help..
    Am I missing anything ?
    Thanks,
    Dhiman

    You can use JLabel and do your painting using BufferedImage
    For eg.,
    JLabel label = new JLabel("", JLabel.CENTER);
    BufferedImage buff = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics g = buff.getGraphics();
    //Draw the Image
    g.drawImage(img, 0, 0, null);
    //Draw the String
    g.drawString("Hello Java!!", 10, 10);
    //Now draw the Image on the Label
    label.setIcon(new ImageIcon(buff));

  • Sharing the same iTunes library from different Macs/Pcs to Time Capsule

    Hello everybody,
    I have just bought a new Time Capsule (2TB) internal storage and an external 2TB Western Digital that i have also connected to the time capsule just fine.
    The Time capsule is supplying internet to a ps3, apple tv, sony bluray player and a satelite reciever (equivalent to Sky in UK). It is actually setup on the second floor and is acting as a extension for the main network and is working perfectly.
    Now I have about 5 Pcs at home with different users and 2 mac laptops (Kids wife etc.. so different users).
    My ultimate goal is to setup one itunes library on all the laptops that are present on the TC.
    What I did was I copied the Itunes folder (my main precious itunes library) and pasted it on the TC hard drive.
    Then i tried opening it from an itunes of one of the laptops (a macbook), I opened itunes while holding options button and choose the library to the wirelessly shared itunes file and it showed up perfectly like the exact itunes with everything in it including play counts etc..
    but when i want to open a song it doesnt find it and i have to pinpoint location in order to play the song.
    Its just not possible to do that to every single song as my library is about 120 gigs of music. It would take years to do tht for every song.
    When i usually find one folder itunes asks to find all of them automatically and when i press yes itunes stops working.
    PS. Im trying this on one laptop now as a trial in order to see how this works. The main library is backed up and all safe n sound. Also i would like to say i changed the itunes library folder to the time capsule on preferences of itunes.
    Is there anyway anyone could help me? Any different methods to do it? Please we can discuss whatever ideas ud like to include.
    Thank you

    Check this article for advice about sharing iTunes libraries.

Maybe you are looking for

  • What's Wrong With This Code?

    I've been trying to get a test automaton plugin to work.  It builds correctly with no errors or warnings yet when I attempt to use it, I get no results.  No errors either.  All its intended to do is Copy > Make New Layer > Paste.  The code is below. 

  • Min-Max to create WIP

    Hi All, I need help on the following - I am running Min-Max planning to create WIP jobs. I want to - 1: Default WIP Start Date to Current Date. Currently WIP completion date is defaulted to current date. This causes WIP Start Date in Past Due which i

  • Print immediately option for ME21N(PO) and ME41(RFQ)

    Dear friends, Can anybody please tell me for the purchase orders(ME22N),if we select messages button,select communication method----in this screen,print immediately button is automatically coming. Where i have to do settings to see that in Communicat

  • PO Output for Communication landscape PDF printing sideways issue

    Hi, I created a custom pdf template which uses the Standard Purchase Order Data Source (PO_STANDARD_PO) data definition. The requirement was to change the look of the standard po report and also to make it landscape. I was able to successfully create

  • NWBC 3.0 PL3 (PL4) does not run on windows 2008 R2 64BIT

    Hey, we installed 5102369_04 which is the NWBC 3.0 PL4 , on a platform patched with the latest windows patches, for windows server 2008 R2 64bit. Gui 720 Result : when the NWBC-icon is clicked, fastly a screen is popped (like starting a program) But