ConnectException after a few times of start/stop

I've made a serverUI where I want to start/stop my server. It works to start it, stop it and start it again. But when I then want to stop it I get a ConnectionException. Any ideas?
Here's some code.. (I'm using 1.1.8)
I do this once at startup:
try
     Runtime.getRuntime().exec("rmiregistry");
catch(Exception pException)
     System.out.println(pException);
     pException.printStackTrace();
I do this to start the server:
try
     Runtime.getRuntime().exec("java -classpath .;C:\\jdk1.1.8\\lib\\classes.zip;\\jdk1.1.8\\lib\\comm.jar -Djava.rmi.server.codebase=http://"+InetAddress.getLocalHost().getHostAddress()+":8080 -Djava.security.policy=policy bentrix.solarPower.server.SunControlImpl");
     mServer = (SunControl)Naming.lookup("//"+InetAddress.getLocalHost().getHostAddress()+"/SunControlServer");
catch(Exception pException)
     System.out.println(pException);
     pException.printStackTrace();
I do this to stop the server (with a delay and then System.exit in the server):
try
     mServer.terminate();
catch(Exception pException)
     System.out.println(pException);
     pException.printStackTrace();
I end up with this exception... I've tried putting in delays but that didn't help. I've watched the processes and the first time mServer.terminate() really removes the server. And it works to start the server again. But when a new try to stop the server is made it fails! It does works to connect from the "real" client even now so nothing is wrong with the last start of the server.
java.rmi.ConnectException: Connection refused to host: [212.214.64.210:4134]; nested exception is:
java.net.ConnectException: Connection refused
java.rmi.ConnectException: Connection refused to host: [212.214.64.210:4134]; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPChannel.openSocket(TCPChannel.java:276)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:143)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Compiled Code)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:60)
at bentrix.solarPower.server.SunControlImpl_Stub.terminate(SunControlImpl_Stub.java:845)
at bentrix.solarPower.serverUi.SunControlServerUI.stopServer(Compiled Code)
at bentrix.solarPower.serverUi.SunControlServerUI.actionPerformed(SunControlServerUI.java:211)
at java.awt.Button.processActionEvent(Button.java:249)
at java.awt.Button.processEvent(Button.java:222)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
Any better way to start/stop the server please let me know!

Oops! I fixed this by doing Naming.unbind() in the server when I shut it down. But I still have to watch very careful in the task manager when I do the start/stop by pressing a button in the serverUI because if I do start before the server has been killed I get the same exception! Is there a good way to know that the process has terminated or do I just have to disable the button for a little while?

