You could install it as extension so that it's not loaded with each
script. Go you admin, Add Extension and use advanced search with id
com.gmongo:gmongo and version 1.0 (or any other version you want).

Another possibility is to download gmongo and MongoDB Java Driver jars
and put them into /WEB-INF/lib/.

On Thu, Sep 26, 2013 at 10:17 AM, Quân Lê <[email protected]> wrote:
> Thanks.
> But now I don't know any other way to get and access MongoDB in xwiki.
> Any links or documents?
>
>
> 2013/9/26 Thomas Mortagne <[email protected]>
>
>> Your issue may be caused by @Grab, that download and load jars into the
>> permgen.
>>
>> On Thu, Sep 26, 2013 at 9:58 AM, Quân Lê <[email protected]> wrote:
>> > I tried with XX:MaxPermSize=256M but with 1 request per 2sec.
>> > The PermGen memory is going like 15mb/min.
>> > All the code of responing page is just like this:
>> > {{groovy}}
>> > @Grab(group='com.gmongo', module='gmongo', version='1.0')
>> > import com.gmongo.GMongo
>> > import groovy.json.*
>> >
>> > def data = [] // a list contain data
>> >
>> > def gmongo = new GMongo()
>> > def dbConn = gmongo.getDB('dbtest')
>> > // Not query database but it already go crazy
>> > gmongoObject.close()
>> >
>> > // For GC
>> > dbConn = null
>> > gmongoObject = null
>> >
>> > // Convert into JSON
>> > def slurper = new JsonSlurper()
>> > def builder = new JsonBuilder(data)
>> > println builder.toString()
>> >
>> > // For GC
>> > slurper = null
>> > builder = null
>> > {{/groovy}}
>> >
>> >
>> > 2013/9/26 Thomas Mortagne <[email protected]>
>> >
>> >> Well without changing your script all I can suggest is to allocate
>> >> more permgen to java using
>> >>
>> >> -XX:MaxPermSize=<enough memory>M
>> >>
>> >>
>> >> On Thu, Sep 26, 2013 at 9:25 AM, Quân Lê <[email protected]> wrote:
>> >> > Thank you
>> >> > It's true that the more script responing page processes, the more
>> classes
>> >> > are loaded.
>> >> > Is there anyway to prevent OutOfmemory Exception happened?
>> >> >
>> >> >
>> >> > 2013/9/26 Thomas Mortagne <[email protected]>
>> >> >
>> >> >> I doubt it has anything to do with the request itself, it's probably
>> >> >> more related to what your page is doing. From what I understand your
>> >> >> page create directly or indirectly new classes. Note that most script
>> >> >> languages compile the script into a new Java class before executing
>> it
>> >> >> so if you execute a lot of very big scripts at the same time it can
>> >> >> probably be pretty costy for the permgen. Something else that could
>> be
>> >> >> costy is if you load a jar in this page for example with the "jars"
>> >> >> property of script macros.
>> >> >>
>> >> >> On Thu, Sep 26, 2013 at 8:53 AM, lequan.moon <[email protected]>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> > I'm making an application that make an AJAX request frequently from
>> >> page
>> >> >> to
>> >> >> > page in xwiki.
>> >> >> > About 1 per 10s
>> >> >> > The request look like this:
>> >> >> >
>> >> >> > $.ajax({
>> >> >> >             type: "GET",
>> >> >> >             crossDomain: true,
>> >> >> >             url: "/xwiki/bin/get/Lib/LibPage?outputSyntax=plain",
>> >> >> >             dataType: 'text',
>> >> >> >             data: data2send,
>> >> >> >             success: function(result) {...},
>> >> >> >             error: function(xhr, status, error) {
>> >> >> >                 console.log(error)
>> >> >> >                 console.log(status)
>> >> >> >                 console.log(xhr)
>> >> >> >             }
>> >> >> >         });
>> >> >> >
>> >> >> > And respone is simple as a text or something like a JSON Map, List.
>> >> >> > I took a look at jconsole and here it is
>> >> >> > <
>> >> >>
>> >>
>> http://xwiki.475771.n2.nabble.com/file/n7587262/9-26-2013_1-51-09_PM.jpg>
>> >> >> >
>> >> >> > Please help! I don't understand how xwiki works on this.
>> >> >> >
>> >> >> > Thank in advanced.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > View this message in context:
>> >> >>
>> >>
>> http://xwiki.475771.n2.nabble.com/Frrequently-AJAX-request-caused-PernGen-Exception-OutOfMemory-tp7587262.html
>> >> >> > Sent from the XWiki- Dev mailing list archive at Nabble.com.
>> >> >> > _______________________________________________
>> >> >> > devs mailing list
>> >> >> > [email protected]
>> >> >> > http://lists.xwiki.org/mailman/listinfo/devs
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Thomas Mortagne
>> >> >> _______________________________________________
>> >> >> devs mailing list
>> >> >> [email protected]
>> >> >> http://lists.xwiki.org/mailman/listinfo/devs
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > ======Lê Minh Quân======
>> >> > _______________________________________________
>> >> > devs mailing list
>> >> > [email protected]
>> >> > http://lists.xwiki.org/mailman/listinfo/devs
>> >>
>> >>
>> >>
>> >> --
>> >> Thomas Mortagne
>> >> _______________________________________________
>> >> devs mailing list
>> >> [email protected]
>> >> http://lists.xwiki.org/mailman/listinfo/devs
>> >>
>> >
>> >
>> >
>> > --
>> > ======Lê Minh Quân======
>> > _______________________________________________
>> > devs mailing list
>> > [email protected]
>> > http://lists.xwiki.org/mailman/listinfo/devs
>>
>>
>>
>> --
>> Thomas Mortagne
>> _______________________________________________
>> devs mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/devs
>>
>
>
>
> --
> ======Lê Minh Quân======
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs



-- 
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to