You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Søren Berg Glasius <so...@glasius.dk> on 2022/07/05 10:57:58 UTC

Re: groovy.json.JsonSulper

First off, user questions should be sent to users@groovy.apache.org not
dev@groovy.apache.org, as the later is for the dev team to discuss the ins
and outs of Groovy, I have added users@groovy.apache.org to continue the
conversation there

Second, I just tried your code in Groovy Console on Groovy 4.0.1/Java 8 and
it worked, so you need to provide more information about what version of
Groovy and Java you are using.

Bonus, this:
def req = new URL("https://jsonplaceholder.typicode.com/todos/1
").openConnection();
def postRC = req.getResponseCode();
def streamText = req.getInputStream().getText()

can be replaced with:
def streamText = 'https://jsonplaceholder.typicode.com/todos/1'.toURL().text



Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry
Mobile: +45 40 44 91 88
--- Press ESC once to quit - twice to save the changes.


Den tir. 5. jul. 2022 kl. 12.49 skrev Dharma Teja <dh...@appfire.com>:

> Hi Team,
>
> When I was using the below groovy script, *groovy.json.JsonSulper *was
> throwing this error, Can you please help me with this
>
> Throws java.lang.RuntimeException: Unable to load FastStringService
>
>
> import groovy.json.*
> import java.net.http.*
> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
> ").openConnection();
> def postRC = req.getResponseCode();
> def streamText = req.getInputStream().getText()
> def jsonSlurper = new JsonSlurper()
> println streamText
> def json = jsonSlurper.parseText(streamText)
> println json
>
>
> Thanks,
> Teja
>

Re: groovy.json.JsonSulper

Posted by Dharma Teja <dh...@appfire.com>.
Hi Søren,

Thanks for the update. I am running this script on my Gradle plugin on
Atlassian confluence server 7.4.15 and my java using JDK 1.8 in local the
same is used by server.

But I am getting the same error, Can you please suggest this.

And i tried with both the jar files still i am getting the same error.

I am removing  users@groovy.apache.org, as I am not a subscribed user to
send mail from the domain @apche.org.
<us...@groovy.apache.org>:
Must be sent from an @apache.org address or a subscriber address or an
address in LDAP.

org.codehaus.groovy 3.0.10
org.apache.groovy 4.0.3

[image: image.png]

While debugging the code, I found this block of code in the source jar, it
was giving the INSTANCE value as null.
[image: image.png]



Thanks,
Teja


On Tue, Jul 5, 2022 at 5:18 PM Dharma Teja <dh...@appfire.com> wrote:

> Hi Søren,
>
> Thanks for the update. I am running this script on my Gradle plugin on
> Atlassian confluence server 7.4.15 and my java using JDK 1.8 in local the
> same is used by server.
>
> But i am getting the same error, Can you please suggest on this.
>
> [image: image.png]
>
> I was debuggin i found this code in source, it was giving INSATANCE value
> as null.
> [image: image.png]
>
>
>
> Thanks,
> Teja
>
>
> On Tue, Jul 5, 2022 at 4:28 PM Søren Berg Glasius <so...@glasius.dk>
> wrote:
>
>> First off, user questions should be sent to users@groovy.apache.org not
>> dev@groovy.apache.org, as the later is for the dev team to discuss the
>> ins and outs of Groovy, I have added users@groovy.apache.org to continue
>> the conversation there
>>
>> Second, I just tried your code in Groovy Console on Groovy 4.0.1/Java 8
>> and it worked, so you need to provide more information about what version
>> of Groovy and Java you are using.
>>
>> Bonus, this:
>> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
>> ").openConnection();
>> def postRC = req.getResponseCode();
>> def streamText = req.getInputStream().getText()
>>
>> can be replaced with:
>> def streamText = '
>> https://jsonplaceholder.typicode.com/todos/1'.toURL().text
>>
>>
>>
>> Med venlig hilsen,
>> Søren Berg Glasius
>>
>> Hedevej 1, Gl. Rye, 8680 Ry
>> Mobile: +45 40 44 91 88
>> --- Press ESC once to quit - twice to save the changes.
>>
>>
>> Den tir. 5. jul. 2022 kl. 12.49 skrev Dharma Teja <
>> dharma.teja@appfire.com>:
>>
>>> Hi Team,
>>>
>>> When I was using the below groovy script, *groovy.json.JsonSulper *was
>>> throwing this error, Can you please help me with this
>>>
>>> Throws java.lang.RuntimeException: Unable to load FastStringService
>>>
>>>
>>> import groovy.json.*
>>> import java.net.http.*
>>> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
>>> ").openConnection();
>>> def postRC = req.getResponseCode();
>>> def streamText = req.getInputStream().getText()
>>> def jsonSlurper = new JsonSlurper()
>>> println streamText
>>> def json = jsonSlurper.parseText(streamText)
>>> println json
>>>
>>>
>>> Thanks,
>>> Teja
>>>
>>

Re: groovy.json.JsonSulper

Posted by Dharma Teja <dh...@appfire.com>.
Hi Søren,
I just forgot to update the binaries I am using.

I tried with below binaries.

org.codehaus.groovy 3.0.10

org.apache.groovy 4.0.3



Thanks,
Teja


On Tue, Jul 5, 2022 at 5:18 PM Dharma Teja <dh...@appfire.com> wrote:

> Hi Søren,
>
> Thanks for the update. I am running this script on my Gradle plugin on
> Atlassian confluence server 7.4.15 and my java using JDK 1.8 in local the
> same is used by server.
>
> But i am getting the same error, Can you please suggest on this.
>
> [image: image.png]
>
> I was debuggin i found this code in source, it was giving INSATANCE value
> as null.
> [image: image.png]
>
>
>
> Thanks,
> Teja
>
>
> On Tue, Jul 5, 2022 at 4:28 PM Søren Berg Glasius <so...@glasius.dk>
> wrote:
>
>> First off, user questions should be sent to users@groovy.apache.org not
>> dev@groovy.apache.org, as the later is for the dev team to discuss the
>> ins and outs of Groovy, I have added users@groovy.apache.org to continue
>> the conversation there
>>
>> Second, I just tried your code in Groovy Console on Groovy 4.0.1/Java 8
>> and it worked, so you need to provide more information about what version
>> of Groovy and Java you are using.
>>
>> Bonus, this:
>> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
>> ").openConnection();
>> def postRC = req.getResponseCode();
>> def streamText = req.getInputStream().getText()
>>
>> can be replaced with:
>> def streamText = '
>> https://jsonplaceholder.typicode.com/todos/1'.toURL().text
>>
>>
>>
>> Med venlig hilsen,
>> Søren Berg Glasius
>>
>> Hedevej 1, Gl. Rye, 8680 Ry
>> Mobile: +45 40 44 91 88
>> --- Press ESC once to quit - twice to save the changes.
>>
>>
>> Den tir. 5. jul. 2022 kl. 12.49 skrev Dharma Teja <
>> dharma.teja@appfire.com>:
>>
>>> Hi Team,
>>>
>>> When I was using the below groovy script, *groovy.json.JsonSulper *was
>>> throwing this error, Can you please help me with this
>>>
>>> Throws java.lang.RuntimeException: Unable to load FastStringService
>>>
>>>
>>> import groovy.json.*
>>> import java.net.http.*
>>> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
>>> ").openConnection();
>>> def postRC = req.getResponseCode();
>>> def streamText = req.getInputStream().getText()
>>> def jsonSlurper = new JsonSlurper()
>>> println streamText
>>> def json = jsonSlurper.parseText(streamText)
>>> println json
>>>
>>>
>>> Thanks,
>>> Teja
>>>
>>

Re: groovy.json.JsonSulper

Posted by Dharma Teja <dh...@appfire.com>.
Hi Søren,

Thanks for the update. I am running this script on my Gradle plugin on
Atlassian confluence server 7.4.15 and my java using JDK 1.8 in local the
same is used by server.

But i am getting the same error, Can you please suggest on this.

[image: image.png]

I was debuggin i found this code in source, it was giving INSATANCE value
as null.
[image: image.png]



Thanks,
Teja


On Tue, Jul 5, 2022 at 4:28 PM Søren Berg Glasius <so...@glasius.dk> wrote:

> First off, user questions should be sent to users@groovy.apache.org not
> dev@groovy.apache.org, as the later is for the dev team to discuss the
> ins and outs of Groovy, I have added users@groovy.apache.org to continue
> the conversation there
>
> Second, I just tried your code in Groovy Console on Groovy 4.0.1/Java 8
> and it worked, so you need to provide more information about what version
> of Groovy and Java you are using.
>
> Bonus, this:
> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
> ").openConnection();
> def postRC = req.getResponseCode();
> def streamText = req.getInputStream().getText()
>
> can be replaced with:
> def streamText = '
> https://jsonplaceholder.typicode.com/todos/1'.toURL().text
>
>
>
> Med venlig hilsen,
> Søren Berg Glasius
>
> Hedevej 1, Gl. Rye, 8680 Ry
> Mobile: +45 40 44 91 88
> --- Press ESC once to quit - twice to save the changes.
>
>
> Den tir. 5. jul. 2022 kl. 12.49 skrev Dharma Teja <dharma.teja@appfire.com
> >:
>
>> Hi Team,
>>
>> When I was using the below groovy script, *groovy.json.JsonSulper *was
>> throwing this error, Can you please help me with this
>>
>> Throws java.lang.RuntimeException: Unable to load FastStringService
>>
>>
>> import groovy.json.*
>> import java.net.http.*
>> def req = new URL("https://jsonplaceholder.typicode.com/todos/1
>> ").openConnection();
>> def postRC = req.getResponseCode();
>> def streamText = req.getInputStream().getText()
>> def jsonSlurper = new JsonSlurper()
>> println streamText
>> def json = jsonSlurper.parseText(streamText)
>> println json
>>
>>
>> Thanks,
>> Teja
>>
>