Should local exceptions be wrapped in RemoteException with RMI?

I am trying to understand the reason why all remote methods have the possibility of throwing a RemoteException.
I am currently doing something like this:public interface RemoteReader extends Remote {
    public String readData(File f) throws IOException, RemoteException;
}Should I be doing something like:public interface RemoteReader extends Remote {
    public String readData(File f) throws RemoteException; //no IOException
public class RemoteReaderImpl implements RemoteReader {
    public String readData(File f) throws RemoteException {
        try {
            //some code that may throw an IOException
        } catch (IOException e) {
            throw new RemoteException(e.getMessage(), e);
}Which is preferred?

No. RemoteException should just mean that something went wrong with the transport. Something always can, so RMI obliges you to declare RemoteException as thrown by every remote method. You should use your own exception classes for your own exceptions, then you'll have an easy way of distinguishing application problems from platform problems.

Similar Messages

  • Weblogic 6.1sp2 custom exceptions being transformed to remoteexceptions

    Hi,
    We've recently ported our application from weblogic 6.0sp2 to weblogic 6.1sp2.
    In our ejbs we throw custom exceptions in our business logic, but somehow, in
    weblogic6.1sp2, these are being transformed into ejbexception/remoteexceptions.
    Do you have any ideas what we may be doing wrong?
    Thanks

    Thanks,
    we were doing that, but our custom exceptions were inheriting from RuntimeException
    instead of Exception which was the cause of the problem because weblogic 6.1 is
    more strict than weblogic 6.0.
    Diana
    Matthew Shinn <[email protected]> wrote:
    Hi Diana,
    Make sure your custom exceptions are declared in the throws clause of
    the
    home\remote\localHome\local interface methods. If they are not declared
    in the
    throws clause of your interface methods, they will be wrapped in RemoteExceptions
    or EJBExceptions before being thrown to the client.
    - Matt
    Diana wrote:
    Hi,
    We've recently ported our application from weblogic 6.0sp2 to weblogic6.1sp2.
    In our ejbs we throw custom exceptions in our business logic, but somehow,in
    weblogic6.1sp2, these are being transformed into ejbexception/remoteexceptions.
    Do you have any ideas what we may be doing wrong?
    Thanks

  • HT1423 I am adding more memory, should I replace the top two slots with the 4g memory modules, then place 2g memory modules on bottom slots. Does it even matter?

    I am adding more memory, should I replace the top two slots with the 4g memory modules, then place 2g memory modules on bottom slots. Does it even matter?

    I am adding more memory, should I replace the top two slots with the 4g memory modules, then place 2g memory modules on bottom slots. Does it even matter?

  • Is there a way to open a local file not a web file with actionscript 3.0?

    Reason for asking is because I am making a media player in Adobe Flash CS6, and was wondering if there was anyway to make a button to open a local .fla file in a directory with ActionScript 3.0 or if there are any other ways I can achieve this?
    Thanks Casey

    with an air app, check the file class.  otherwise, check the filereference class.

  • How can I see whether songs in iCloud are also on the PC locally (so I can sync them with a Classic)?

    How can I see whether songs in iCloud are also on the PC locally (so I can sync them with a Classic)?

    In iTunes, on the View menu select 'Hide Music in the Cloud'

  • How much RAM should I get my new MacBook installed with?

    How much RAM should I get my new MacBook installed with? I'm planning on getting a new Macbook sometime this fall. I'll probably be a light user, mostly internet, email, and your occasional Letter/Envelope.
    Are their any other options that I'll want to make sure that I get?
    Oh, and this will also be my very first Mac.
    Thanks,
    Jeff

    In the link Alvin Ray posted it shows the different configurations that can be used in RAM. Officially Apple states that the MacBook supports 2 GB Ram. It can hold 4 GB but only uses 3 GB. The 4 GB would only benefit the matched pair use for optimum graphics. Unless you do a lot of very graphic intensive work 3 GB should be fine.

  • I created a password to my iPad as a parental restriction, but my daughter played with it and pushed the wrong password 10 times my ipad was disabled, what should i do, since it wont sync with itunes becoz it will just say, cannot sync files becoz the dev

    i created a password to my iPad as a parental restriction, but my daughter played with it and pushed the wrong password 10 times my ipad was disabled, what should i do, since it wont sync with itunes becoz it will just say, cannot sync files becoz the device is password enabled, Please somebody helpme

    If you are talking about the passcode that gains access to the iPad - you will have to restore your iPad in order to unlock it. You will want to use the last computer that you synced with so that you can recover all of your app data, settings, etc. this explains how to restore the iPad. At the end of the process restore from your backup as described.
    http://support.apple.com/kb/HT1414
    If iTunes will not let you restore that way, you may need to use recovery mode to restore, and you can read about that process here.
    http://support.apple.com/kb/ht4097
    IF - you are talking about a restrictions pass code that you put on the device to restrict content or downloading apps or something like that - you do not want to restore from the backup - because that backup will contain the passcode that you cannot remember and you will end up where you started.

  • What features should have an image to be used with OCR

    Hello
    everyone. I would like to know what
    features should have an image to be used with OCR. I have managed to
    implement the OCR (with the VDM module) but applying a filter that
    turns me Threshold the image (bmp) to another in original black and
    white, just so I can work. When I try from labview not allow me to
    work with the original BMP file. Note the images are captured from a
    webcam.
    Thank you.

    Thanks Musk. I have a
    question, what should be the treatment he should give a color image to
    convert TIFF finally, I mention this because the examples in Labview /
    VDM / OCR use files in this format.
    Thank you very
    much.

  • If i buy ipad mini from website for sprint or verizon should i have to make a contract with cellular supplier or not  and if i take it to England does LTE (4G) will work their with my carrier

    if i buy ipad mini from website for sprint or verizon should i have to make a contract with cellular supplier or not  and if i take it to England does LTE (4G) will work their with my carrier

    AT&T and europe all use GSM . There is no CDMA in Europe
    A genuine unlocked iPhone 4/4S  from Europe will work fine
    A similar unlocked iP5 will work on 3G but NOT on  4G as the
    European  iP5 does not have the 4G bands suitable for use in US
    and the warranty will not be valid in the US it is not international

  • Hi, I have an iphone4 and all of a sudden none of the apps (except the ones that came with the phone) will open. The screen goes black then it goes back to the homescreen. Any ideas? Thanks in advance!

    Hi,
    I have an iphone 4 and all of a sudden none of the apps will work, except the ones that came with the phone. When I open them the screen goes black then it goes back to the homescreen.
    Also when I plug the phone into itunes it only gives me the option to either restore or eject the phone. Up until today I never had any problems, I sync it regularly and all the software (inc itunes) is up to date. The last time I backed it up was about a month ago when I got the phone, (a replacement as my other iphone4 had loads of problems) so I don't want to have to restore it and lose everything off it!
    Any ideas? Thanks in advance!

    Sounds like the device was dropped at some point and damaged as a result.
    Take it to Apple for evaluation and a replacement.

  • Our church would like to purchase an ipad3 for our pastor, he is 30yrs old. Should we get 16,32 or 64 with verizon or at

    Our church would like to purchase an ipad3 for our pastor, he is 30yrs old. Should we get 16,32 or 64 with verizon or at&t

    For the carrier, I'd check to see what the signal and speeds are in your area and make my decision from there.
    You might also want to think about getting a WiFi only iPad. It costs almost the same to buy a 32GB WiFi + 4G/LTE iPad than a 64GB WiFi only model, so I would evaluate that. Also, he would have to pay for the 4G service and might not need it. Most places have open WiFi networks and if he has a smartphone, he could just use the HotSpot option to give his iPad internet access.
    I'd go for 32GB of storage space because it is in the middle and will meet the average user's needs. 16GB might be too little space, whereas with 64GB, he might not even use half of the storage space.
    I used to have a 16GB, which had less than 1GB left of space before I upgraded to a 32GB. The 16GB had my music (little under 1500 songs), around 300 pictures and the rest was filled with apps and files (books mostly). The new iPad (32GB) still has 10GB of space so I don't have to worry if I want to download a few pictures or new apps.

  • [svn:bz-trunk] 5137: Fix failing security tests on BlazeDS/ trunk by using a remote object to invalidate the FlexSession at the end of each test method which should cause each test method to run with a new /clean session.

    Revision: 5137
    Author: [email protected]
    Date: 2009-03-02 10:28:59 -0800 (Mon, 02 Mar 2009)
    Log Message:
    Fix failing security tests on BlazeDS/trunk by using a remote object to invalidate the FlexSession at the end of each test method which should cause each test method to run with a new/clean session. It looks like some test methods were leaving some things in a bad state which was causing the next test that ran to fail. These may be legitimate bugs/issues so we should investigate further to see what sequence of events gets things into a bad state but for these tests we want all of the test methods to run in isolation.
    Modified Paths:
    blazeds/trunk/qa/apps/qa-manual/WEB-INF/flex/services-config.mods.xml
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/remoting-config.mods.xml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-amf/JMSAuthSendSubscribeConstraintTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-amf/MessagingAuthProSendTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-http/JMSAuthSendSubscribeConstraintTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-http/MessagingAuthProSendTest.mxml
    Added Paths:
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/qa/messaging/SessionManager.java

    In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
    That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
    Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
    Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
    While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
    Hunt

  • How to make the contact picture should appear on the upper right corner with thumb picture when some one calling instead showing the entire screen

    How to make the contact picture should appear on the upper right corner with thumb picture when some one calling instead showing the entire screen

    See deggie's response in this post... https://discussions.apple.com/message/8531821#8531821

  • Any example of dynamic proxy with RMI?

    Hi, are there any good example of dynamic proxy with RMI, using the new RemoteObjectInvocationHandler class?
    I am currently implementing a Registry, and want to use dynamic proxy to wrap around the registry stub, to pass extra information to the client.
    I've tried it, but the program will hang and get this exception:
    Exception in thread "RMI TCP Connection(1616)-192.168.1.23" java.lang.OutOfMemoryError: Java heap space
    My implementation looks like this:
    public RegistryImpl extends RemoteServer Implements Registry {
        public RegistryImpl(int port, Properties... properties) throws RemoteException, ChannelException {
             // Create a reference for the registry.
         LiveRef liveref = new LiveRef(id, port);
            ref = new UnicastServerRef(liveref);
             Registry proxy = (Registry)RegistryProxy.newProxyInstance(
                  this.getClass().getClassLoader(),
                  this.getClass().getInterfaces(),
                  new RemoteObjectInvocationHandler(this.getRef()));
             /* Using dynamic proxy */
             usref.exportObject(proxy, null, true);
    public class RegistryProxy extends Proxy implements Registry {
         private InvocationHandler handler;
         public RegistryProxy(InvocationHandler handler) {
              super(handler);
              this.handler = handler;
         public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException {
              Remote result;
              try {
                   Method m = Registry.class.getMethod("lookup", new Class[]{String.class});
                   result = (Remote)handler.invoke(this, m, new Object[]{name});
              } catch (SecurityException e) {
                   throw new UndeclaredThrowableException(e);
              } catch (NoSuchMethodException e) {
                   throw new UndeclaredThrowableException(e);
              } catch (Throwable e) {
                   throw new UndeclaredThrowableException(e);
              return result;
         public void bind(String name, Remote remoteObj) throws RemoteException, AlreadyBoundException, AccessException {
         public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
         public void rebind(String name, Remote remoteObj) throws RemoteException, AccessException {
         public String[] list() throws RemoteException, AccessException {
    }I am new to Java programming, any help is appriciated.
    Regards
    Eddie

    Hi Eddie,
    Perhaps you might like this one:
    http://wiki.java.net/bin/view/Communications/TransparentProxy
    it uses dynamic proxies to achieve complete RMI transparency.
    Something to consider, good luck.
    John

  • RemoteException: java.rmi.UnmarshalException in jdk 1.4.2

    i'm implementing an RMI over the jdk 1.4.2 (can't do it in the 1.5 or 1.6) i've seen this topic [http://forum.java.sun.com/thread.jspa?threadID=370196&messageID=1808449] but it didn't help me, or i'm doing something wrong...
    i know the RMI code is ok because it runs on java 1.6 (with the automatic generation of stubs and skeletons) but when i change the platform to 1.4 it throws the exception:
    RemoteException: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
    java.lang.ClassNotFoundException: servidor.MensageiroImpl_Stub
    the VM is configured to use the -Djava.security.policy=C:\Projecto\Policy\permissions.policy both in the client and server
    please help me :S i've been burning my head with this for 3 days
    i leave my code here:
    The interface:
    package rmiinterface;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface Mensageiro extends Remote {
        public void sendMsg(String msg) throws RemoteException;
        public String readMsg() throws RemoteException;
    }the implementation:
    package servidor;
    import rmiinterface.Mensageiro;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class MensageiroImpl extends UnicastRemoteObject implements Mensageiro {
        public MensageiroImpl() throws RemoteException {
            super();
        public void sendMsg(String msg) throws RemoteException {
            System.out.println(msg);
        public String readMsg() throws RemoteException {
            return "This is not a Hello World! message";
    }the server:
    package servidor;
    import rmiinterface.Mensageiro;
    import java.rmi.Naming;
    import java.rmi.RMISecurityManager;
    public class MensageiroServer {
        public MensageiroServer() {
            System.setSecurityManager(new RMISecurityManager());
            try {
                Mensageiro m = new MensageiroImpl();
                java.rmi.registry.LocateRegistry.createRegistry(1099);
                System.out.println("RMI registry successfully initiated");
                Naming.rebind("MensageiroService", m);
                System.out.println("Servidor Online");
            } catch (Exception e) {
                System.out.println("Trouble: " + e.getMessage());
        public static void main(String[] args) {
            new MensageiroServer();
    }and the client:
    package cliente;
    import rmiinterface.Mensageiro;
    import java.rmi.RMISecurityManager;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.rmi.NotBoundException;
    import java.net.MalformedURLException;
    public class MensageiroClient {
        public MensageiroClient() {
        public static void main(String args[]) {
            System.setSecurityManager(new RMISecurityManager());
            try {
                Mensageiro m = (Mensageiro) Naming.lookup("//localhost/MensageiroService");
                System.out.println(m.readMsg());
                m.sendMsg("Hello World!");
            } catch (MalformedURLException e) {
                System.out.println();
                System.out.println("MalformedURLException: " + e.toString());
            } catch (RemoteException e) {
                System.out.println();
                System.out.println("RemoteException: " + e.toString());
            } catch (NotBoundException e) {
                System.out.println();
                System.out.println("NotBoundException: " + e.toString());
            } catch (Exception e) {
                System.out.println();
                System.out.println("Exception: " + e.toString());
    }NOTE: my IDE is Netbeans 6.1. and the client and server are in diffrent projects
    thanks in advance
    Best Regards,
    Carlos Daniel Ribeiro

    the stub and the skeleton are being generated, and they are there, in the server project! i don't know why the class defs for the stub filearen't downloded by the client project...I don't know why you think they will be downloaded. They won't be, unless you're using the codebase feature. The client needs the remote interface and the stub on its classpath, and all classes that the remote interface depends on, and so on recursively until closure. You have to do something about that.
    It works under 1.6 because it doesn't need the stub at all.

Maybe you are looking for

  • How to read word document in pl/sql

    How to read word document which is stored as BLOB column in table. I want to read it word by word.Please explain me how to raed using DBMS_lob package and substr,instr.

  • Table Filter with static LOV column

    Hi, I am using JDeveloper 11.1.14 and ADF-BC in my project. For one of the tables,I have the following scenario. 1. I have a viewobject [Ex: EmpVo] in which one of the attributes has a static LOV[:Ex: 'Status' attribute in EmpVo has static LOV - Stat

  • Screen resolution problem - HP computer and LED Cinema Display

    I just purchased an HP Envy Phoenix H9-1330 with Windows 8, and I connected it to my 27" Mac LED Cinema Display, but the resolution is horrible. The highest option in the screen resolution menu is 1280 x 720, and I'm getting the error message "Your r

  • Regarding print options

    Hi all,      I need to print currency field in Cheque layout. It is showing million format. For ex: 999,999,999.00. But i need to print it as 99,99,99,999.00. This is Indian rupees format. Dont forget, This is to print in SAP script not in report pro

  • DS 5.2 Solaris Sparc version

    I installed DS 5.2 on Solaris 8 platform. I followed the instructions in the documentation for use with kerberos plugin . Ldapsearch queries work fine, except when I attempt to specify using the GSSAPI mechanism. Then the server crashes with a core d