Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}': char=",position=312 BEFORE='ssions"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}': char=",position=312 BEFORE='ssions"

bay chae
https://stackoverflow.com/questions/43618000/solr-standalone-basicauth-org-noggit-jsonparserparseexception <https://stackoverflow.com/questions/43618000/solr-standalone-basicauth-org-noggit-jsonparserparseexception>

Hi I am following guides on security.json in https://cwiki.apache.org/confluence/display/solr/Rule-Based+Authorization+Plugin <https://cwiki.apache.org/confluence/display/solr/Rule-Based+Authorization+Plugin>.

But when solr starts up I am getting:

Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}': char=",position=312 BEFORE='ssions":[{"name":"security-edit", "role":"admin"}] "' AFTER='user-role":{"solr":"admin"} }} '
        at org.noggit.JSONParser.err(JSONParser.java:356)
        at org.noggit.JSONParser.nextEvent(JSONParser.java:958)
        at org.noggit.ObjectBuilder.getObject(ObjectBuilder.java:124)
        at org.noggit.ObjectBuilder.getVal(ObjectBuilder.java:57)
        at org.noggit.ObjectBuilder.getObject(ObjectBuilder.java:128)
        at org.apache.solr.common.util.Utils.fromJSON(Utils.java:127)
        at org.apache.solr.handler.admin.SecurityConfHandler$SecurityConfig.setData(SecurityConfHandler.java:311)
        at org.apache.solr.handler.admin.SecurityConfHandlerLocal.getSecurityConfig(SecurityConfHandlerLocal.java:58)
        ... 46 more

Any help for a poor noob? This is for solr standalone.

==============================================================

2017-04-25 17:45:03.530 INFO  (main) [   ] o.e.j.s.Server jetty-9.3.14.v20161028
2017-04-25 17:45:03.870 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter  ___      _       Welcome to Apache Solr™ version 6.5.0
2017-04-25 17:45:03.870 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter / __| ___| |_ _   Starting in standalone mode on port 8984
2017-04-25 17:45:03.871 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter \__ \/ _ \ | '_|  Install dir: /usr/local/solr-6.5.0
2017-04-25 17:45:03.885 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter |___/\___/_|_|    Start time: 2017-04-25T17:45:03.872Z
2017-04-25 17:45:03.885 INFO  (main) [   ] o.a.s.s.StartupLoggingUtils Property solr.log.muteconsole given. Muting ConsoleAppender named CONSOLE
2017-04-25 17:45:03.900 INFO  (main) [   ] o.a.s.c.SolrResourceLoader Using system property solr.solr.home: /usr/local/solr-6.5.0/server/solr
2017-04-25 17:45:03.908 INFO  (main) [   ] o.a.s.c.SolrXmlConfig Loading container configuration from /usr/local/solr-6.5.0/server/solr/solr.xml
2017-04-25 17:45:04.181 INFO  (main) [   ] o.a.s.u.UpdateShardHandler Creating UpdateShardHandler HTTP client with params: socketTimeout=600000&connTimeout=60000&retry=true
2017-04-25 17:45:04.193 ERROR (main) [   ] o.a.s.s.SolrDispatchFilter Could not start Solr. Check solr/home property and the logs
2017-04-25 17:45:04.217 ERROR (main) [   ] o.a.s.c.SolrCore null:org.apache.solr.common.SolrException: Failed opening existing security.json file: /usr/local/solr-6.5.0/server/solr/security.json

Reply | Threaded
Open this post in threaded view
|

Re: Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}': char=",position=312 BEFORE='ssions"

Shawn Heisey-2
On 4/25/2017 12:10 PM, bay chae wrote:
> https://stackoverflow.com/questions/43618000/solr-standalone-basicauth-org-noggit-jsonparserparseexception <https://stackoverflow.com/questions/43618000/solr-standalone-basicauth-org-noggit-jsonparserparseexception>
>
> Hi I am following guides on security.json in https://cwiki.apache.org/confluence/display/solr/Rule-Based+Authorization+Plugin <https://cwiki.apache.org/confluence/display/solr/Rule-Based+Authorization+Plugin>.
>
> But when solr starts up I am getting:
>
> Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}': char=",position=312 BEFORE='ssions":[{"name":"security-edit", "role":"admin"}] "' AFTER='user-role":{"solr":"admin"} }}

Looks like the JSON on that documentation page is incorrect, and has
been wrong for a very long time.  It doesn't validate when run through a
JSON validator.  If I add a comma at the end of line 10 (just before
"user-role"), then it validates.  I do not know whether this is the
correct fix, but I think it probably is.

Before I update the documentation, I would like somebody who's familiar
with this file to tell me whether I've got the right fix.

Thanks,
Shawn

Reply | Threaded
Open this post in threaded view
|

Re: Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}': char=",position=312 BEFORE='ssions"

bay chae
doh!!!!

Thanks for the tip!!!!

It worked perfectly!!

> On 25 Apr 2017, at 19:28, Shawn Heisey <[hidden email]> wrote:
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}': char=",position=312 BEFORE='ssions"

Fuad Efendi
In reply to this post by Shawn Heisey-2
Yes, absolutely correct, comma is missing at the end of line 10

All key-value pairs inside the same block should be comma separated, except
last one



From: Shawn Heisey <[hidden email]> <[hidden email]>
Reply: [hidden email] <[hidden email]>
<[hidden email]>
Date: April 25, 2017 at 2:29:03 PM
To: [hidden email] <[hidden email]>
<[hidden email]>
Subject:  Re: Caused by: org.noggit.JSONParser$ParseException: Expected ','
or '}': char=",position=312 BEFORE='ssions"

On 4/25/2017 12:10 PM, bay chae wrote:
>
https://stackoverflow.com/questions/43618000/solr-standalone-basicauth-org-noggit-jsonparserparseexception
<
https://stackoverflow.com/questions/43618000/solr-standalone-basicauth-org-noggit-jsonparserparseexception>

>
> Hi I am following guides on security.json in
https://cwiki.apache.org/confluence/display/solr/Rule-Based+Authorization+Plugin
<
https://cwiki.apache.org/confluence/display/solr/Rule-Based+Authorization+Plugin>.

>
> But when solr starts up I am getting:
>
> Caused by: org.noggit.JSONParser$ParseException: Expected ',' or '}':
char=",position=312 BEFORE='ssions":[{"name":"security-edit",
"role":"admin"}] "' AFTER='user-role":{"solr":"admin"} }}

Looks like the JSON on that documentation page is incorrect, and has
been wrong for a very long time. It doesn't validate when run through a
JSON validator. If I add a comma at the end of line 10 (just before
"user-role"), then it validates. I do not know whether this is the
correct fix, but I think it probably is.

Before I update the documentation, I would like somebody who's familiar
with this file to tell me whether I've got the right fix.

Thanks,
Shawn