When i use openstack4j 3.0.3/3.0.2's flaotingip method :associateToPort(eipid, portid),there is an error as below,but when i use 3.0.0,it is all right. #889

Open
zhoutiekui opened this Issue Nov 16, 2016 · 6 comments

Projects

None yet

3 participants

@zhoutiekui

method:
netfloatingip's associateToPort(eipid, portid)

error logs:
Exception in thread "main" ConnectionException{message=could not find writer for content-type application/json type: java.lang.String, status=0}
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:56)
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.execute(HttpExecutorServiceImpl.java:30)
at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:51)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:208)
at org.openstack4j.openstack.networking.internal.FloatingIPServiceImpl.associateToPort(FloatingIPServiceImpl.java:83)
at openstack4jGlanceV2.networktest.main(networktest.java:61)
Caused by: java.lang.RuntimeException: could not find writer for content-type application/json type: java.lang.String
at org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest.java:470)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.writeRequestBodyToOutputStream(ApacheHttpClient4Executor.java:393)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.buildEntity(ApacheHttpClient4Executor.java:360)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.loadHttpMethod(ApacheHttpClient4Executor.java:332)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.execute(ApacheHttpClient4Executor.java:180)
at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:438)
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:688)
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:694)
at org.openstack4j.connectors.resteasy.HttpCommand.execute(HttpCommand.java:65)
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invokeRequest(HttpExecutorServiceImpl.java:61)
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:54)
... 5 more

@auhlig
Member
auhlig commented Nov 17, 2016

Short-term: Worth trying another connector

@zhoutiekui

Yes,I try to use jersey2 is ok..The resteasy seems not support the associateToPort(eipid, portid)'s json encoded parameters.
But another queston: how can i set the default connector to jersey2 when i use the jar pacakage with dependency?thanks.

@vinodborole
Contributor

By default the API’s are configured to use the Jersey 2 connector. The jar with deps uses jersey2

@zhoutiekui

Hi,vinodborole ,i have tryied with the openstack4j 3.0.2 jar with deps,but still has the error...and i still want to know how to make jersey2 as the default connector when i use the jar other than pom dependency, thanks..

@vinodborole
Contributor

Please check http://www.openstack4j.com/learn/getting-started it says jersey2 is the default connector

@zhoutiekui
zhoutiekui commented Nov 29, 2016 edited

I use the jar package with dependencies as below:
image

i got the error as follow:

Exception in thread "main" ConnectionException{message=could not find writer for content-type application/json type: java.lang.String, status=0}
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:56)
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.execute(HttpExecutorServiceImpl.java:30)
at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:51)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:208)
at org.openstack4j.openstack.networking.internal.FloatingIPServiceImpl.associateToPort(FloatingIPServiceImpl.java:83)
at openstack4jGlanceV2.networktest.main(networktest.java:61)
Caused by: java.lang.RuntimeException: could not find writer for content-type application/json type: java.lang.String
at org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest.java:470)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.writeRequestBodyToOutputStream(ApacheHttpClient4Executor.java:393)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.buildEntity(ApacheHttpClient4Executor.java:360)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.loadHttpMethod(ApacheHttpClient4Executor.java:332)
at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.execute(ApacheHttpClient4Executor.java:180)
at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:438)
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:688)
at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:694)
at org.openstack4j.connectors.resteasy.HttpCommand.execute(HttpCommand.java:65)
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invokeRequest(HttpExecutorServiceImpl.java:61)
at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:54)
... 5 more

it still comes error from the org.jboss.resteasy, so i think the jersey2 is not configured as the default connector ,thanks

and i have checked the files of the openstack4j-3.0.3-withdeps.jar ,there is no jersey file at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment