How to close connection to GraphicsEnvironment / x-server

Hello all.
I have a long-running terminal-application which has a command to bring up a (swing) gui to monitor current execution state. The gui can be closed but the application will keep running.
This application is running on a remote server, and I am running it from my local machine through ssh. (All of this is happening on Linux)
Now, in order to be able to close the ssh connection without having to exit the running application I am using a software called screen that allows me to detach the process from the terminal. I can then logout from the ssh session without killing the process. Unfortunately this only works until opening the GUI, because once I did that the ssh connection cannot be closed anymore without exiting the application.
Note that even closing the GUI (i.e. calling dispose on the JFrame that carries it) does not help. After some trying around I found that as soon as I instantiate any gui components - without even showing them at all - the problem occurs. E.g. the code below reproduces the problem.
import javax.swing.*;
public class Main
     public static void main(String[] args)
          new JPanel();  // commenting this out stops the issue from reproducing.
          while(true) 
               // This is where the application is still doing stuff. I have closed the gui, and want to log off now.
               Thread.yield();
}I discussed this on LinuxQuestions.org and you can find the link to the thread below. It also contains additional background information on my question.
http://www.linuxquestions.org/questions/showthread.php?p=4894628#post4894628
Based on this discussion my current assumption is that as soon as any swing components are instantiated the class sun.awt.X11GraphicsEnvironment comes in and starts to make a connection to the X-Window server. The main reason why I believe that it's that particular class is that I am getting the following exception when I try to run the above code without enabling x11 fowarding in the ssh connection.
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:112)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.Toolkit$2.run(Toolkit.java:849)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
        at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:121)
        at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1564)
        at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:147)
        at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1599)
        at javax.swing.UIManager.setLookAndFeel(UIManager.java:530)
        at javax.swing.UIManager.setLookAndFeel(UIManager.java:570)
        at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1320)
        at javax.swing.UIManager.initialize(UIManager.java:1407)
        at javax.swing.UIManager.maybeInitialize(UIManager.java:1395)
        at javax.swing.UIManager.getUI(UIManager.java:991)
        at javax.swing.JPanel.updateUI(JPanel.java:126)
        at javax.swing.JPanel.<init>(JPanel.java:86)
        at javax.swing.JPanel.<init>(JPanel.java:109)
        at javax.swing.JPanel.<init>(JPanel.java:117)
        at Main.main(Main.java:7)This is also why I posted this question in this category, I hope this was appropriate.
I think that in order to be able to close the running ssh connection gracefully (i.e. without killing my application in the process) I have to find a way to close this connection to the X-Window server in the java application.
Could anybody enlighten me how to tell the JVM to cut the connection to the x-server? Or, obviously, let me know if I am on the wrong track :-)
Many thanks in advance either way.

