Can i start rmiregistry from inside class, and then bind to it, etc?

I want to have my app running and then have it start RMIregistry. if registry is already running, it attaches to it and binds itself.
if registry not already running, it starts it and then binds to it.
Also, if i did this, how would an app on another server find it?
how would it check to see if registry from similar app is running on another computer?

I want to have my app running and then have it start RMIregistryHave a look on java.rmi.registry.LocateRegistry class. It provides methods to create registry from the application (createRegistry) and one to check for registry running (getRegistry).
how would it check to see if registry from similar app is running on another computer?Registry is always "seen" over the network, though you have to use the same port. This service is global even if you start it from application.
Best regards,
Martin

Similar Messages

  • Can i start reading on my kindle and then continue on my ipad

    can i start reading on my kindle and then continue where i left off on my ipad?

    Yes, I do it as well between my Kindle, iPad and Android phone.  I would note that in order for it to work between the Kindle and another device, you need to turn on the wifi connection on the Kindle, at least temporarily, so it can connect and tell your Kindle account where you are in your book.  I don't typically leave my wifi on when using the Kindle because of the battery drain, so I have to remember to turn it on for a minute before I'm done using it.    
    Same thing if you use the Kindle app on your iPad and then want to pick up again on Kindle - you need the wifi on to sync, then turn it off you prefer.
    One other note - sometimes the devices (if already connected to wifi) will sync automatically.  Other times I find I need to bring up the menu and tell it to sync.

  • Can't start rmiregistry from application

    Hi!
    This is my code, which works, when I start rmiregistry from command-line:
    public class RemoteDBStarter extends RMIStarter {
      private final static int PORT = 2359;
      private final static String NAME = "DB";
      public RemoteDBStarter() {
        super(RemoteDBInterface.class);
      public void serverOrClientContinue() {
        try {
          RemoteDBInterface db = new RemoteDB();
          RemoteDBInterface stub = (RemoteDBInterface)UnicastRemoteObject
              .exportObject(db, PORT);
          Registry registry = LocateRegistry.getRegistry();
          registry.rebind(NAME, stub);
        catch(Exception e) {
          //TODO
          e.printStackTrace();
      public static void main(String[] args) {
        new RemoteDBStarter();
    }But when I try to add createRegistry
    LocateRegistry.createRegistry(PORT);
    RemoteDBInterface db = new RemoteDB();
    RemoteDBInterface stub = (RemoteDBInterface)UnicastRemoteObject
        .exportObject(db, PORT);I get exception
    java.rmi.ConnectException: Connection refused to host: 10.x.x.x; nested exception is:
         java.net.ConnectException: Connection refused: connect
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
         at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
         at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
         at server.RemoteDBStarter.serverOrClientContinue(RemoteDBStarter.java:32)
         at common.RMIStarter.<init>(RMIStarter.java:15)
         at server.RemoteDBStarter.<init>(RemoteDBStarter.java:16)
         at server.RemoteDBStarter.main(RemoteDBStarter.java:41)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:520)
         at java.net.Socket.connect(Socket.java:470)
         at java.net.Socket.<init>(Socket.java:367)
         at java.net.Socket.<init>(Socket.java:180)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
         ... 8 moreI tried to set hostname
    System.setProperty("java.rmi.server.hostname", "localhost");but it gives me same exception, as if it didn't even look for this property. Any suggestions?

    I'm getting lost here, so I'll put whole code once more:
    Server
    public class RemoteDBStarter {
      private final static int PORT = 1099;
      private final static String NAME = "DB";
      private static Registry registry;
      public static void main(String[] args) throws ClassNotFoundException,
                                                    SQLException {
        System.setProperty("java.security.policy",
            "D:/work/data/allow_all.policy");
        if(System.getSecurityManager() == null) {
          System.setSecurityManager(new SecurityManager());
        try {
          registry = LocateRegistry.createRegistry(PORT);
          RemoteDBInterface db = new RemoteDB();
          RemoteDBInterface stub = (RemoteDBInterface)UnicastRemoteObject
              .exportObject(db, PORT);
          registry.rebind(NAME, stub);
        catch(Exception e) {
          e.printStackTrace();
    }Client
    public class Client {
      private final static int PORT = 1099;
      private final static String NAME = "DB";
      private static Registry registry;
      public void callForData() {
        try {
          registry = LocateRegistry.getRegistry(PORT);
          System.out.println(registry);
          RemoteDBInterface stub = (RemoteDBInterface)registry.lookup(NAME);
          stub.retrieveDBTable();
        catch (Exception e) {
          e.printStackTrace();
    }Console after calling callForData() method
    RegistryImpl_Stub[UnicastRef [liveRef: [endpoint:[x.x.x.x:1099](remote),objID:[0:0:0, 0]]]]
    java.rmi.ConnectException: Connection refused to host: x.x.x.x; nested exception is:
         java.net.ConnectException: Connection refused: connect
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
         at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
         at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
         at $Proxy0.retrieveDBTable(Unknown Source)
         at com.gk_software.es.pklasna.client.Client.callForData(Client.java:36)
         at com.gk_software.es.pklasna.gui.GUI.actionPerformed(GUI.java:85)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:5517)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
         at java.awt.Component.processEvent(Component.java:5282)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3984)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3819)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1791)
         at java.awt.Component.dispatchEvent(Component.java:3819)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:520)
         at java.net.Socket.connect(Socket.java:470)
         at java.net.Socket.<init>(Socket.java:367)
         at java.net.Socket.<init>(Socket.java:180)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
         ... 32 moreIPs form println and exception are same.

  • How can I record content FROM an iPad and then publish it back to an iPad?

    Everything I search for talks about pushing content out to an iPad, but what if I want to capture/record content from an iPad? I am trying to do a software simulation, rather than a straigh record.
    I did find a third party application called Reflection that allows me to mirror, or reflect, the iPad onto my computer. The problem is that due to the way the content transmits from the iPad, I would have to manually capture each screen and corresponding action within Captivate.
    Any advice on on this?

    Hello,
    Welcome to Adobe Forums.
    I am not sure about the 3rd Party Application but if you can create a .mp4 video of your IPAD simulation then you can insert that video in Adobe Captivate 6 as a Slide Video.
    Thanks,
    Vikram

  • Can we buy iphone from one country and then change the service provider

    Hi,
    I wanted to know if I buy an iphone from india today can I change the service provider when i come to U.S.A. for my studies in Jan

    It seems to depend on the country where you bought your phone.
    In Australia, with a post-paid account I can have my carrier unlock the phone for free so I can use the phone on a pre-paid account in the States when I am there.
    My carrier here gets paid regardless as I am on a 24-month contract.

  • Can I import HTMLs from inside the project and use as portlet page ?

    As you know, I am using Java Studio Creator 2 Update 1 for my current portal project. I have created JSR-168 JSF Portlet Project for my portlet development.
    As I have some html pages ready for my development,
    Can I import HTMLs from inside the project and use as portlet page for my project?
    I did the followings steps:
    1: In side the project - File -> Add Existing Item -> Web Page ( imported test.html page from my local folder)
    2: Let it convert some of the tags for me ( so now it becomes - �test.jsp� )
    3: Set it to initial view.
    4. A default portlet page � newPortletPage.jsp is still there with no initial view.
    Now after doing this, No Visual Designer and Properties window available to for that �test.jsp� page. Though it allowed me to �build� the project successfully.
    When I build and run the portlet application, got the error message �Error occurred in portlet!� on Pluto Portal. Please advice.

    You do not open fcpproject files. You don't double click or anything else. The files have to be in the correct folder structure in the Final Cut Projects folder and the application opens them automatically. Can you post screen shots of the Final Cut Projects folder and its location.

  • My MacBook Pro 13 inch makes a clicking noise from the hard drive and can not start up in safe mode and normal. I then ran disk utility in recovery mode and disk utility shows no problems with the hard drive. What is the problem?

    Please help me, I have a mid 2010 Mac book pro with a toshiba mk3266gsxf harddrive. It started making a clicking noise and then my computer crashed. I proceeded to boot in safe mode, but it doesn't work. When I ran disk utility in recovery mode, it showed no problem with my disk. Does any one know what the problem is?

    Sounds like a mechanical problem with the drive and it ruined the sectors where the Macintosh HD partition (and OS X, and files and programs) reside, but not your Recovery HD partition.
    If you held command option r while booting, that's Internet Recovery and it's loaded via the Internet, not via the Recovery HD partition on the boot drive, so that could mean the drive is dead mechanically or there is another issue.
    In either case the drive will likely have to be replaced, it's a matter of what occured to where and the drive state if you can recover data or not. If you made recent backups then your fine.
    My computer is not working, is my personal data lost?
    Most commonly used backup methods

  • How can I get my iPad to play just one song from my playlist and then stop automatically?

    I am a music teacher and I use the iPod on my iPad to play songs in class.  I have a long playlist of songs to choose from in each class, and I want to play just one song at a time.  I want to be able to start one song from my playlist and then walk away from my iPad and have it stop automatically when that song is over.  (I know how to make it repeat the same song over and over, but tha'ts not what I need.  I also know how to push "pause," but I don't want to have to walk away from the children to do it.) How can I make it play one song from a playlist at a time?

    I don't believe that there is a way to do that except, perhaps, creating a separate Playlist for each song.
    Suggestions for features to Apple at: http://www.apple.com/feedback/ipad.html

  • Start Workflow from particular Step and assign to particular group of members

    Hi
    We are working on workflow using CQ 5.5.
    Is it possible start workflow from particular Step and assign this workflow to particular group of members dynamically(Using Process Step).
    Workflow Name : Single Page Workflow
                        Start
                            |
                        Step 1
                            |
                        Step 2
                            |
                        Step 3
                            |
                        Step 4
                            |
                        Step 5
                            |
                        Step 6 (Process Step)
                            |
                         End
    In Step 6 , we will start workflow for list pages dynamically , for that we written code as
    public class PublishTranslation implements WorkflowProcess{
        public void execute(WorkItem item, WorkflowSession wfsession, MetaDataMap metadata)
                throws WorkflowException {
               WorkflowModel  model = wfsession.getModel(item.getWorkflow().getWorkflowModel().getId());
               WorkflowData wfdata= wfsession.newWorkflowData("JCR_PATH",pagePath[i]);
               wfsession.startWorkflow(model, wfdata);
    This code starting workflow from step 1.
    I need help on
    1. How can i start workflow from step 2 or 3 ?
    2. How can i assign this workflow to group members ?
    Thanks & Regards

    Hello Ravindra,
    Logically it shouldn't allow you to do that and same happening because start workflow call on model will always trigger the workflow from starting point (means the very first step after start component in workflow design)
    To achieve this you have other ways, i would suggest to try below if it works for you.
    1. Instead of creating a new workflow just branch it programmaticaly and route back to previous step
          List<Route> routes=wfsession.getBackRoutes(item);
                     Route route=routes.get(WHAT_EVER_STEP);
                     wfsession.complete(item, route);
    2. Create a new workflow model which starts from second step and using code get access of that workflow
         wfsession.getAllWorkflows();
    for delegation as mentioned by Yogesh, you can try wfsession.delegateWorkItem(WorkItem item, Authorizable participant)
    Thanks,
    Pawan

  • I may have deleted some system files from my computer due to my antivirus and now my imac won't start. Actually it does, and then there is a blank screeen with the apple logo and it shuts down right away. is tehre a possibility of recovering my files?

    Hello
    I was having some problems with my Imac, for a while it was slow and often disconneceted from my wifi, while this one worked perfectly (tested with other devices)
    I thoug i might have a virus, so i downloaded an antivirus (mac keeper) and started checking.
    I also did a scan of my computer using Console or something from the utilities, and then a folder popped witha  file I had canceled a while ago. I canceled the file and then my Imac continued to be slow.
    i then restarted my Imac, but when it started, the usual grey logo of Apple appeared, and then it shut down suddently.
    I tried to reboot it holding the command key and R but nothing, and then i tried holding the shift key and a bar appeared, and at half of the bar it sut itself down again.
    I think it is probably a preoblem because I may have cancelled some of the system files from a folder called "private" in the "documents" folder.
    Is there any way I can recover some of my files? maybe all of them? I hope so because I have some important files there
    Is this a thing I can do myself or do Ineed to go to a MacStore to repair it? Will I need to change HD or just to format it and reinstall? also if there is any way i can recover some of my files that would be great.
    Thanks
    Ludo
    P.S. problems appeared when i installed the Mavericks version.

    If MacKeeper corrupted the Recovery partition then even I underestimated its potential for damage. Garbage "cleaning" apps will cause misery but I have not found that the Recovery partition to have been affected by using MacKeeper or anything like it. I doubt that it did so, but I have learned not to underestimate the potential for such things to result in system corruption.
    Before concluding your Mac has a hardware failure, try booting OS X Internet Recovery by holding command option r on startup (three fingers). That will force your iMac to bypass the Recovery partition altogether, and convey the ability to create a new one.
    An Internet connection will be required (wired or wireless).
    At the Mac OS X Utilities screen, select Disk Utility. Select your startup volume (usually named "Macintosh HD") and click the Repair Disk button. Describe any errors it reports in red. If Disk Utility reports "The volume Macintosh HD appears to be OK" in green then you can be reasonably (though not completely) assured your hard disk is in good working order.
    Assuming the HD remains usable you can then use Disk Utility to erase it. Reinstall OS X, restore your essential software and other files, and don't reinstall the junk.

  • I can't connect to the itunes store. I have the latest version of itunes on my windows 7 computer. I can connect to itunes from my ipad and ipod but no my windows computer. i dont get any error message, the bar at the top just says accessing itunes.

    I can't connect to the itunes store. I have the latest version of itunes on my windows 7 computer. I can connect to itunes from my ipad and ipod but no my windows computer. i dont get any error message, the bar at the top just says accessing itunes

    Close your iTunes,
    Go to command Prompt -
    (Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
    (Win XP SP2 n above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
    In the "Command Prompt" screen, type in
    netsh winsock reset
    Hit "ENTER" key
    Restart your computer.
    If you do get a prompt after restart windows to remap LSP, just click NO.
    Now launch your iTunes and see if it is working now.
    If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
    Apple software on Windows: May see performance issues and blank iTunes Store
    http://support.apple.com/kb/TS4123?viewlocale=en_US

  • How do I start "rmiregistry" from Eclipse IDE?

    Could somebody tell me how I can start rmiregistry from the Eclipse IDE which is running j2se 5.0 ?
    Also if I try starting from the command prompt I get
    Windows cannot find rmiregistry
    with
    C:\>java -version
    java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
    Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

    You need a plugin to start/stop your rmi registry. Search for plugins in google.
    You need to set the classpath for starting the rmi registry from console.

  • Can't start up from 10.5 Install Disk, but can from MB Pro Install Disk?

    Many thanks in advance for your attention.
    1. I was going to Verify (and then maybe Repair) HD by starting up my computer from the OS 10.5 install disk, but my laptop just blacked out (froze) each time I tried to start up from the 10.5 install disk. I tried starting up holding down the "c" key, the "option" key, and the "shift" key.
    Each time my laptop just blacked out and froze. Odd as the 10.5 install disk has very rarely ben used and has no visible scratches, etc. I think I haven't used it since the original install.
    2. So I tried instead the original Install Disk 1 that came factory specific with the MacBook Pro (which also has 10.5 and iLife, etc. on it). Held down the "c" key and I was able to boot from the Disk (and do a Verify Disk, etc.). No problems at all.
    Anyone know what could be up with my OS 10.5 Install Disk? Is there a way to test if the Disk itself is somehow damaged?
    Thank you.

    Thanks again for your response.
    I am all for these forums in helping people out. I know some questions/ answers can't be all black and white.
    But - in the interests of clarity for others out there -
    1. Again, I was not trying to INSTALL from the 10.5 Install Disk.
    2. I was merely trying to insert it and use it to VERIFY my HD.
    3. I know one cannot do an "update" INSTALL from (for example) a 10.4 Disk if one already has 10.5 installed.
    4. But - through the incarnations of 10.1, 10.2, 10.3, 10.4 - I had always been able to use the OS X retail install disk (no matter how old) to check out my HD, even if my HD had (for example) 10.3.5 on it and my Install Disk was just 10.3.
    According to the link William posted, this may be different (I would guess on rare occasions), starting with Leopard.
    5. But, given my history through all the incarnations of OS X, I was puzzled when it seemed my laptop could not read my very unused, mint 10.5 OS Install Disk. A mystery. But when I washed a seemingly flawless disk, it worked afterwards. So something must have been on it I couldn't see.

  • How I can download mavericks OS from windows device and install it in my macbook air?

    from my mistake I formated my device (macbook air 2013) when i am trying to install windows by using boot camp
    and now i cant boot my device becuse it doesnt have OS
    how I can download mavericks OS from windows device and install it in my mac?

    hmmmm no need for windows device. simply hold down Command and R at start up it will install recovery HD and then u can install OS, for that u need a stable and good speed internet. so fist connect your Mac with internet and then start it by holding cmd and r after that it will do all the work.

  • HT1338 If I have OS 7.5 installed on an external drive, can I start up from the external drive in that OS when my macbook pro is 10.7?

    If I have OS 10.6 installed on an external drive, can I start up from the external drive if I have 10.7 installed on my macbook pro?

    Provided that the MBP supports booting from that version of 10.6, and the install was from a retail disk (not a different Mac model), then yes. If it's a newer Pro that came with Lion, it may not boot to 10.6.
    Matt

Maybe you are looking for