openstack4j
openstack4j copied to clipboard
ClientResponseException{message=Bad Request, status=400, status-code=BAD_REQUEST}
I used the maven deps like this:
<dependency>
<groupId>org.pacesys</groupId>
<artifactId>openstack4j</artifactId>
<version>3.1.0</version>
</dependency>
and the test code like this:
public static String endpointPre = "http://controller:5000/v3/";
static OSClientV3 os;
public static void main(String[]args) {
os = OSFactory.builderV3()
.endpoint(endpointPre)
.credentials("admin", "secret", Identifier.byName("Default"))
.scopeToProject(Identifier.byName("admin"))
.authenticate();
System.out.println(os.images());
}
I got the exception, and I got some answer from internet but I haven't got the root cause about it
ClientResponseException{message=Bad Request, status=400, status-code=BAD_REQUEST}
at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:38)
at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:23)
at org.openstack4j.openstack.internal.OSAuthenticator.authenticateV3(OSAuthenticator.java:191)
at org.openstack4j.openstack.internal.OSAuthenticator.invoke(OSAuthenticator.java:74)
at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:172)
at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:129)
at com.ossera.sdn.controller.APITest.Before(APITest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
I think it will help you if you open the debug log.
# Spring Boot
logging.level.org.apache.http=DEBUG
logging.level.org.openstack4j.openstack.internal=DEBUG
Any update, I met the same issue.
@champagne try this .scopeToProject(Identifier.byId(projectIdentifier))
@vadsiva , Tried but it seems not the root cause. Thanks anyway.
I have met some problems like this before, it seems the best way is to to check on the openstack log, or if you can, try to capture the packet through tools like wireshark, tcpdump, it will give you some useful message detail on your error which have been discarded by the response handling methods