Similar Messages

  • When playing music from Ipod in my car, music suddenly stops and message appears to restore in iTunes.  After a few minutes, it starts to play again.  I hear a click and the apple logo shows on the screen.  Any ideas??

    When playing music from Ipod in my car, music suddenly stops and message appears to restore in iTunes.  After a few minutes, it starts to play again.  I hear a click and the apple logo shows on the screen.  Any ideas??

    You may need to do a Restore in iTunes.
    Clicking sounds from an iPod that has a hard drive is probably not a good thing.  It is possible that your iPod's hard drive is becoming unreliable.

  • Delete uid.run each time when start/stop grpwise daemon

    hi,
    SLES 11 SP2 x64 + GW2012 all component installed as root, I need delete uid.run file each time if start/stop grpwise daemon, other dev/poa/mta will fail or unused.
    the uid.run is contain root, may I know how to avoid to delete this file each time?
    Thanks...KEN

    lywwing,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://www.novell.com/support and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Forums Team
    http://forums.novell.com

  • IChat disconnects after a few seconds and starts to blink the whole screen

    iChat disconnects after a few seconds and starts to blink the whole screen
    this started since I installed Leopard; if I go back to 10.4 it works OK. I got rid of all the plist and it still hangs up. How can I uninstall this. On my laptop it works OK but I installed it with complete erase on laptop; on my desktop I stalled it over the old system.
    error message AIM time out An AIM service error occurred.
    Error: Serv:RequestTimeout
    and you have attemptedto log too often in a short period of time. wait a few minutes before trying to login in again.
    EVEN THOUGH I ONLY TRIED ONCE TO LOG IN.

    If you Archived and Installed then check iChat launches from the Applications Folder.
    If it does that Drag the current (iChat 3) icon off the DOCK and drag iChat 4 to the DOCK.
    8:03 PM Tuesday; December 4, 2007

  • TS3989 Every few days I need to sign out of iCloud to enable photos to upload to the stream, then after a few days, uploads just stop. Whe I went to the mac store the other day, the tech said that if it happened again I wo

    I am having problems with photo stream. Every few days I need to sign out of iCloud to enable photos to upload to the stream, then after a few days, uploads just stop. Whe I went to the mac store the other day, the tech said that if it happened again I woould need to talk to a tec in the photo stream server area. How do I do tha?

    You would probably start here: http://www.apple.com/support/icloud/contact/.

  • Having big problems with my new Mac Pro, when I launch Photoshop CC, I get an error message, can carry on but after a few tasks it starts going gar... menus go blank, when you try to save it shows a blank box.... can anybody help?

    Having big problems with my new Mac Pro, when I launch Photoshop CC, I get an error message, can carry on but after a few tasks it starts going gar... menus go blank, when you try to save it shows a blank box.... can anybody help?

    when I launch Photoshop CC, I get an error message
    and what exactly is the text of that error message?

  • Adobe audition cc crashes after a few times of recording(please help)

    Okay so Adobe audition is incredibly useful or should i say WAS... It was great until one day it just crashed after a few times of recording. I just thought maybe something went wrong whatever ill re do it. But no.. for months ive been trying, uninstalling and reinstalling, updating, closing all other programs running but nothing has seemed to do it. Audition is really important to my music career and lately i havent been able to do anything because it doesnt work. Im begging, can someone PLEASE try to help me, im desperate.
    heres a pic of what happens when it crashes:

    I notice from the picture that you have four files in the middle of processing. Do you remember what they were doingwhen the crash happened? Were they saving or did you have some effects processing going on?
    Also either Audition or Windows may have saved a crash report somewhere which could help to diagnose the problem. I am not sure where they may have been saved but others might remember where to look for them.

  • I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR

    I just stared having problems with importing files from nikon D810 into LR 5.7 it pop a window saying it can not read files on working on a imac 27" running yosemite on my mac pro after a few times it finally was able to read files and import them into LR I never had this problem before was there some kind of update that could of cause this?

  • Unable to bootup after Yosemite install. have to keep shutting down from rear button. it does come on after a few times but then hangs at user login again. If you get in it is great. Seems faster than Mavericks but there is some sort of issue, bouts

    unable to bootup after Yosemite install. have to keep shutting down from rear button. it does come on after a few times but then hangs at user login again. If you get in it is great. Seems faster than Mavericks but there is some sort of issue, bootup /login.

    Knock on wood, this seems to have been my problem as well.  I stumbled on this thread after dealing with this ridiculously-long boot times for the past several weeks.
    I just reinstalled McAfee Antivirus and my Macbook Air booted up in less than 1 minute.  No more hanging on the boot-up progress bar.  No more hanging after I click on my user's avatar on the log-in screen.  Bootup would often take 5+ minutes and sometimes never complete.
    This has been SUPREMELY frustrating.
    THANK YOU SO MUCH FOR POSTING YOUR RESPONSE!!!

  • X220t does not boot anymore after a few times running, does not get past BIOS

    I just bought a x220t and want to use it with Win8.1. I had before upgraded my x201t to win8 with no problem at all.
    After a few succesfull runs in wich I do the patching it stops booting completely. I can't even push F8. It will only go to Bios in witch I have fidled a bit, but nothing works. I have tried a fesh install for three times. It does boot an USB DVD drive with the origiganal win 8.1 disk, but it can't fix my problems.
    I have an I7 version whith Intel 160GB ssd. I did a lenovo check, all clear, I dit an Intel SSD check, all clear. Unfiortunatiely I have delated the restore partition. I am on the latest BIOS (1.39)
    Sometimes I get in to the Lenovo boot menu, with no result. I want to rip out my hairs!
    Any help?

    Hi thomas1921,
    Not an answer to your specific question, but I'm very surprised that a BIOS update would break DVD booting. Have you tried pressing F1 at boot to get to BIOS Setup and examining / changing the boot order? Or pressing F12 at boot to select the boot device? (Think the F12 feature must be enabled in BIOS Setup.)
    Results of Your Ideal Business-Class Laptop survey, concluded 2009-07-29.
    Did someone help you?
    Say thanks! with a kudo.
    Even better: Pay it forward, help someone else.

  • Playback gives black screen after a few times

    Hi!
    This is my problem. I just installed Adobe Premiere CS6. After trying it a few hours the program has allready frozen a dozen times and unexpectedly quit a few times. Is there some major bugs in the CS6? (One of the recurring problems is the playbutton in the playback window to stop responding. Nothing happens when I click it) Also, I can't find the adobe upater anywhere on my computer, but once in a while it opens atuomatically so it has to be here somwhere. Where is this program located and how can I manually check for updates?
    But, the biggest problem is this: when I add a clip to the timeline it first plays back just fine. But then, after adding another clip to the timeline, or a few minutes later, it suddenly doesn't playback anymore. It plays the sound, but the window is just black. The only way I've been able to get the picture back is by restarting the entire program.
    I'm very new to Premiere Pro, has up until now only worked with InDesign and Photoshop so it might just be something I'm not understanding how to do but it seems like very strange behaviour to me.
    I work on an iMac with OS X 10.7.5
    Adobe Premiere (6.0.0 (319 (MC: 264587))
    Help would be much appreciated!
    Thanks!

    I just tried to install Premiere on my new MacBook Pro as well but I'm still not able to playback the picture. The sound works but the playback screen is completely black.
    MacBook Pro (Retina) OS X: 10.8.2.
    Adobe Premiere Pro CS6: Version 6.0.2 (072 (MC:264587))
    Source Footage: Quicktime (56 gb in one file): Apple ProRes 422, Linear PCM, Timecode.
    I also have some smaller clips in this Quicktime Codec: H.264, Linear PCM.
    No error messages. Sometimes the program just freezes and I have to force quit it. Or it just won't playback.
    It was a entirely fresh install of the software. I'm a member of adobe cloud so I downloaded it from the application manager.
    I'm also running photoshop and inDesign which are working just fine. At the time i launched Premiere no other Adobe programs where running. Just programs as: textedit, mail and evernote.
    No third-party codecs installed.
    Tried to update Premiere with the latest updates but that didn't do any difference.

  • HP G62 Shutdown after a few seconds from start up

    Hello, I have an G62 laptop with amd processor. The problem I experience is the following: the laptop starts and after a few seconds (it does not make it to windows loading screen) shuts down without any warning. It does not overheat, the cooler works properly and it is clean. Dont know if the HDD works properly, doing a self check is not possible. 

    Hi Viper_com,
    Welcome to the HP forum!
    Thank you for your query, I will do my utmost to help.
    I understand that you have an auto shutdown issue.  Here is a link to Troubleshooting an Overheating and Auto Shutdown Issue.
    You can also run the diagnostics on the computer. On startup, press f2 approximately once every second to enter the bios.  You should be able to choose diagnostics as an option.  Please let me know the outcome.
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

  • After a few times VB shows white or black page

    Hi,
    I used the demo program  BI_GUI_SAMPLE1.
    The program start initially with a good screen.
    after about 6 times i get a white screen, or black screen or nothing.
    Like the picture blow. The programm is running but doesn't show a map.
    I copied the program, made some modifications but i can't get it working.
    I need to close all sessions and SAP-GUI.
    Starting again, it works for 6 times.
    Maybe helpfull:
    I can't get the WebDynpro version working due to ACF problems.
    Does anybody know how to fix this?
    Best regards
    Maarten

    Hello Maarten,
    please update to the latest version VB2.1 PL4 released wednesday. The prior version had some serious resource leaks which might cause your issues.
    In order the get the WD version running with ACF please check this article as a starting point:HowTo setup Visual Business Native Client.
    Best regards,
    Uwe 

  • Mail App delete rules after a few time

    Hi,
    Every time i write a rule in Mail app, it disappear a few minutes after and only the default Apple rule keep living.
    Someone have the same problem ?
    Another icloud sync issue ?
    Any fix ?
    Thanks.

    This started happening to me only recently.  Same hardware, no OS update - most obvious thing I'd changed recently is that I'd gone from having one (enabled) mail account to two.  Previously it was just one Exchange account, and the new account is a Google IMAP account.  I'm going to test to see if the problem goes away when I disable *either* of them (suggesting the problem is in how Mail.app handles multiple enabled accounts) or if I must specifically disable the Google IMAP account (suggesting the problem is specifically in how Mail.app handles Google and/or IMAP).

  • Firefox will not work after a few times of working

    firefox will not start after you start it a couple of times.
    == This happened ==
    Every time Firefox opened
    == when i got the latest upgrade

    triggering two rollovers and no rollout , how this possible ?
    as i say the problem fixed when i delete sparkle mc from my hover frame , and i dont see any unusual thing in this clip , it just some star graphic rotating and one gradient circle to fade ( nested layers ) with no script.
    i can ignore this movieclip but i`m really Curious why and how a movie clip in my button can do something like that .
    i dont have info about trace but when i write :  trace (animOut);  in my script , after compile the function Function() {} message apear in output window .
    i search around and i only found those script i write here and 3 stop(); for my buttons , nothing more , so how could possible to triggering two rollovers and no rollout ?
    can i attach this little fla file for you . it will be great . thanks .

Maybe you are looking for

  • ( Additional ) Bad Quality : Photos Imported from iPhoto6 to iMovie 6

    Although imovie 6 is caught up with a sum of disadvantages of imovie 5, I observe a new disadvantage which did not exist before. With knowknowing: In the "multi-media" mitre + "photographs", when I import a photograph from iphoto, I observe that the

  • Restoring Contacts by using OviSync

    Hi all, I just got my phone from Nokia center due to unable to register SIM problem. It has been fixed. Before I send my phone to the Nokia center, I've created (1st time) Ovi account and sync my contacts in my phone to my Ovi account. (Note that I d

  • Cant load any photos in to Elements 12

    Help please.  When I turn on Elements 12 (and for that matter Elements 5 also) I get an error message reading:  Could not import clipboard because an unexpected end-of-file was encountered.    I cannot open any photos.  Any help gratefully received.

  • Always in black

    I cant find any colour changes from black, I looked in Jim's book and in help. I am very new to using expression web 4  after 12years using  FrontPage with my  personal site, I can copy and paste in colour and colour the background but cant find colo

  • ITunes freezes when trying to restore ipod

    Hi guys At the moment whenever i plug my ipod in itunes says it is in recovery mode and needs to be restored. Once i restore it and the ipod resets though, itunes freezes completely and wont shut down from task manager. To open it again I need to res