WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] XEN Java API Login/Logout Issues

To: <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] XEN Java API Login/Logout Issues
From: "Caruso, Joseph" <Joseph.Caruso@xxxxxxxxxxx>
Date: Mon, 16 Jun 2008 10:25:58 -0400
Delivery-date: Mon, 16 Jun 2008 07:26:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcjPvOUqSvNiKvgaQESVPEAnEZ8gWg==
Thread-topic: XEN Java API Login/Logout Issues

My application needs to login to Xen Server, perform an operation, and then logout.    Eventually, I need to login back in using the same connection.

Can I login/logout using the same connection object?  See the code snippet below.

 

Code Snippet:

 

Connection conn = null;

Session sess = null;

void initialize()

{

   try {

            // Make connection using username/password – THIS WORKS

            conn = new Connection(ipaddress, username, password);

            sess = Session.loginWithPassword(conn, username, password);

   }

   catch(Exception ex) {

      // Process Error

   }

 }

 

void  performOperation()

{

     try {

            // Application requires logout/login

            Session.logout(conn);

 

            //  Successful

             Session = Session.loginWithPassword(conn, username, password );

 

// The following line of code throws the exception.

            // XEN Exception: com.xensource.xenapi.Types$BadServerResponse [SESSION_INVALID, OpaqueRef:d8458e2f-cbd4-ed89-73df-fb03e303f908]

            // It seems that the Connection object is now longer valid

            Session.Record sr = session.getRecord(conn);

     }

     catch(Exception ex) {

     }

}

 

 

Thanks,

Joe

 

 

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] XEN Java API Login/Logout Issues, Caruso, Joseph <=