That indeed worked, thanks Sergey!

On Fri, Dec 4, 2020 at 3:26 AM Sergey Makov <[email protected]> wrote:

> Hi Paul,
>
> I'm not a Groovy expert, but I think the issue is in this line:
>
> java(classname: NCStart.name, fork: true, clonevm: true)
>
> As far as I know, the 'clonevm' option only clones the bootstrap
> classpath (jre/lib folder) and does not clone the system classpath.
> I think you should somehow explicitly add 'all-deps jar' to the forked JVM.
>
> Regards,
> Sergey
>
> On Thu, Dec 3, 2020 at 8:24 AM Paul King <[email protected]> wrote:
> >
> > Thanks everyone,
> >
> > I could build/download the all-deps jar but it didn't help my example -
> it
> > is possibly a classloader issue related to trying to run a forked server
> > via Ant.
> >
> > Just some background, I wanted a single script newbies could run to try
> out
> > NLPCraft for a "Data Science with Groovy" workshop I am giving next week.
> > The script forks a new process via Ant for the server to save the
> students
> > having to do that separately. The fork/Ant piece is probably the issue.
> > I will probably remove that since it is a bit problematic (interleaving
> > logs etc.) and I don't have the issue when starting the server separately
> > in the normal way.
> > But it is working for now, so I'll probably leave it as is for next week.
> >
> > There is still an issue with using Gradle dependency management and
> > IntelliJ with error as shown in earlier email. Using the all-dep jars
> gets
> > past that but then hits the (what I think is a) classloader issue:
> >      [java] Error: Could not find or load main class
> > org.apache.nlpcraft.NCStart
> >      [java] Caused by: java.lang.ClassNotFoundException:
> > org.apache.nlpcraft.NCStart
> >      [java] Java Result: 1
> >
> > Cheers, Paul.
> > P.S. Total script (just running light switch example) below:
> >
> > import org.apache.nlpcraft.NCStart
> > import groovy.ant.AntBuilder
> > import org.apache.nlpcraft.examples.lightswitch.LightSwitchModel
> > import org.apache.nlpcraft.model.tools.test.NCTestClientBuilder
> >
> > import static
> org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe.start
> > import static
> org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe.stop
> >
> > def t = Thread.start { new AntBuilder().with {
> >     java(classname: NCStart.name, fork: true, clonevm: true) {
> >         arg(value: '-server')
> >     }
> > }}
> > sleep 35000 // allow server to start up
> >
> > start(LightSwitchModel)
> >
> > def cli = new NCTestClientBuilder().newBuilder().build()
> >
> > cli.open("nlpcraft.lightswitch.ex")
> > println cli.ask('Turn on the lights in the master bedroom')
> > println cli.ask("Light 'em all up")
> > println cli.ask('Make it dark downstairs') // expecting no match
> > if (cli) {
> >     cli.close()
> > }
> >
> > stop()
> > t.interrupt()
> > t.join()
> >
> >
> > With output extracted from logs being:
> >
> > [java] Lights are [on] in [master bedroom].
> > [java] Lights are [on] in [entire house].
> > [java] No matching intent found.
> >
> >
> >
> > On Thu, Dec 3, 2020 at 1:01 PM Nikita Ivanov <[email protected]>
> wrote:
> >
> > > Paul,
> > > I believe you can either (a) download source zip, and 'mvn clean
> package'
> > > to get this all-deps JAR, (b) download binary ZIP that includes it
> already,
> > > and (c) use maven dependency management to get all that sorted out
> > > automatically.
> > > Thanks,
> > > --
> > > Nikita Ivanov
> > >
> > >
> > >
> > > On Wed, Dec 2, 2020 at 2:29 PM Paul King <[email protected]> wrote:
> > >
> > >>
> > >> Hi all,
> > >>
> > >> I noticed that the documentation refers to an all jar:
> > >>
> > >> apache-nlpcraft-0.7.2-all-deps
> > >>
> > >> Is that available somewhere? Or is it something I should build from
> the
> > >> sources?
> > >>
> > >> I tried a hello world on windows just referencing the normal jar and
> it
> > >> fails from Intellij:
> > >>
> > >> [image: image.png]
> > >>
> > >> I am presuming that this error is due to too many dependencies, I
> don't
> > >> have that problem from the command-line.
> > >>
> > >> Cheers, Paul.
> > >>
> > >>
>

Reply via email to