Can't connect to XenServer with libvirt Java bindings - xen

I'm helping to write a program that manages VMs remotely. When I try to connect to a XenServer machine to discover the hypervisor, I get a "Unable to connect: Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory" error. I've tried creating the cacert.pem file that it's looking for, but that doesn't fix anything. I've read that this certain error isn't accurately showing what's wrong.
This only happens when I use the Java bindings - I can successfully connect to the machine with virsh. I turned on debug mode for libvirt and tried to connect with both the bindings and virsh. The only major difference that I saw is virsh calling several virEvent type methods that libvirt doesn't do. (As I think about it, this may just be libvirt using my custom ConnectAuth class that doesn't prompt for a password)
Using:
libvirt 0.9.12 --with-xenapi
libvirt-java 0.4.7
I can't seem to find anybody else who has had this problem. Any help would be appreciated!

We ended up having to modify the Connect object in libvirt-java. The object was still valid, but somehow an error was being thrown. It's a messy hack, but we just ignore the certain error that is thrown and pass up the Connect object and are able to connect.

Related

How do I resolve an "Arg_NullReferenceException" error when trying to connect through CheckPoint VPN?

I use CheckPoint VPN to log in to my place of work's servers to work remotely. The VPN has been working (mostly) fine all year, and I haven't changed any of the settings, but this morning, when I tried to log in, it's giving me the "Arg_NullReferenceException." I can't seem to find anything on this particular error on google.
I have tried restarting my computer, because it's not the first issue I've had with CheckPoint VPN (though it is the first time I've seen that error message), and a restart usually resolves whatever issue I'm having. I've also tried creating a new connection with the same settings, but I'm getting the same error with that one, too.
I'm not entirely sure what other information I would need to provide. I'm also not sure if it's a problem on my end, or on the company servers. I have already emailed tech support, but I thought I should be thorough.
This is a known issue. I have been jumping through hoops trying to get the capsule client to work. Raise a ticket with TAC if you have support. If not then you can download the E86 Endpoint connect client and run it. That has been my work around for this issue.
They just issued an update to the Capsule via the Microsoft Store. It seems one of the recent Windows Security Update broke the L2TP protocol within windows.

QtMqtt error: TransportInvalid when connect

When I use QtMqttClient source code (download from officcal git repository) in my program On Windows PC, I got a error.
QMqttClient client;
client.setPort(1883);
client.setHostname("192.168.100.3");
client.connectToHost();
I received the following error message:
ClientState:Disconnected, ClientError:TransportInvalid
From the qt documentations, it said:
The underlying transport caused an error. For example, the connection might have been interrupted unexpectedly.
Then I copy the code to another pc with Windows, it worked fine. And worked fine on a Linux PC.
Is there somethings wrong on my computer or the Settings of Windows OS ?
After set breakpoint and add some debug code in my program , I found that the error was in QTcpSocket, the error was occured in the Qt network model lib.
As we know, Mqtt was baed Tcp,and in my program, the tcp can not establish connection,and err is QAbstractSocket::UnsupportedSocketOperationError, this confused me.
Then I search on google, I found a that someone encountered the same situation as me. And I found the solution here.
So, just add the code to the program before connect to server, the program worked well.
/* call before connecting to network. Easiest way is, just call somewhere at the beginning of the program */
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);

Disable internet access when calling java -jar

I'm testing six distinct .jar-files that all need to handle the possibility of no online access.
Unfortunately, I am on a network disc, so disabling the network connection or pulling the ethernet cable does not work unless I move all the files to /tmp or /scratch and change my $HOME environment variable, all of which I'd rather not have to do as it ends up being a lot of work.
Is there a way to invoke java -jar and disable the process from accessing the internet? I have not found any such flag in the man-pages. Is there perhaps a UNIX-way of doing this, as in:
disallowinternetaccess java -jar Foo.jar
Tell your Java program to access the network through a proxy. For all internet access this would be a SOCKS5 proxy.
java -DsocksProxyHost=socks.example.com MyMain
I believe that if no proxy is running you should get an appropriate exception in your program. If you need full control of what is happening, you can look into - and possibly modify - http://jsocks.sourceforge.net/
See http://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html for details.
Note: You can do this without any native Unix stuff, so this question fits perfectly fine on SO.
You need just turn on SecurityManager: -Djava.security.manager=default
see details - https://stackoverflow.com/a/4645781/814304
With this solution you can even handle which resource you want to show and which to hide.

phpseclib - SSH_AUTH_SOCK not found

I work with another company that is moving from regular FTP to SFTP for their connections. They have informed me that my existing username and password are the same, but that I now need to connect via SFTP on port 22. I have a couple of PHP scripts that do some basic things, like connect to their site, get a directory listing, and upload and download a file each day. Those all work fine on FTP, so I need to just swap out the protocol to SFTP.
After doing some research, the consensus seems to be that phpseclib is the easiest and most robust way to perform SFTP using PHP. My server is running Linux and Apache. I downloaded the library and tried to run just the basic example given by phpseclib, but I get an error:
Notice: SSH_AUTH_SOCK not found in System/SSH/Agent.php on line 244
When I look at Agent.php, I see that the script is looking for SSH_AUTH_SOCK to be defined in either $_SERVER or $_ENV. I must be missing something obvious, but I have no idea how to get past this error.
You are trying to connect to SSH authentication agent (ssh-agent).
When the agent is run, it exports the SSH_AUTH_SOCK environment variable.
What is obviously not happening in your case.
But you didn't tell us, why are you trying to use the agent, if at all. And what did you do to set it up, if anything. So it's difficult to give you a more concrete advice.
See also How is SSH_AUTH_SOCK setup and used by ssh-agent?
Run the bellow command:
eval ssh-agent -s
It works fine for me.

Oracle 11g Express error: ORA-12505, TNS: listener does not currently know of SID given in connect descriptor

I am facing problem with Oracle 11g Express hosted on Linux Centos 6.4. This server is relocated from one place to another, this relocation changes the IP of server.
We have changed the IP in tnsname.ora and listerner.ora files. After these changes when we are trying to connect to database instance from server we are getting error “Connected to idle instance”. If we are trying it to connect from client using SQL developer we are getting error “Status : Failure -Test failed: Listener refused the connection with the following error: ORA-12505, TNS: listener does not currently know of SID given in connect descriptor”.
We have restarted this server and database multiple time (through option Start and Stop database under Oracle menu) multiple time, but still we are getting the same error.
Request you to please help to resolve this issue.
The local connection via sqlplus user/passwd (as opposed to sqlplus user/passwd#TNSALIAS) is not impacted by IP address or by contents of tnsnames.ora. It also does not require a listener at all, the listener could be stopped or not defined at all in listener.ora. In other words, you did something wrong here.
My guess is that you are mislead into thinking that you've started the database, when in fact it is not started. Check if you have a process called ora_MYORACLE_pmon.
Also the file tnsname.ora is irrelevant; Oracle only checks tnsnames.ora.
we resolved this issue, actually we were missing server address in some files it was still referring old address.
initXE.ora missing local listener parameter, then we added this parameter to it and it start working.
May be this is not the generalise solution but it work in our case.
This behavior is expected if the listener was originally configured with an ALTER SYSTEM command like ALTER SYSTEM SET LOCAL_LISTENER=''; and that command specified the SCOPE=MEMORY option or if the SCOPE is left to default and the database was started with a pfile.
To fix it, reissue all ALTER SYSTEM commands from before the restart. Or at least one that identifies the LOCAL_LISTENER. And set SCOPE=BOTH.

Resources