you can continue with :
     try {
     objFolder.open(Folder.READ_WRITE);                    
     } catch (MessagingException me) {
          objFolder.open(Folder.READ_ONLY);
Messages[] msgs = objFolder.getMessages();
     FetchProfile objFP = new FetchProfile();
     objFP.add(FetchProfile.Item.ENVELOPE);
     objFP.add(FetchProfile.Item.FLAGS);
     objFP.add("X-Mailer");
     objFolder.fetch(msg, objFP);
// close down
objFolder.close()
store.close()

Similar Messages

  • How do I connect to a terminal server with my mac book pro

    How do I connect to a terminal server with my mac book pro

    Use the Remote Desktop icon on the tray and make sure to use the Fully Qualified Domain Name (FQDN) on the 'name of server' field.  If that does not work then use the IP address to connect.

  • How can I connect to a windows server from a mac book pro

    How can I connect to a windows server from a mac book pre?

    I have a Dell Power Edge T110 ii in the office that has files and software I need to access when away from the office, when I am on the road I use a mac book pro and an iPad.
    I am sorry if I am being a bit vague but this is all new to me, I have tried 3 IT guys but they can not find a way.
    Any help is greatly appeciated.

  • How can I connect to a UNIX server to execute a command?

    How can I connect to a UNIX server and execute a command using PowerShell? My shell script is sitting on one server, while the UNIX box is on another.
    also, I don't like the idea of hardcoding a username/password within the script file in order to do so.
    -Nothing to see. Move along.

    You will need a library to handle SSH connections.
    I'm using SSH.NET, you can find info on it here : http://www.powershelladmin.com/wiki/SSH_from_PowerShell_using_the_SSH.NET_library
    It has a bit of a learning curve but the web site has some fairly good tutorials.

  • How to close connection to mail server?

    hi and good day all.
    how do i close a connection to a mail server?
    this is how i connected to one:
         try{
                   props = System.getProperties();
              session = Session.getDefaultInstance(props, null);
              store = session.getStore("pop3");
              store.connect(host, user, password);
              System.out.println("Opening inbox "+ user + " at " + host + "...");
                   folder = store.getDefaultFolder();
              if (folder == null) { //throw new Exception("No default folder");
              System.err.println("No Default Folder Available.");
              folder = folder.getFolder("INBOX");
              if (folder == null) throw new Exception("No POP3 INBOX");
              folder.open(Folder.READ_WRITE);     
    please.help...
    thanks.

    you can continue with :
         try {
         objFolder.open(Folder.READ_WRITE);                    
         } catch (MessagingException me) {
              objFolder.open(Folder.READ_ONLY);
    Messages[] msgs = objFolder.getMessages();
         FetchProfile objFP = new FetchProfile();
         objFP.add(FetchProfile.Item.ENVELOPE);
         objFP.add(FetchProfile.Item.FLAGS);
         objFP.add("X-Mailer");
         objFolder.fetch(msg, objFP);
    // close down
    objFolder.close()
    store.close()

  • How can i connect to a SQL Server 2000 database usgin JSP?

    I need (URGENT) to connect to SQL Server 2000 databse using JSP. I do not know how to program using JSP, so if anyone has any code snippet please let me see it. What i need is to give my site some login/password security.
    Anyone?
    Thx.

    just create an ODBC of your database from control pannel -> administrative tools -> data sources (ODBC) ,double click it .....
    go to the tab SYstem DSN , click on ADD button. select the driver for your connection. it will be the last one in the list "SQL Server".
    click Next then give ur DSN name there, description and Server Name , on next give your username and password of SQL server. when it will be connected to the server celect your database from there and hence there will be an ODBC bridge same as in case of MS Access.
    code for connecting to ODBC is
    // DSN-NAME same as in System DSN.
    // username and password are of your databse
    try
              url = "jdbc:odbc:DSN-NAME";
              Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
              connect = DriverManager.getConnection( url,"username","password" );
              catch ( ClassNotFoundException cnfex ) {
                        setErrorMsg( cnfex.getMessage() );
              catch ( SQLException sqlex ) {
                        setErrorMsg( sqlex.getMessage() );
              catch ( Exception ex ) {
                        setErrorMsg( ex.getMessage() );
    Now you are connected to the SQL Server ..... use connect object for further processing .........

  • How to close connection iBATIS

    hi ,
    we are using iBATIS for our application.Alhough iBATIS closes its connection on its own ,still we have certain open connection from our application which is causing issues while running the application.we are able to make connection using JDBC with Oracle thin driver in iBATIS but while establishing connection using JNDI and connection pooling it keeps connection open in database and sometimes gives out of memory error as connections are not getting closed properly.
    SqlMapConfig.xml we are using for JNDI is :
    <transactionManager type="JDBC">
    <dataSource type="JNDI">
    <property name="DataSource" value="jdbc/DataSource_Dpps" />
    <property name="JDBC.DefaultAutoCommit" value="true" />
    <property name="DefaultAutoCommit" value="true" />
    <property name="SetAutoCommitAllowed" value="true" />
    </dataSource>
    </transactionManager>
    Can any one suggest how to overcome this issue and how to close the connection in iBATIS explicitly while using JNDI and how to specify connection pool size(if any) .
    Regards,
    Anika

    TopLink and iBATIS are generally alternative solutions. Since you are posting on a TopLink forum the best I can suggest is that you consider replacing your usage of iBATIS with TopLink.
    http://www.oracle.com/technology/products/ias/toplink/index.html
    Besides that I would recommend filing a bug or starting a discussion on the iBATIS forum.
    Doug

  • How many concurrent connections that an ACS server version 4.2 latest patch can handle?

    I have about 50 routers and layer-3 switches that autheticate via tacacs+.  The AAA server used to be on a Linux machine running open-source tacacs+ built by me.  I have a perl script that will log into all 50 devices at the same time to collect statistics.  This script is multi-threaded.  Everything is working fine so far.
    I recently out-sourced the AAA function to a 3rd party company, not by my choice.  The 3rd party uses Cisco ACS version 4.2 with the latest patch running on Windows 2003 Enterprise Server with 16GB RAM and quad processors with quad-cores, IBM x3650-M2 hardware. The connectivity between the 3rd party and my company is through a DS-3 connection.  Maximum bandwidth over this DS-3 connection is less than 10Mbps at most.
    I noticed that for the past 3 months I have multiple failures with this perl script due to authentication failure with the ACS server.  If I just run the script again a few routers/switches, there are no issues; however, whenever I started the script to log into 50 devices all at the same time, it will fail.  If I made the configuration on all routers/switches to point back to the old open-source tacacs+ server, the issue goes away.  The minute I switched back to the
    new ACS server, the issue came back.  If I modified the script to hit one device at a time, it works fine.  I think it is the ACS server can not handle a lot
    of AAA requests at the same time.
    Does anyone know how many concurrent connections that an ACS 4.2, with latest patches on Windows 2003 Enterprise Server with lot of memory and CPU power, can handle?  I can't seem to find this anywhere on Cisco website.
    Thanks in advance.

    No, Im not saying ACS cannot cope.
    Concurrency and latency are very different things. ACS CSTacacs can handle many 100s of simple authentications/authorisations per second with users in the internal database. If 1000s of devices all send traffic in the same instant it would take some seconds to work through the backlog of traffic.
    Also, worth considering that a limited number of tasks within ACS (or threads) can actually handle a much greater number of "logins" because they are generally multi-message allowing ACS to keep lots of plates spinning.
    If users are in an external databases the latency (per authentication) can increase depending on where the users are (eg Windows AD) and if bad enough can have a serious effect on the overall authentication rate. At which point customers normally turn to load balancing.
    If your device timeouts are 20 seconds (totally reasonable) I suggest the issue is more likely to be something else... a bug, perhaps specific to v4.2?

  • How to use connection pooliing in welogic server

    How to use connection pooliing in welogic server

    Ummmm, once you have an open connection to something, you add it to a pool so the next time you need to connect to it, you don't have to redo all of the overhead of creating the connection.
    :-)

  • How do I connect to an SMTP server that requires a username and password?

    Hi,
    I am currently working on a project for university which requires me to send and receive email. I was until this week able to send mail no problem, but now the SMTP server has been upgraded so that each time a mail is sent it requires the username and password.
    Ideally the connection should be made using TLS/SSL, and not use the Authenticator method. I want to pass the username and password directly if possible.
    I've been trying to use the following but have been getting handshake, and other exceptions:
    SMTPSSLTransport smtpSSLtransport = new SMTPSSLTransport(session,
                        new URLName("smtp", smtpHost, port, null-File,
                        "USERNAME", "PASSWORD"));
            smtpSSLtransport.setStartTLS(true);
            smtpSSLtransport.connect(new Socket(smtpHost, port));
            smtpSSLtransport.sendMessage(smtpMessage,                                                     message.getAllRecipients());
            smtpSSLtransport.close();Can anyone correct this piece of code for me or point me in the right direction of what classes and methods I should be using?
    Many thanks in advance,
    Gordon

    I always wonder what misleads people to do things this way.
    Was there some example you saw that suggested that instantiating
    an SMTPSSLTransport was the correct approach? I hope not.
    See the smtpsend.java demo program for how to use SMTP
    authentication. If you need to use SSL, see the SSLNOTES.txt
    file for hints on using the "smtps" protocol. smtpsend.java also
    illustrates use of SSL, but you'll need to fix a bug in it to use the
    correct property names ("mail.smtps.auth", etc.).

  • How do I connect to an SQL Server Database from CR XI?

    Hello All,
    I posted previously to this forum but did not get any response. There surely must be a way to connect to SQL Server from CR XI? My problem is that I keep on getting prompted for a PW or get a message saying "Logon Failed"
    Please see my earlier post, with code sample, on Page 4 (or now 5 or 6 .....)
    "How to log on to SQL 2000 programmatically using VB6 RDC and CR XI "
    I would really appreciate a response from someone as I need to get some pressing work finished for a client.
    Thanks so much in advance
    Peter Tyler

    This shoul dbe posted to the Legacy Development forums

  • How can i connect to a Database Server (live data)?

    hi,
    i'm trying to figure out how i can create a dashboard that's connected to live data coming from a Database server.  i have the username and password and the DB name, but can't find a direct way from within SAP dashboard design where i can make the connection.
    MUST i go through XML?
    i know other tools like Tableu that allow direct connections to the server.
    is this possible?

    Hi Sam
    Please refer to the tutorial http://scn.sap.com/docs/DOC-7946 and under "Connecting to Data Sources" section you will get the step by step guidance of various data connectivity options..
    Basically the options available under Data > Connections > Add and Query Browser in Dashboards 4 are your options.
    If you want to write direct SQL to get data you have to use add-ons InfoBurst like InfoBurst infosol.com/solutions/infoburst/
    Runali

  • How to change connection port between INTEGRATION SERVER and Adapter Engine

    Hi,
    I have scenario that in the productions server we are using SAP web dispatcher to connect to Adapter Engine for example the port is 60000.
    So when we copy this server to DR environment the webdispatcher is not there. is that any way to change the all connection port between IS and Adapter from 60000 back to original port 50000 ?
    Please advise ?
    Thank You and Regards
    Fernand

    HI,
    The waiting status is because of Message Queue is in wiating status. This may be because of overload of the messages, or may be your receiver systems is not ready  etc.
    SO go to SMQ2 and check the status of the queues.
    Also have a look into this blog-
    /people/sap.user72/blog/2005/11/29/xi-how-to-re-process-failed-xi-messages-automatically
    <i>
    Why I can see this messages only in the integration server?</i>
    >>>If message reachs the Adapter engine, you can see in the Adapter monitor. In your case, message is still there in the Integration Engine. Once the queues are cleared it will reach the Adapter engine, so you can monitor it in the adapter engine
    Regards,
    Moorthy

  • How do I connect to a SQL Server DB?

    I have a menu designed in Flash which has to pull back
    database records, how do I go about that? Every tutorial seems to
    be different and none are exactly what I am looking for.
    thanks
    Em

    Very true. This is a wide open field of decisions you have to
    make.
    First choice you have is sending via URL variable encoding or
    XML. That will define your tasks needed in ASP. As well would you
    want to simply (most beginners would) just have the ASP send the
    URL variables or XML with Response.write or are you planning a web
    service type of app.
    For Flash you will find the examples in the docs are all you
    need to get the data from the ASP and send back if necessary. Still
    the choices depend on the server (ASP) choices.
    For URL Encoding from ASP:
    LoadVars.load
    For URL Encoding to and from ASP:
    LoadVars.sendAndLoad
    For XML from ASP:
    XML.load
    For XML to and from ASP:
    XML.sendAndLoad
    For overall details on data integration
    Many folks like using the Flash 8 Pro DataGrid component for
    a quick UI to display a SQL select result. You would populate it
    using
    DataGrid.addItem.
    You can also bind the DataGrid to data providers such as an
    array so it updates when the data source changes.
    You also can use many of the Flash 8 Pro UI components in a
    data integration that binds them to a data connector component:
    FLash
    8 Pro data binding component approach. You should review
    Data
    Integration in the Flash Docs for this approach.
    If you need some decisions:
    1. Select a scripting language: ASP, PHP, ASP.Net, JSP, Perl,
    ColdFusion
    2. Select the database: mySQL, SQL Server, Oracle
    3. Decide how you want to send data to and from Flash (XML,
    Url variables, Web Services)
    4. Write a server script that can do the database work you
    want and just use html forms to prove those scripts out.
    5. Look up the docs in Flash for #3 and do the Flash UI.
    You might see from this that Flash or HTML would work with
    the same server scripts.

  • Home sharing problem: How can I connect a NAS iTunes server to Apple TV 2?

    I have a NAS (network attached storage) that has an iTunes server and I can see the music that I have on that NAS when I open my iTunes on my computers. However, I was wondering if there is a way to add that NAS/iTunes Server to my Home Sharing and not have to turn my computer ON every time.

    the short answer is no.
    the itunes server on your NAS is a pseudo (fake) itunes instance.
    you need a real instance of itunes (that has HomeSharing), and that means itunes running on a pc/laptop.
    you can use your NAS as the storage location for itunes, but appletv cannot connect direct to the NAS.

Maybe you are looking for

  • Add a search function to my online PDF Portfolio?

    Hi there, I'm wondering if it's possible to add a search function that searches for keywords within all the documents in my online PDF Portfolio, like there is in the standalone desktop version. I want to make the PDF's available online but a key fun

  • APEX Security Integration To E-Business Suite

    Hi all, I am reasonably new to APEX and the Forum so please excuse me if this question has been posted previously. I am looking at creating applications that leverage the user and organization security that is inherent within E-Biz Suite to control a

  • Barcode Issues in Printer

    Hi All, We are using SMARTFORMs to print barcodes. The printer is HP 4350 . When we are printing in Our Development System the Barcodes Prints and the Print Preview are coming out fine . But in our Quality System the barcode Print previews as well as

  • Update to MUSE CC to MUSE CC 2014 ... IS DIFFERENT?

    Hace un año compré la versión  Creative Cloud single-app membership for Adobe Muse (one-year), pero ahora cuando quiero abrirla me dice que tengo que actualizarla, lo hice por la versión CC 2014 pero es versión "DEMO"...no estoy pagando por tener el

  • Glitch, pop and stutter... just another bowl of cereal!

    Well my friends this is my first post here and I am in need of some serious help! Ok, for the past week I have spent time trying to narrow down this problem I have with Logic. I use Logic for the purpose of softsynths and up and till this point I hav