[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: <xen-api@xxxxxxxxxxxxxxxxxxx>
  • 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
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
  • 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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.