[ovirt-users] ovirt java sdk: Port is invalid

David David dd432690 at gmail.com
Tue Apr 26 07:45:17 UTC 2016


code correction:
In URL variable , using server name, which matches with certificate, not
address.

2016-04-26 10:29 GMT+03:00 David David <dd432690 at gmail.com>:

> hi.
>
> I have a remote server running with oVirt 3.5
>
> I'm using ovirt-engine-sdk-java-3.5.1.0-1.fc20.noarch.
>
> there is code example:
> my app:
> =====================
> package lab01;
>
> import java.io.IOException;
> import java.util.List;
> import java.util.UUID;
>
> import org.apache.http.client.ClientProtocolException;
>
> import org.ovirt.engine.sdk.*;
> import org.ovirt.engine.sdk.decorators.*;
> import org.ovirt.engine.sdk.entities.*;
> import org.ovirt.engine.sdk.exceptions.*;
>
> public class Hello {
>
>         private static final String URL = "https://10.64.0.204/api";
>         private static final String crt =
> "/home/david/Desktop/dev/server.truststore";
>         private static final String user = "admin at internal";
>         private static final String pass = "11111111";
>
>         public static void main(String[] args) throws
> ClientProtocolException, ServerException,
>                 UnsecuredConnectionAttemptError, IOException {
>
>                 Api api = new Api(URL, user, pass, crt);
>
>         }
> }
> ======================
>
> Description of problem:
>
> While trying to start my app localy on my pc, I am getting an exception:
>
> Exception in thread "main" java.lang.IllegalArgumentException: Port is
> invalid
>     at org.apache.http.util.Args.check(Args.java:36)
>     at org.apache.http.conn.scheme.Scheme.<init>(Scheme.java:92)
>     at
> org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.createSchemeRegistry(ConnectionsPoolBuilder.java:358)
>     at
> org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.createPoolingClientConnectionManager(ConnectionsPoolBuilder.java:289)
>     at
> org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.createDefaultHttpClient(ConnectionsPoolBuilder.java:261)
>     at
> org.ovirt.engine.sdk.web.ConnectionsPoolBuilder.build(ConnectionsPoolBuilder.java:413)
>     at org.ovirt.engine.sdk.Api.<init>(Api.java:131)
>     at lab01.Hello.main(Hello.java:24)
>
> But I can connect to the server in https using curl or webrowser.
>
> How to fix it ?
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160426/a35b0235/attachment-0001.html>


More information about the Users mailing list