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

Gonzalo Rafuls gonza at redhat.com
Tue Apr 26 07:57:02 UTC 2016


Try adding port 443 to the URL variable.

private static final String URL = "https://10.64.0.204:443/api
<https://10.64.0.204/api>";

On Tue, Apr 26, 2016 at 9:45 AM, David David <dd432690 at gmail.com> wrote:

> 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 ?
>>
>>
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160426/5ca9bf08/attachment-0001.html>


More information about the Users mailing list