[keycloak-user] HTTP error - 400 Bad Request - create realm CLI

Marko Strukelj mstrukel at redhat.com
Wed Feb 15 05:03:30 EST 2017


I would expect that error status 400 occurs at parameter checking / input
parsing time. If the problem occurs later I would expect error status 500.

If you get a failure with the same realm all the time it's probably a
problem with some values in that realm's JSON.

I'd try and put a breakpoint at the beginning of
RealmsAdminResource.importRealm method. You may then get more information
if you manage to hit exactly the request that fails.

Another thing you can try is using tcpflow, or tcpdump CLI tool and maybe
get more information from raw tcp data. For example I use the following on
Mac to examine all traffic to port 8080:

sudo tcpdump -i lo0 -s 0 -A port 8080


On Wed, Feb 15, 2017 at 10:05 AM, Colin Coleman <cco at capraconsulting.no>
wrote:

> There is no stacktrace on the logs – I turned the <root-logger> level up
> to debug and could find nothing then either.
>
> The only difference between a success when there were less than 20 realms
> and a failure when there were more than 20 realms was a lack of  debug
> lines from org.hibernate which seems to show that the database never gets
> queried when a 400 is produced.
>
>
>
> My Stack is:
>
> Ubuntu 16.04
>
> openjdk version "1.8.0_121"
>
> PostgreSQL 9.6.1 (running on different machine)
>
> keycloak-2.5.1.Final – running uning standalone-ha.xml
>
> DB driver: postgresql-9.4.1212.jre6.jar
>
>
>
> Writing this I notice that the db driver and db are not on the same level
> – I will update this and test again.
>
>
>
> ------------------------------------------------
>
> Colin
>
>
>
> *From: *Marko Strukelj <mstrukel at redhat.com>
> *Date: *Tuesday, 14 February 2017 at 18:16
> *To: *Colin Coleman <cco at capraconsulting.no>
> *Cc: *keycloak-user <keycloak-user at lists.jboss.org>
> *Subject: *Re: [keycloak-user] HTTP error - 400 Bad Request - create
> realm CLI
>
>
>
> There is no such restriction, and I can't reproduce your issue.
>
>
>
> Is there any stacktrace on the server?
>
>
>
> Do you get any more information on the client if you add -x option?
>
>
>
>
>
>
>
> On Tue, Feb 14, 2017 at 1:01 PM, Colin Coleman <cco at capraconsulting.no>
> wrote:
>
> Hello,
>
>
>
> Is there a setting limiting the number of realms that can be created with
> the CLI?
>
> When creating realms via the CLI I start getting HTTP error - 400 Bad
> Request after about 20 realms
>
>
>
>
>
> kcadm.sh create realms -s realm=test3 -s enabled=true
>
> kcadm.sh create realms -s realm=test4 -s enabled=true
>
> kcadm.sh create realms -s realm=test5 -s enabled=true
>
> .
>
> .
>
> .
>
>
>
> I get
>
>
>
> .
>
> .
>
> Created new realm with id 'test13'
>
> Created new realm with id 'test14'
>
> HTTP error - 400 Bad Request
>
> HTTP error - 400 Bad Request
>
> .
>
> .
>
> .
>
>
>
>
>
> Colin
>
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
>


More information about the keycloak-user mailing list