Problem deleting jar packaged item from repo
Wednesday, 6 April 2016 · 20 messages · last reply 12 Apr 2016
AB
Andy Bunce6 Apr 2016 18:20 #
Hi,
If I install HelloWorld.jar to the repository as described at [1] It all works. However attempts to remove the item generate:
[bxerr:BXRE0001] Package 'org.basex.modules.Hello' does not exist.
/Andy
[1] http://docs.basex.org/wiki/Repository#Java
CG
Christian Grün7 Apr 2016 14:19 #
…fixed, thanks!
PS: As the bugs you report are always bugs, and no misunderstandings, free to add them in our GitHub issue tracker! If you prefer the list, that’s fine as well.
Quoted text · Andy Bunce · 10 lines
On Wed, Apr 6, 2016 at 6:20 PM, Andy Bunce <bunce.andy at gmail.com> wrote: > Hi, > > If I install HelloWorld.jar to the repository as described at [1] > It all works. However attempts to remove the item generate: > > [bxerr:BXRE0001] Package 'org.basex.modules.Hello' does not exist. > > /Andy > [1] http://docs.basex.org/wiki/Repository#Java
AB
Andy Bunce7 Apr 2016 16:49 #
Thanks, works for me. Here is a follow on question :).
I have used Gunther's updated REx to create a jar [1] from
CR_xquery_31_20151217.ebnf
(just as an experiment I put it in package org.basex.modules in this case - but I don't think this matters here)
If I put the jar in basex/lib then it works. I can do:
Q{org.basex.modules.CR_xquery_31_20151217}parseXQuery("42")
If instead I install it to the repo. It appears as
"org.basex.modules.CR_xquery_31_20151217"
but
import module namespace p="org.basex.modules.CR_xquery_31_20151217"; Fails with
Could not instantiate org.basex.modules.CR_xquery_31_20151217: org.basex.modules.CR_xquery_31_20151217
Any ideas where the problem could be?
/Andy
[1]
https://github.com/expkg-zone58/ex-xparse/releases/download/v0.2.1/CR_xquery_31_20151217.jar
Quoted text · Christian Grün · 20 lines
On 7 April 2016 at 13:19, Christian Grün <christian.gruen at gmail.com> wrote: > …fixed, thanks! > > PS: As the bugs you report are always bugs, and no misunderstandings, > free to add them in our GitHub issue tracker! If you prefer the list, > that’s fine as well. > > > > On Wed, Apr 6, 2016 at 6:20 PM, Andy Bunce <bunce.andy at gmail.com> wrote: > > Hi, > > > > If I install HelloWorld.jar to the repository as described at [1] > > It all works. However attempts to remove the item generate: > > > > [bxerr:BXRE0001] Package 'org.basex.modules.Hello' does not exist. > > > > /Andy > > [1] http://docs.basex.org/wiki/Repository#Java >
CG
Christian Grün7 Apr 2016 16:55 #
Quoted text · Andy Bunce · 9 lines
> If instead I install it to the repo. It appears as > "org.basex.modules.CR_xquery_31_20151217" > but > import module namespace p="org.basex.modules.CR_xquery_31_20151217"; > Fails with > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > org.basex.modules.CR_xquery_31_20151217 > > Any ideas where the problem could be?
It sounds as if it’s not possible to create an instance of this class. Could you possibly forward the stack trace (triggered by -d)?
AB
Andy Bunce7 Apr 2016 17:05 #
C:\Program Files (x86)\BaseX\bin
+>basex -d
BaseX 8.4.3 beta d7bbbe7 [Standalone]
Try 'help' to get more information.
Quoted text · Christian Grün · 1 line
> xquery import module namespace
p="org.basex.modules.CR_xquery_31_20151217";2
Creating Database...
. 27.04 ms (25844 KB)
Creating Database...
. 4.83 ms (25844 KB)
Creating Database...
. 5.0 ms (25844 KB)
Creating Database...
. 3.52 ms (26509 KB)
Creating Database...
. 4.36 ms (26509 KB)
Creating Database...
. 8.26 ms (26509 KB)
Creating Database...
. 8.37 ms (26509 KB)
Creating Database...
. 4.32 ms (27175 KB)
Creating Database...
. 11.38 ms (27175 KB)
java.lang.InstantiationException: org.basex.modules.CR_xquery_31_20151217
at java.lang.Class.newInstance(Unknown Source)
at
org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
at org.basex.query.QueryParser.importModule(QueryParser.java:772)
at org.basex.query.QueryParser.importModules(QueryParser.java:758)
at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
at org.basex.query.QueryContext.parseMain(QueryContext.java:223)
at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
at org.basex.core.Command.execute(Command.java:94)
at org.basex.api.client.LocalSession.execute(LocalSession.java:132)
at org.basex.api.client.Session.execute(Session.java:36)
at org.basex.core.CLI.execute(CLI.java:103)
at org.basex.core.CLI.execute(CLI.java:87)
at org.basex.BaseX.console(BaseX.java:191)
at org.basex.BaseX.<init>(BaseX.java:166)
at org.basex.BaseX.main(BaseX.java:42)
Caused by: java.lang.NoSuchMethodException:
org.basex.modules.CR_xquery_31_20151217.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
... 18 more
org.basex.query.QueryException: Could not instantiate
org.basex.modules.CR_xquery_31_20151217:
org.basex.modules.CR_xquery_31_20151217.
at org.basex.query.QueryError.get(QueryError.java:1343)
at
org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127)
at org.basex.query.QueryParser.importModule(QueryParser.java:772)
at org.basex.query.QueryParser.importModules(QueryParser.java:758)
at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
at org.basex.query.QueryContext.parseMain(QueryContext.java:223)
at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
at org.basex.core.Command.execute(Command.java:94)
at org.basex.api.client.LocalSession.execute(LocalSession.java:132)
at org.basex.api.client.Session.execute(Session.java:36)
at org.basex.core.CLI.execute(CLI.java:103)
at org.basex.core.CLI.execute(CLI.java:87)
at org.basex.BaseX.console(BaseX.java:191)
at org.basex.BaseX.<init>(BaseX.java:166)
at org.basex.BaseX.main(BaseX.java:42)
Caused by: java.lang.InstantiationException:
org.basex.modules.CR_xquery_31_20151217
at java.lang.Class.newInstance(Unknown Source)
at
org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
... 16 more
Caused by: java.lang.NoSuchMethodException:
org.basex.modules.CR_xquery_31_20151217.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
... 18 more
org.basex.query.QueryException: Could not instantiate
org.basex.modules.CR_xquery_31_20151217:
org.basex.modules.CR_xquery_31_20151217.
at org.basex.query.QueryError.get(QueryError.java:1343)
at
org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127)
at org.basex.query.QueryParser.importModule(QueryParser.java:772)
at org.basex.query.QueryParser.importModules(QueryParser.java:758)
at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
at org.basex.query.QueryContext.parseMain(QueryContext.java:223)
at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
at org.basex.core.Command.execute(Command.java:94)
at org.basex.api.client.LocalSession.execute(LocalSession.java:132)
at org.basex.api.client.Session.execute(Session.java:36)
at org.basex.core.CLI.execute(CLI.java:103)
at org.basex.core.CLI.execute(CLI.java:87)
at org.basex.BaseX.console(BaseX.java:191)
at org.basex.BaseX.<init>(BaseX.java:166)
at org.basex.BaseX.main(BaseX.java:42)
Caused by: java.lang.InstantiationException:
org.basex.modules.CR_xquery_31_20151217
at java.lang.Class.newInstance(Unknown Source)
at
org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
... 16 more
Caused by: java.lang.NoSuchMethodException:
org.basex.modules.CR_xquery_31_20151217.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
... 18 more
org.basex.core.BaseXException: Stopped at ., 1/68:
[XQST0059] Could not instantiate org.basex.modules.CR_xquery_31_20151217:
org.basex.modules.CR_xquery_31_20151217.
at org.basex.core.Command.execute(Command.java:101)
at org.basex.api.client.LocalSession.execute(LocalSession.java:132)
at org.basex.api.client.Session.execute(Session.java:36)
at org.basex.core.CLI.execute(CLI.java:103)
at org.basex.core.CLI.execute(CLI.java:87)
at org.basex.BaseX.console(BaseX.java:191)
at org.basex.BaseX.<init>(BaseX.java:166)
at org.basex.BaseX.main(BaseX.java:42)
Caused by: org.basex.query.QueryException: Could not instantiate
org.basex.modules.CR_xquery_31_20151217:
org.basex.modules.CR_xquery_31_20151217.
at org.basex.query.QueryError.get(QueryError.java:1343)
at
org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127)
at org.basex.query.QueryParser.importModule(QueryParser.java:772)
at org.basex.query.QueryParser.importModules(QueryParser.java:758)
at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
at org.basex.query.QueryContext.parseMain(QueryContext.java:223)
at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
at org.basex.core.Command.execute(Command.java:94)
... 7 more
Caused by: java.lang.InstantiationException:
org.basex.modules.CR_xquery_31_20151217
at java.lang.Class.newInstance(Unknown Source)
at
org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
... 16 more
Caused by: java.lang.NoSuchMethodException:
org.basex.modules.CR_xquery_31_20151217.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
... 18 more
Stopped at ., 1/68:
[XQST0059] Could not instantiate org.basex.modules.CR_xquery_31_20151217:
org.basex.modules.CR_xquery_31_20151217.Quoted text · Christian Grün · 15 lines
> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> wrote: > > If instead I install it to the repo. It appears as > > "org.basex.modules.CR_xquery_31_20151217" > > but > > import module namespace p="org.basex.modules.CR_xquery_31_20151217"; > > Fails with > > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > > org.basex.modules.CR_xquery_31_20151217 > > > > Any ideas where the problem could be? > > It sounds as if it’s not possible to create an instance of this class. > Could you possibly forward the stack trace (triggered by -d)? >
AB
Andy Bunce7 Apr 2016 18:40 #
No constructor is the issue. Adding
public CR_xquery_31_20151217() {}
to java src fixes it.
/Andy
Quoted text · Andy Bunce · 204 lines
On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: > C:\Program Files (x86)\BaseX\bin > +>basex -d > BaseX 8.4.3 beta d7bbbe7 [Standalone] > Try 'help' to get more information. > > xquery import module namespace > p="org.basex.modules.CR_xquery_31_20151217";2 > Creating Database... > . 27.04 ms (25844 KB) > Creating Database... > . 4.83 ms (25844 KB) > Creating Database... > . 5.0 ms (25844 KB) > Creating Database... > . 3.52 ms (26509 KB) > Creating Database... > . 4.36 ms (26509 KB) > Creating Database... > . 8.26 ms (26509 KB) > Creating Database... > . 8.37 ms (26509 KB) > Creating Database... > . 4.32 ms (27175 KB) > Creating Database... > . 11.38 ms (27175 KB) > java.lang.InstantiationException: org.basex.modules.CR_xquery_31_20151217 > at java.lang.Class.newInstance(Unknown Source) > at > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > at org.basex.query.QueryParser.importModule(QueryParser.java:772) > at org.basex.query.QueryParser.importModules(QueryParser.java:758) > at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > at org.basex.core.Command.execute(Command.java:94) > at org.basex.api.client.LocalSession.execute(LocalSession.java:132) > at org.basex.api.client.Session.execute(Session.java:36) > at org.basex.core.CLI.execute(CLI.java:103) > at org.basex.core.CLI.execute(CLI.java:87) > at org.basex.BaseX.console(BaseX.java:191) > at org.basex.BaseX.<init>(BaseX.java:166) > at org.basex.BaseX.main(BaseX.java:42) > Caused by: java.lang.NoSuchMethodException: > org.basex.modules.CR_xquery_31_20151217.<init>() > at java.lang.Class.getConstructor0(Unknown Source) > ... 18 more > org.basex.query.QueryException: Could not instantiate > org.basex.modules.CR_xquery_31_20151217: > org.basex.modules.CR_xquery_31_20151217. > at org.basex.query.QueryError.get(QueryError.java:1343) > at > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > at org.basex.query.QueryParser.importModule(QueryParser.java:772) > at org.basex.query.QueryParser.importModules(QueryParser.java:758) > at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > at org.basex.core.Command.execute(Command.java:94) > at org.basex.api.client.LocalSession.execute(LocalSession.java:132) > at org.basex.api.client.Session.execute(Session.java:36) > at org.basex.core.CLI.execute(CLI.java:103) > at org.basex.core.CLI.execute(CLI.java:87) > at org.basex.BaseX.console(BaseX.java:191) > at org.basex.BaseX.<init>(BaseX.java:166) > at org.basex.BaseX.main(BaseX.java:42) > Caused by: java.lang.InstantiationException: > org.basex.modules.CR_xquery_31_20151217 > at java.lang.Class.newInstance(Unknown Source) > at > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > ... 16 more > Caused by: java.lang.NoSuchMethodException: > org.basex.modules.CR_xquery_31_20151217.<init>() > at java.lang.Class.getConstructor0(Unknown Source) > ... 18 more > org.basex.query.QueryException: Could not instantiate > org.basex.modules.CR_xquery_31_20151217: > org.basex.modules.CR_xquery_31_20151217. > at org.basex.query.QueryError.get(QueryError.java:1343) > at > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > at org.basex.query.QueryParser.importModule(QueryParser.java:772) > at org.basex.query.QueryParser.importModules(QueryParser.java:758) > at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > at org.basex.core.Command.execute(Command.java:94) > at org.basex.api.client.LocalSession.execute(LocalSession.java:132) > at org.basex.api.client.Session.execute(Session.java:36) > at org.basex.core.CLI.execute(CLI.java:103) > at org.basex.core.CLI.execute(CLI.java:87) > at org.basex.BaseX.console(BaseX.java:191) > at org.basex.BaseX.<init>(BaseX.java:166) > at org.basex.BaseX.main(BaseX.java:42) > Caused by: java.lang.InstantiationException: > org.basex.modules.CR_xquery_31_20151217 > at java.lang.Class.newInstance(Unknown Source) > at > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > ... 16 more > Caused by: java.lang.NoSuchMethodException: > org.basex.modules.CR_xquery_31_20151217.<init>() > at java.lang.Class.getConstructor0(Unknown Source) > ... 18 more > org.basex.core.BaseXException: Stopped at ., 1/68: > [XQST0059] Could not instantiate org.basex.modules.CR_xquery_31_20151217: > org.basex.modules.CR_xquery_31_20151217. > at org.basex.core.Command.execute(Command.java:101) > at org.basex.api.client.LocalSession.execute(LocalSession.java:132) > at org.basex.api.client.Session.execute(Session.java:36) > at org.basex.core.CLI.execute(CLI.java:103) > at org.basex.core.CLI.execute(CLI.java:87) > at org.basex.BaseX.console(BaseX.java:191) > at org.basex.BaseX.<init>(BaseX.java:166) > at org.basex.BaseX.main(BaseX.java:42) > Caused by: org.basex.query.QueryException: Could not instantiate > org.basex.modules.CR_xquery_31_20151217: > org.basex.modules.CR_xquery_31_20151217. > at org.basex.query.QueryError.get(QueryError.java:1343) > at > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > at org.basex.query.QueryParser.importModule(QueryParser.java:772) > at org.basex.query.QueryParser.importModules(QueryParser.java:758) > at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > at org.basex.core.Command.execute(Command.java:94) > ... 7 more > Caused by: java.lang.InstantiationException: > org.basex.modules.CR_xquery_31_20151217 > at java.lang.Class.newInstance(Unknown Source) > at > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > ... 16 more > Caused by: java.lang.NoSuchMethodException: > org.basex.modules.CR_xquery_31_20151217.<init>() > at java.lang.Class.getConstructor0(Unknown Source) > ... 18 more > Stopped at ., 1/68: > [XQST0059] Could not instantiate org.basex.modules.CR_xquery_31_20151217: > org.basex.modules.CR_xquery_31_20151217. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> > wrote: > >> > If instead I install it to the repo. It appears as >> > "org.basex.modules.CR_xquery_31_20151217" >> > but >> > import module namespace p="org.basex.modules.CR_xquery_31_20151217"; >> > Fails with >> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >> > org.basex.modules.CR_xquery_31_20151217 >> > >> > Any ideas where the problem could be? >> >> It sounds as if it’s not possible to create an instance of this class. >> Could you possibly forward the stack trace (triggered by -d)? >> > >
CG
Christian Grün7 Apr 2016 18:58 #
Quoted text · Andy Bunce · 3 lines
> No constructor is the issue. Adding > public CR_xquery_31_20151217() {} > to java src fixes it.
Thanks! @Gunther: Do you think such a dummy constructor could be added to the Java class?
Quoted text · Andy Bunce · 209 lines
> On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: >> >> C:\Program Files (x86)\BaseX\bin >> +>basex -d >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >> Try 'help' to get more information. >> > xquery import module namespace >> > p="org.basex.modules.CR_xquery_31_20151217";2 >> Creating Database... >> . 27.04 ms (25844 KB) >> Creating Database... >> . 4.83 ms (25844 KB) >> Creating Database... >> . 5.0 ms (25844 KB) >> Creating Database... >> . 3.52 ms (26509 KB) >> Creating Database... >> . 4.36 ms (26509 KB) >> Creating Database... >> . 8.26 ms (26509 KB) >> Creating Database... >> . 8.37 ms (26509 KB) >> Creating Database... >> . 4.32 ms (27175 KB) >> Creating Database... >> . 11.38 ms (27175 KB) >> java.lang.InstantiationException: org.basex.modules.CR_xquery_31_20151217 >> at java.lang.Class.newInstance(Unknown Source) >> at >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> at org.basex.query.QueryParser.importModule(QueryParser.java:772) >> at org.basex.query.QueryParser.importModules(QueryParser.java:758) >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> at org.basex.core.Command.execute(Command.java:94) >> at >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> at org.basex.api.client.Session.execute(Session.java:36) >> at org.basex.core.CLI.execute(CLI.java:103) >> at org.basex.core.CLI.execute(CLI.java:87) >> at org.basex.BaseX.console(BaseX.java:191) >> at org.basex.BaseX.<init>(BaseX.java:166) >> at org.basex.BaseX.main(BaseX.java:42) >> Caused by: java.lang.NoSuchMethodException: >> org.basex.modules.CR_xquery_31_20151217.<init>() >> at java.lang.Class.getConstructor0(Unknown Source) >> ... 18 more >> org.basex.query.QueryException: Could not instantiate >> org.basex.modules.CR_xquery_31_20151217: >> org.basex.modules.CR_xquery_31_20151217. >> at org.basex.query.QueryError.get(QueryError.java:1343) >> at >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> at org.basex.query.QueryParser.importModule(QueryParser.java:772) >> at org.basex.query.QueryParser.importModules(QueryParser.java:758) >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> at org.basex.core.Command.execute(Command.java:94) >> at >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> at org.basex.api.client.Session.execute(Session.java:36) >> at org.basex.core.CLI.execute(CLI.java:103) >> at org.basex.core.CLI.execute(CLI.java:87) >> at org.basex.BaseX.console(BaseX.java:191) >> at org.basex.BaseX.<init>(BaseX.java:166) >> at org.basex.BaseX.main(BaseX.java:42) >> Caused by: java.lang.InstantiationException: >> org.basex.modules.CR_xquery_31_20151217 >> at java.lang.Class.newInstance(Unknown Source) >> at >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> ... 16 more >> Caused by: java.lang.NoSuchMethodException: >> org.basex.modules.CR_xquery_31_20151217.<init>() >> at java.lang.Class.getConstructor0(Unknown Source) >> ... 18 more >> org.basex.query.QueryException: Could not instantiate >> org.basex.modules.CR_xquery_31_20151217: >> org.basex.modules.CR_xquery_31_20151217. >> at org.basex.query.QueryError.get(QueryError.java:1343) >> at >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> at org.basex.query.QueryParser.importModule(QueryParser.java:772) >> at org.basex.query.QueryParser.importModules(QueryParser.java:758) >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> at org.basex.core.Command.execute(Command.java:94) >> at >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> at org.basex.api.client.Session.execute(Session.java:36) >> at org.basex.core.CLI.execute(CLI.java:103) >> at org.basex.core.CLI.execute(CLI.java:87) >> at org.basex.BaseX.console(BaseX.java:191) >> at org.basex.BaseX.<init>(BaseX.java:166) >> at org.basex.BaseX.main(BaseX.java:42) >> Caused by: java.lang.InstantiationException: >> org.basex.modules.CR_xquery_31_20151217 >> at java.lang.Class.newInstance(Unknown Source) >> at >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> ... 16 more >> Caused by: java.lang.NoSuchMethodException: >> org.basex.modules.CR_xquery_31_20151217.<init>() >> at java.lang.Class.getConstructor0(Unknown Source) >> ... 18 more >> org.basex.core.BaseXException: Stopped at ., 1/68: >> [XQST0059] Could not instantiate org.basex.modules.CR_xquery_31_20151217: >> org.basex.modules.CR_xquery_31_20151217. >> at org.basex.core.Command.execute(Command.java:101) >> at >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> at org.basex.api.client.Session.execute(Session.java:36) >> at org.basex.core.CLI.execute(CLI.java:103) >> at org.basex.core.CLI.execute(CLI.java:87) >> at org.basex.BaseX.console(BaseX.java:191) >> at org.basex.BaseX.<init>(BaseX.java:166) >> at org.basex.BaseX.main(BaseX.java:42) >> Caused by: org.basex.query.QueryException: Could not instantiate >> org.basex.modules.CR_xquery_31_20151217: >> org.basex.modules.CR_xquery_31_20151217. >> at org.basex.query.QueryError.get(QueryError.java:1343) >> at >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> at org.basex.query.QueryParser.importModule(QueryParser.java:772) >> at org.basex.query.QueryParser.importModules(QueryParser.java:758) >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> at org.basex.core.Command.execute(Command.java:94) >> ... 7 more >> Caused by: java.lang.InstantiationException: >> org.basex.modules.CR_xquery_31_20151217 >> at java.lang.Class.newInstance(Unknown Source) >> at >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> ... 16 more >> Caused by: java.lang.NoSuchMethodException: >> org.basex.modules.CR_xquery_31_20151217.<init>() >> at java.lang.Class.getConstructor0(Unknown Source) >> ... 18 more >> Stopped at ., 1/68: >> [XQST0059] Could not instantiate org.basex.modules.CR_xquery_31_20151217: >> org.basex.modules.CR_xquery_31_20151217. >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> >> wrote: >>> >>> > If instead I install it to the repo. It appears as >>> > "org.basex.modules.CR_xquery_31_20151217" >>> > but >>> > import module namespace p="org.basex.modules.CR_xquery_31_20151217"; >>> > Fails with >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >>> > org.basex.modules.CR_xquery_31_20151217 >>> > >>> > Any ideas where the problem could be? >>> >>> It sounds as if it’s not possible to create an instance of this class. >>> Could you possibly forward the stack trace (triggered by -d)? >> >> >
AB
Andy Bunce7 Apr 2016 19:05 #
I need to get deeper into Java. I can't see why Java's Default Constructor [1] rule does not apply here?
/Andy
http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9
Quoted text · Christian Grün · 231 lines
On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> wrote: > > No constructor is the issue. Adding > > public CR_xquery_31_20151217() {} > > to java src fixes it. > > Thanks! @Gunther: Do you think such a dummy constructor could be added > to the Java class? > > > > > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: > >> > >> C:\Program Files (x86)\BaseX\bin > >> +>basex -d > >> BaseX 8.4.3 beta d7bbbe7 [Standalone] > >> Try 'help' to get more information. > >> > xquery import module namespace > >> > p="org.basex.modules.CR_xquery_31_20151217";2 > >> Creating Database... > >> . 27.04 ms (25844 KB) > >> Creating Database... > >> . 4.83 ms (25844 KB) > >> Creating Database... > >> . 5.0 ms (25844 KB) > >> Creating Database... > >> . 3.52 ms (26509 KB) > >> Creating Database... > >> . 4.36 ms (26509 KB) > >> Creating Database... > >> . 8.26 ms (26509 KB) > >> Creating Database... > >> . 8.37 ms (26509 KB) > >> Creating Database... > >> . 4.32 ms (27175 KB) > >> Creating Database... > >> . 11.38 ms (27175 KB) > >> java.lang.InstantiationException: > org.basex.modules.CR_xquery_31_20151217 > >> at java.lang.Class.newInstance(Unknown Source) > >> at > >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> at > org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> at > org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> at org.basex.core.Command.execute(Command.java:94) > >> at > >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> at org.basex.api.client.Session.execute(Session.java:36) > >> at org.basex.core.CLI.execute(CLI.java:103) > >> at org.basex.core.CLI.execute(CLI.java:87) > >> at org.basex.BaseX.console(BaseX.java:191) > >> at org.basex.BaseX.<init>(BaseX.java:166) > >> at org.basex.BaseX.main(BaseX.java:42) > >> Caused by: java.lang.NoSuchMethodException: > >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> at java.lang.Class.getConstructor0(Unknown Source) > >> ... 18 more > >> org.basex.query.QueryException: Could not instantiate > >> org.basex.modules.CR_xquery_31_20151217: > >> org.basex.modules.CR_xquery_31_20151217. > >> at org.basex.query.QueryError.get(QueryError.java:1343) > >> at > >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >> at > org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> at > org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> at org.basex.core.Command.execute(Command.java:94) > >> at > >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> at org.basex.api.client.Session.execute(Session.java:36) > >> at org.basex.core.CLI.execute(CLI.java:103) > >> at org.basex.core.CLI.execute(CLI.java:87) > >> at org.basex.BaseX.console(BaseX.java:191) > >> at org.basex.BaseX.<init>(BaseX.java:166) > >> at org.basex.BaseX.main(BaseX.java:42) > >> Caused by: java.lang.InstantiationException: > >> org.basex.modules.CR_xquery_31_20151217 > >> at java.lang.Class.newInstance(Unknown Source) > >> at > >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> ... 16 more > >> Caused by: java.lang.NoSuchMethodException: > >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> at java.lang.Class.getConstructor0(Unknown Source) > >> ... 18 more > >> org.basex.query.QueryException: Could not instantiate > >> org.basex.modules.CR_xquery_31_20151217: > >> org.basex.modules.CR_xquery_31_20151217. > >> at org.basex.query.QueryError.get(QueryError.java:1343) > >> at > >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >> at > org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> at > org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> at org.basex.core.Command.execute(Command.java:94) > >> at > >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> at org.basex.api.client.Session.execute(Session.java:36) > >> at org.basex.core.CLI.execute(CLI.java:103) > >> at org.basex.core.CLI.execute(CLI.java:87) > >> at org.basex.BaseX.console(BaseX.java:191) > >> at org.basex.BaseX.<init>(BaseX.java:166) > >> at org.basex.BaseX.main(BaseX.java:42) > >> Caused by: java.lang.InstantiationException: > >> org.basex.modules.CR_xquery_31_20151217 > >> at java.lang.Class.newInstance(Unknown Source) > >> at > >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> ... 16 more > >> Caused by: java.lang.NoSuchMethodException: > >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> at java.lang.Class.getConstructor0(Unknown Source) > >> ... 18 more > >> org.basex.core.BaseXException: Stopped at ., 1/68: > >> [XQST0059] Could not instantiate > org.basex.modules.CR_xquery_31_20151217: > >> org.basex.modules.CR_xquery_31_20151217. > >> at org.basex.core.Command.execute(Command.java:101) > >> at > >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> at org.basex.api.client.Session.execute(Session.java:36) > >> at org.basex.core.CLI.execute(CLI.java:103) > >> at org.basex.core.CLI.execute(CLI.java:87) > >> at org.basex.BaseX.console(BaseX.java:191) > >> at org.basex.BaseX.<init>(BaseX.java:166) > >> at org.basex.BaseX.main(BaseX.java:42) > >> Caused by: org.basex.query.QueryException: Could not instantiate > >> org.basex.modules.CR_xquery_31_20151217: > >> org.basex.modules.CR_xquery_31_20151217. > >> at org.basex.query.QueryError.get(QueryError.java:1343) > >> at > >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >> at > org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> at > org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> at org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> at org.basex.core.Command.execute(Command.java:94) > >> ... 7 more > >> Caused by: java.lang.InstantiationException: > >> org.basex.modules.CR_xquery_31_20151217 > >> at java.lang.Class.newInstance(Unknown Source) > >> at > >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> ... 16 more > >> Caused by: java.lang.NoSuchMethodException: > >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> at java.lang.Class.getConstructor0(Unknown Source) > >> ... 18 more > >> Stopped at ., 1/68: > >> [XQST0059] Could not instantiate > org.basex.modules.CR_xquery_31_20151217: > >> org.basex.modules.CR_xquery_31_20151217. > >> > > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> > >> wrote: > >>> > >>> > If instead I install it to the repo. It appears as > >>> > "org.basex.modules.CR_xquery_31_20151217" > >>> > but > >>> > import module namespace p="org.basex.modules.CR_xquery_31_20151217"; > >>> > Fails with > >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > >>> > org.basex.modules.CR_xquery_31_20151217 > >>> > > >>> > Any ideas where the problem could be? > >>> > >>> It sounds as if it’s not possible to create an instance of this class. > >>> Could you possibly forward the stack trace (triggered by -d)? > >> > >> > > >
CG
Christian Grün7 Apr 2016 19:34 #
Quoted text · Andy Bunce · 1 line
> I can't see why Java's Default Constructor [1] rule does not apply here?
Well, me neither ;) Maybe it’s got to do with the way we instantiate the class via reflection? I didn’t track this down yet (I should probably do so).
Quoted text · Andy Bunce · 240 lines
> /Andy > http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 > > On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> wrote: >> >> > No constructor is the issue. Adding >> > public CR_xquery_31_20151217() {} >> > to java src fixes it. >> >> Thanks! @Gunther: Do you think such a dummy constructor could be added >> to the Java class? >> >> >> >> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: >> >> >> >> C:\Program Files (x86)\BaseX\bin >> >> +>basex -d >> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >> >> Try 'help' to get more information. >> >> > xquery import module namespace >> >> > p="org.basex.modules.CR_xquery_31_20151217";2 >> >> Creating Database... >> >> . 27.04 ms (25844 KB) >> >> Creating Database... >> >> . 4.83 ms (25844 KB) >> >> Creating Database... >> >> . 5.0 ms (25844 KB) >> >> Creating Database... >> >> . 3.52 ms (26509 KB) >> >> Creating Database... >> >> . 4.36 ms (26509 KB) >> >> Creating Database... >> >> . 8.26 ms (26509 KB) >> >> Creating Database... >> >> . 8.37 ms (26509 KB) >> >> Creating Database... >> >> . 4.32 ms (27175 KB) >> >> Creating Database... >> >> . 11.38 ms (27175 KB) >> >> java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> org.basex.query.QueryException: Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> ... 16 more >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> org.basex.query.QueryException: Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> ... 16 more >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> org.basex.core.BaseXException: Stopped at ., 1/68: >> >> [XQST0059] Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.core.Command.execute(Command.java:101) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: org.basex.query.QueryException: Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> ... 7 more >> >> Caused by: java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> ... 16 more >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> Stopped at ., 1/68: >> >> [XQST0059] Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> >> >> wrote: >> >>> >> >>> > If instead I install it to the repo. It appears as >> >>> > "org.basex.modules.CR_xquery_31_20151217" >> >>> > but >> >>> > import module namespace p="org.basex.modules.CR_xquery_31_20151217"; >> >>> > Fails with >> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >> >>> > org.basex.modules.CR_xquery_31_20151217 >> >>> > >> >>> > Any ideas where the problem could be? >> >>> >> >>> It sounds as if it’s not possible to create an instance of this class. >> >>> Could you possibly forward the stack trace (triggered by -d)? >> >> >> >> >> > > >
GR
Gunther Rademacher7 Apr 2016 23:54 #
Hi Andy, Christian,
a default constructor is added implicitly, when a class does not provide any constructors itself. A REx-generated class however comes with a constructor. In that case any instantiation must provide arguments for some defined constructor.
However I do not see a real reason for instantiating the class at load time. The generated parse function is static and it takes care of instantiating a parser object internally.
I just did a quick test and found that I see this instantiating problem when using "import module namespace ...". No problem when using "declare namespace ...." or just an EQName literal instead. I have put my extension function class files into the classpath for checking this.
Am I missing something here?
Best regards
Gunther
Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr
Quoted text · Christian Grün · 248 lines
Von: "Christian Grün" <christian.gruen at gmail.com> An: "Andy Bunce" <bunce.andy at gmail.com> Cc: "Gunther Rademacher" <grd at gmx.net>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > I can't see why Java's Default Constructor [1] rule does not apply here? Well, me neither ;) Maybe it’s got to do with the way we instantiate the class via reflection? I didn’t track this down yet (I should probably do so). > /Andy > http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 > > On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> wrote: >> >> > No constructor is the issue. Adding >> > public CR_xquery_31_20151217() {} >> > to java src fixes it. >> >> Thanks! @Gunther: Do you think such a dummy constructor could be added >> to the Java class? >> >> >> >> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: >> >> >> >> C:\Program Files (x86)\BaseX\bin >> >> +>basex -d >> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >> >> Try 'help' to get more information. >> >> > xquery import module namespace >> >> > p="org.basex.modules.CR_xquery_31_20151217";2 >> >> Creating Database... >> >> . 27.04 ms (25844 KB) >> >> Creating Database... >> >> . 4.83 ms (25844 KB) >> >> Creating Database... >> >> . 5.0 ms (25844 KB) >> >> Creating Database... >> >> . 3.52 ms (26509 KB) >> >> Creating Database... >> >> . 4.36 ms (26509 KB) >> >> Creating Database... >> >> . 8.26 ms (26509 KB) >> >> Creating Database... >> >> . 8.37 ms (26509 KB) >> >> Creating Database... >> >> . 4.32 ms (27175 KB) >> >> Creating Database... >> >> . 11.38 ms (27175 KB) >> >> java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> org.basex.query.QueryException: Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> ... 16 more >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> org.basex.query.QueryException: Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> ... 16 more >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> org.basex.core.BaseXException: Stopped at ., 1/68: >> >> [XQST0059] Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.core.Command.execute(Command.java:101) >> >> at >> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> at org.basex.BaseX.console(BaseX.java:191) >> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> at org.basex.BaseX.main(BaseX.java:42) >> >> Caused by: org.basex.query.QueryException: Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> at >> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> at >> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> at >> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> at org.basex.core.Command.execute(Command.java:94) >> >> ... 7 more >> >> Caused by: java.lang.InstantiationException: >> >> org.basex.modules.CR_xquery_31_20151217 >> >> at java.lang.Class.newInstance(Unknown Source) >> >> at >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> ... 16 more >> >> Caused by: java.lang.NoSuchMethodException: >> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> ... 18 more >> >> Stopped at ., 1/68: >> >> [XQST0059] Could not instantiate >> >> org.basex.modules.CR_xquery_31_20151217: >> >> org.basex.modules.CR_xquery_31_20151217. >> >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> >> >> wrote: >> >>> >> >>> > If instead I install it to the repo. It appears as >> >>> > "org.basex.modules.CR_xquery_31_20151217" >> >>> > but >> >>> > import module namespace p="org.basex.modules.CR_xquery_31_20151217"; >> >>> > Fails with >> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >> >>> > org.basex.modules.CR_xquery_31_20151217 >> >>> > >> >>> > Any ideas where the problem could be? >> >>> >> >>> It sounds as if it’s not possible to create an instance of this class. >> >>> Could you possibly forward the stack trace (triggered by -d)? >> >> >> >> >> > > >
CG
Christian Grün8 Apr 2016 08:55 #
Hi Gunther,
I agree, it wouldn’t make too much sense to add a default constructor to your code as long as there is the one-argument constructor that will be called by the parseXQuery function.
The reason why a default constructor is required in BaseX is because "import module" will always create an instance of the imported Java class, which can then be addressed in the XQuery code, using the assigned prefix [1].
@Andy: For creating a BaseX module, you could add another simple Java class, which will then call the actual parser class:
import org.basex.query.value.item.Str;
import org.basex.query.value.node.ANode;
public class XQuery31Parser {
public ANode parseXQuery(Str str) throws IOException {
return CR_xquery_31_20151217.parseXQuery(str);
}
}Hope this helps,
Christian
[1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports
Quoted text · Gunther Rademacher · 278 lines
On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: > Hi Andy, Christian, > > a default constructor is added implicitly, when a class does not provide any > constructors itself. A REx-generated class however comes with a constructor. > In that case any instantiation must provide arguments for some defined > constructor. > > However I do not see a real reason for instantiating the class at load time. > The generated parse function is static and it takes care of instantiating a > parser object internally. > > I just did a quick test and found that I see this instantiating problem when > using "import module namespace ...". No problem when using "declare > namespace ...." or just an EQName literal instead. I have put my extension > function class files into the classpath for checking this. > > Am I missing something here? > > Best regards > Gunther > > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > Von: "Christian Grün" <christian.gruen at gmail.com> > An: "Andy Bunce" <bunce.andy at gmail.com> > Cc: "Gunther Rademacher" <grd at gmx.net>, "basex-talk at mailman.uni-konstanz.de" > <basex-talk at mailman.uni-konstanz.de> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo >> I can't see why Java's Default Constructor [1] rule does not apply here? > > Well, me neither ;) Maybe it’s got to do with the way we instantiate > the class via reflection? I didn’t track this down yet (I should > probably do so). > > >> /Andy >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> >> wrote: >>> >>> > No constructor is the issue. Adding >>> > public CR_xquery_31_20151217() {} >>> > to java src fixes it. >>> >>> Thanks! @Gunther: Do you think such a dummy constructor could be added >>> to the Java class? >>> >>> >>> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: >>> >> >>> >> C:\Program Files (x86)\BaseX\bin >>> >> +>basex -d >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >>> >> Try 'help' to get more information. >>> >> > xquery import module namespace >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 >>> >> Creating Database... >>> >> . 27.04 ms (25844 KB) >>> >> Creating Database... >>> >> . 4.83 ms (25844 KB) >>> >> Creating Database... >>> >> . 5.0 ms (25844 KB) >>> >> Creating Database... >>> >> . 3.52 ms (26509 KB) >>> >> Creating Database... >>> >> . 4.36 ms (26509 KB) >>> >> Creating Database... >>> >> . 8.26 ms (26509 KB) >>> >> Creating Database... >>> >> . 8.37 ms (26509 KB) >>> >> Creating Database... >>> >> . 4.32 ms (27175 KB) >>> >> Creating Database... >>> >> . 11.38 ms (27175 KB) >>> >> java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: >>> >> [XQST0059] Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.core.Command.execute(Command.java:101) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> ... 7 more >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> Stopped at ., 1/68: >>> >> [XQST0059] Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> > >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> >>> >> wrote: >>> >>> >>> >>> > If instead I install it to the repo. It appears as >>> >>> > "org.basex.modules.CR_xquery_31_20151217" >>> >>> > but >>> >>> > import module namespace >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; >>> >>> > Fails with >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >>> >>> > org.basex.modules.CR_xquery_31_20151217 >>> >>> > >>> >>> > Any ideas where the problem could be? >>> >>> >>> >>> It sounds as if it’s not possible to create an instance of this >>> >>> class. >>> >>> Could you possibly forward the stack trace (triggered by -d)? >>> >> >>> >> >>> > >> >>
GR
Gunther Rademacher8 Apr 2016 11:09 #
Hi Christian,
but it the instantiation occurs only when the calling code uses "declare module", right? I still can't see a problem when just declaring the namespace properly.
It remains unclear to me why "declare module" would be necessary here. Is that because the calling code should be the same, regardless of using an XQuery module or a Java coded module? But isn't the Java variant supposed to have a URI using the "java:" scheme? I noticed that this is not enforced, though.
Best regards
Gunther
Gesendet: Freitag, 08. April 2016 um 08:55 Uhr
Quoted text · Christian Grün · 302 lines
Von: "Christian Grün" <christian.gruen at gmail.com> An: "Gunther Rademacher" <grd at gmx.net> Cc: "Andy Bunce" <bunce.andy at gmail.com>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo Hi Gunther, I agree, it wouldn’t make too much sense to add a default constructor to your code as long as there is the one-argument constructor that will be called by the parseXQuery function. The reason why a default constructor is required in BaseX is because "import module" will always create an instance of the imported Java class, which can then be addressed in the XQuery code, using the assigned prefix [1]. @Andy: For creating a BaseX module, you could add another simple Java class, which will then call the actual parser class: import org.basex.query.value.item.Str; import org.basex.query.value.node.ANode; public class XQuery31Parser { public ANode parseXQuery(Str str) throws IOException { return CR_xquery_31_20151217.parseXQuery(str); } } Hope this helps, Christian [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: > Hi Andy, Christian, > > a default constructor is added implicitly, when a class does not provide any > constructors itself. A REx-generated class however comes with a constructor. > In that case any instantiation must provide arguments for some defined > constructor. > > However I do not see a real reason for instantiating the class at load time. > The generated parse function is static and it takes care of instantiating a > parser object internally. > > I just did a quick test and found that I see this instantiating problem when > using "import module namespace ...". No problem when using "declare > namespace ...." or just an EQName literal instead. I have put my extension > function class files into the classpath for checking this. > > Am I missing something here? > > Best regards > Gunther > > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > Von: "Christian Grün" <christian.gruen at gmail.com> > An: "Andy Bunce" <bunce.andy at gmail.com> > Cc: "Gunther Rademacher" <grd at gmx.net>, "basex-talk at mailman.uni-konstanz.de" > <basex-talk at mailman.uni-konstanz.de> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo >> I can't see why Java's Default Constructor [1] rule does not apply here? > > Well, me neither ;) Maybe it’s got to do with the way we instantiate > the class via reflection? I didn’t track this down yet (I should > probably do so). > > >> /Andy >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> >> wrote: >>> >>> > No constructor is the issue. Adding >>> > public CR_xquery_31_20151217() {} >>> > to java src fixes it. >>> >>> Thanks! @Gunther: Do you think such a dummy constructor could be added >>> to the Java class? >>> >>> >>> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: >>> >> >>> >> C:\Program Files (x86)\BaseX\bin >>> >> +>basex -d >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >>> >> Try 'help' to get more information. >>> >> > xquery import module namespace >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 >>> >> Creating Database... >>> >> . 27.04 ms (25844 KB) >>> >> Creating Database... >>> >> . 4.83 ms (25844 KB) >>> >> Creating Database... >>> >> . 5.0 ms (25844 KB) >>> >> Creating Database... >>> >> . 3.52 ms (26509 KB) >>> >> Creating Database... >>> >> . 4.36 ms (26509 KB) >>> >> Creating Database... >>> >> . 8.26 ms (26509 KB) >>> >> Creating Database... >>> >> . 8.37 ms (26509 KB) >>> >> Creating Database... >>> >> . 4.32 ms (27175 KB) >>> >> Creating Database... >>> >> . 11.38 ms (27175 KB) >>> >> java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: >>> >> [XQST0059] Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.core.Command.execute(Command.java:101) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> ... 7 more >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> Stopped at ., 1/68: >>> >> [XQST0059] Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> > >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> >>> >> wrote: >>> >>> >>> >>> > If instead I install it to the repo. It appears as >>> >>> > "org.basex.modules.CR_xquery_31_20151217" >>> >>> > but >>> >>> > import module namespace >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; >>> >>> > Fails with >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >>> >>> > org.basex.modules.CR_xquery_31_20151217 >>> >>> > >>> >>> > Any ideas where the problem could be? >>> >>> >>> >>> It sounds as if it’s not possible to create an instance of this >>> >>> class. >>> >>> Could you possibly forward the stack trace (triggered by -d)? >>> >> >>> >> >>> > >> >>
GR
Gunther Rademacher8 Apr 2016 11:30 #
...sorry, I mixed up "declare" and "import" in my previous post. It should have been:
Hi Christian,
but the instantiation occurs only when the calling code uses "import module", right? I still can't see a problem when just declaring the namespace properly.
It remains unclear to me why "import module" would be necessary here. Is that because the calling code should be the same, regardless of using an XQuery module or a Java coded module? But isn't the Java variant supposed to have a URI using the "java:" scheme? I noticed that this is not enforced, though.
Best regards
Gunther
Gesendet: Freitag, 08. April 2016 um 08:55 Uhr
Quoted text · Christian Grün · 302 lines
Von: "Christian Grün" <christian.gruen at gmail.com> An: "Gunther Rademacher" <grd at gmx.net> Cc: "Andy Bunce" <bunce.andy at gmail.com>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo Hi Gunther, I agree, it wouldn’t make too much sense to add a default constructor to your code as long as there is the one-argument constructor that will be called by the parseXQuery function. The reason why a default constructor is required in BaseX is because "import module" will always create an instance of the imported Java class, which can then be addressed in the XQuery code, using the assigned prefix [1]. @Andy: For creating a BaseX module, you could add another simple Java class, which will then call the actual parser class: import org.basex.query.value.item.Str; import org.basex.query.value.node.ANode; public class XQuery31Parser { public ANode parseXQuery(Str str) throws IOException { return CR_xquery_31_20151217.parseXQuery(str); } } Hope this helps, Christian [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: > Hi Andy, Christian, > > a default constructor is added implicitly, when a class does not provide any > constructors itself. A REx-generated class however comes with a constructor. > In that case any instantiation must provide arguments for some defined > constructor. > > However I do not see a real reason for instantiating the class at load time. > The generated parse function is static and it takes care of instantiating a > parser object internally. > > I just did a quick test and found that I see this instantiating problem when > using "import module namespace ...". No problem when using "declare > namespace ...." or just an EQName literal instead. I have put my extension > function class files into the classpath for checking this. > > Am I missing something here? > > Best regards > Gunther > > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > Von: "Christian Grün" <christian.gruen at gmail.com> > An: "Andy Bunce" <bunce.andy at gmail.com> > Cc: "Gunther Rademacher" <grd at gmx.net>, "basex-talk at mailman.uni-konstanz.de" > <basex-talk at mailman.uni-konstanz.de> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo >> I can't see why Java's Default Constructor [1] rule does not apply here? > > Well, me neither ;) Maybe it’s got to do with the way we instantiate > the class via reflection? I didn’t track this down yet (I should > probably do so). > > >> /Andy >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> >> wrote: >>> >>> > No constructor is the issue. Adding >>> > public CR_xquery_31_20151217() {} >>> > to java src fixes it. >>> >>> Thanks! @Gunther: Do you think such a dummy constructor could be added >>> to the Java class? >>> >>> >>> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: >>> >> >>> >> C:\Program Files (x86)\BaseX\bin >>> >> +>basex -d >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >>> >> Try 'help' to get more information. >>> >> > xquery import module namespace >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 >>> >> Creating Database... >>> >> . 27.04 ms (25844 KB) >>> >> Creating Database... >>> >> . 4.83 ms (25844 KB) >>> >> Creating Database... >>> >> . 5.0 ms (25844 KB) >>> >> Creating Database... >>> >> . 3.52 ms (26509 KB) >>> >> Creating Database... >>> >> . 4.36 ms (26509 KB) >>> >> Creating Database... >>> >> . 8.26 ms (26509 KB) >>> >> Creating Database... >>> >> . 8.37 ms (26509 KB) >>> >> Creating Database... >>> >> . 4.32 ms (27175 KB) >>> >> Creating Database... >>> >> . 11.38 ms (27175 KB) >>> >> java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: >>> >> [XQST0059] Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.core.Command.execute(Command.java:101) >>> >> at >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >>> >> at org.basex.api.client.Session.execute(Session.java:36) >>> >> at org.basex.core.CLI.execute(CLI.java:103) >>> >> at org.basex.core.CLI.execute(CLI.java:87) >>> >> at org.basex.BaseX.console(BaseX.java:191) >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >>> >> at org.basex.BaseX.main(BaseX.java:42) >>> >> Caused by: org.basex.query.QueryException: Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >>> >> at >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >>> >> at >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >>> >> at >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >>> >> at org.basex.core.Command.execute(Command.java:94) >>> >> ... 7 more >>> >> Caused by: java.lang.InstantiationException: >>> >> org.basex.modules.CR_xquery_31_20151217 >>> >> at java.lang.Class.newInstance(Unknown Source) >>> >> at >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >>> >> ... 16 more >>> >> Caused by: java.lang.NoSuchMethodException: >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >>> >> at java.lang.Class.getConstructor0(Unknown Source) >>> >> ... 18 more >>> >> Stopped at ., 1/68: >>> >> [XQST0059] Could not instantiate >>> >> org.basex.modules.CR_xquery_31_20151217: >>> >> org.basex.modules.CR_xquery_31_20151217. >>> >> > >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> >>> >> wrote: >>> >>> >>> >>> > If instead I install it to the repo. It appears as >>> >>> > "org.basex.modules.CR_xquery_31_20151217" >>> >>> > but >>> >>> > import module namespace >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; >>> >>> > Fails with >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >>> >>> > org.basex.modules.CR_xquery_31_20151217 >>> >>> > >>> >>> > Any ideas where the problem could be? >>> >>> >>> >>> It sounds as if it’s not possible to create an instance of this >>> >>> class. >>> >>> Could you possibly forward the stack trace (triggered by -d)? >>> >> >>> >> >>> > >> >>
AB
Andy Bunce8 Apr 2016 11:34 #
Hi,
I want a solution that lives in the repository. This is to allow installation to be automated. That is not to require users to manually place jar files and/or edit classpaths. I think this requires the "import module" form.
I am happy to go with Christian's Java extra class or maybe Ex-path xar packaging with a small XQuery module and the existing jar in order to achieve this.
Thanks
/Andy
Quoted text · Gunther Rademacher · 351 lines
On 8 April 2016 at 10:30, Gunther Rademacher <grd at gmx.net> wrote: > ...sorry, I mixed up "declare" and "import" in my previous post. It should > have been: > > > Hi Christian, > > but the instantiation occurs only when the calling code uses "*import *module", > right? I still can't see a problem when just *declaring *the namespace > properly. > > It remains unclear to me why "*import *module" would be necessary here. > Is that because the calling code should be the same, regardless of using an > XQuery module or a Java coded module? But isn't the Java variant supposed > to have a URI using the "java:" scheme? I noticed that this is not > enforced, though. > > Best regards > Gunther > > > *Gesendet:* Freitag, 08. April 2016 um 08:55 Uhr > *Von:* "Christian Grün" <christian.gruen at gmail.com> > *An:* "Gunther Rademacher" <grd at gmx.net> > *Cc:* "Andy Bunce" <bunce.andy at gmail.com>, " > basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > *Betreff:* Re: Re: [basex-talk] Problem deleting jar packaged item from > repo > Hi Gunther, > > I agree, it wouldn’t make too much sense to add a default constructor > to your code as long as there is the one-argument constructor that > will be called by the parseXQuery function. > > The reason why a default constructor is required in BaseX is because > "import module" will always create an instance of the imported Java > class, which can then be addressed in the XQuery code, using the > assigned prefix [1]. > > @Andy: For creating a BaseX module, you could add another simple Java > class, which will then call the actual parser class: > > import org.basex.query.value.item.Str; > import org.basex.query.value.node.ANode; > public class XQuery31Parser { > public ANode parseXQuery(Str str) throws IOException { > return CR_xquery_31_20151217.parseXQuery(str); > } > } > > Hope this helps, > Christian > > [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports > > > > On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: > > Hi Andy, Christian, > > > > a default constructor is added implicitly, when a class does not provide > any > > constructors itself. A REx-generated class however comes with a > constructor. > > In that case any instantiation must provide arguments for some defined > > constructor. > > > > However I do not see a real reason for instantiating the class at load > time. > > The generated parse function is static and it takes care of > instantiating a > > parser object internally. > > > > I just did a quick test and found that I see this instantiating problem > when > > using "import module namespace ...". No problem when using "declare > > namespace ...." or just an EQName literal instead. I have put my > extension > > function class files into the classpath for checking this. > > > > Am I missing something here? > > > > Best regards > > Gunther > > > > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > > Von: "Christian Grün" <christian.gruen at gmail.com> > > An: "Andy Bunce" <bunce.andy at gmail.com> > > Cc: "Gunther Rademacher" <grd at gmx.net>, " > basex-talk at mailman.uni-konstanz.de" > > <basex-talk at mailman.uni-konstanz.de> > > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > >> I can't see why Java's Default Constructor [1] rule does not apply here? > > > > Well, me neither ;) Maybe it’s got to do with the way we instantiate > > the class via reflection? I didn’t track this down yet (I should > > probably do so). > > > > > >> /Andy > >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 > >> > >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> > >> wrote: > >>> > >>> > No constructor is the issue. Adding > >>> > public CR_xquery_31_20151217() {} > >>> > to java src fixes it. > >>> > >>> Thanks! @Gunther: Do you think such a dummy constructor could be added > >>> to the Java class? > >>> > >>> > >>> > >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: > >>> >> > >>> >> C:\Program Files (x86)\BaseX\bin > >>> >> +>basex -d > >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] > >>> >> Try 'help' to get more information. > >>> >> > xquery import module namespace > >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 > >>> >> Creating Database... > >>> >> . 27.04 ms (25844 KB) > >>> >> Creating Database... > >>> >> . 4.83 ms (25844 KB) > >>> >> Creating Database... > >>> >> . 5.0 ms (25844 KB) > >>> >> Creating Database... > >>> >> . 3.52 ms (26509 KB) > >>> >> Creating Database... > >>> >> . 4.36 ms (26509 KB) > >>> >> Creating Database... > >>> >> . 8.26 ms (26509 KB) > >>> >> Creating Database... > >>> >> . 8.37 ms (26509 KB) > >>> >> Creating Database... > >>> >> . 4.32 ms (27175 KB) > >>> >> Creating Database... > >>> >> . 11.38 ms (27175 KB) > >>> >> java.lang.InstantiationException: > >>> >> org.basex.modules.CR_xquery_31_20151217 > >>> >> at java.lang.Class.newInstance(Unknown Source) > >>> >> at > >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >>> >> at > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >>> >> at > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >>> >> at > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >>> >> at org.basex.core.Command.execute(Command.java:94) > >>> >> at > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >>> >> at org.basex.BaseX.console(BaseX.java:191) > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >>> >> at org.basex.BaseX.main(BaseX.java:42) > >>> >> Caused by: java.lang.NoSuchMethodException: > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >>> >> ... 18 more > >>> >> org.basex.query.QueryException: Could not instantiate > >>> >> org.basex.modules.CR_xquery_31_20151217: > >>> >> org.basex.modules.CR_xquery_31_20151217. > >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > >>> >> at > >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >>> >> at > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >>> >> at > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >>> >> at > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >>> >> at org.basex.core.Command.execute(Command.java:94) > >>> >> at > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >>> >> at org.basex.BaseX.console(BaseX.java:191) > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >>> >> at org.basex.BaseX.main(BaseX.java:42) > >>> >> Caused by: java.lang.InstantiationException: > >>> >> org.basex.modules.CR_xquery_31_20151217 > >>> >> at java.lang.Class.newInstance(Unknown Source) > >>> >> at > >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >>> >> ... 16 more > >>> >> Caused by: java.lang.NoSuchMethodException: > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >>> >> ... 18 more > >>> >> org.basex.query.QueryException: Could not instantiate > >>> >> org.basex.modules.CR_xquery_31_20151217: > >>> >> org.basex.modules.CR_xquery_31_20151217. > >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > >>> >> at > >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >>> >> at > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >>> >> at > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >>> >> at > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >>> >> at org.basex.core.Command.execute(Command.java:94) > >>> >> at > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >>> >> at org.basex.BaseX.console(BaseX.java:191) > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >>> >> at org.basex.BaseX.main(BaseX.java:42) > >>> >> Caused by: java.lang.InstantiationException: > >>> >> org.basex.modules.CR_xquery_31_20151217 > >>> >> at java.lang.Class.newInstance(Unknown Source) > >>> >> at > >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >>> >> ... 16 more > >>> >> Caused by: java.lang.NoSuchMethodException: > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >>> >> ... 18 more > >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: > >>> >> [XQST0059] Could not instantiate > >>> >> org.basex.modules.CR_xquery_31_20151217: > >>> >> org.basex.modules.CR_xquery_31_20151217. > >>> >> at org.basex.core.Command.execute(Command.java:101) > >>> >> at > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >>> >> at org.basex.BaseX.console(BaseX.java:191) > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >>> >> at org.basex.BaseX.main(BaseX.java:42) > >>> >> Caused by: org.basex.query.QueryException: Could not instantiate > >>> >> org.basex.modules.CR_xquery_31_20151217: > >>> >> org.basex.modules.CR_xquery_31_20151217. > >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > >>> >> at > >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >>> >> at > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >>> >> at > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >>> >> at > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >>> >> at org.basex.core.Command.execute(Command.java:94) > >>> >> ... 7 more > >>> >> Caused by: java.lang.InstantiationException: > >>> >> org.basex.modules.CR_xquery_31_20151217 > >>> >> at java.lang.Class.newInstance(Unknown Source) > >>> >> at > >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >>> >> ... 16 more > >>> >> Caused by: java.lang.NoSuchMethodException: > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >>> >> ... 18 more > >>> >> Stopped at ., 1/68: > >>> >> [XQST0059] Could not instantiate > >>> >> org.basex.modules.CR_xquery_31_20151217: > >>> >> org.basex.modules.CR_xquery_31_20151217. > >>> >> > > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > >>> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com > > > >>> >> wrote: > >>> >>> > >>> >>> > If instead I install it to the repo. It appears as > >>> >>> > "org.basex.modules.CR_xquery_31_20151217" > >>> >>> > but > >>> >>> > import module namespace > >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; > >>> >>> > Fails with > >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > >>> >>> > org.basex.modules.CR_xquery_31_20151217 > >>> >>> > > >>> >>> > Any ideas where the problem could be? > >>> >>> > >>> >>> It sounds as if it’s not possible to create an instance of this > >>> >>> class. > >>> >>> Could you possibly forward the stack trace (triggered by -d)? > >>> >> > >>> >> > >>> > > >> > >> >
GR
Gunther Rademacher8 Apr 2016 12:45 #
Hi Andy,
thanks for the hint, it helped me reproducing the problem.
Well, if a BaseX repository module needs a zero argument constructor, it makes sense to have REx create one as an effect of the -basex option. Will take care of this.
Best regards
Gunther
Gesendet: Freitag, 08. April 2016 um 11:34 Uhr
Quoted text · Andy Bunce · 677 lines
Von: "Andy Bunce" <bunce.andy at gmail.com> An: "Gunther Rademacher" <grd at gmx.net> Cc: "Christian Grün" <christian.gruen at gmail.com>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo Hi, I want a solution that lives in the repository. This is to allow installation to be automated. That is not to require users to manually place jar files and/or edit classpaths. I think this requires the "import module" form. I am happy to go with Christian's Java extra class or maybe Ex-path xar packaging with a small XQuery module and the existing jar in order to achieve this. Thanks /Andy On 8 April 2016 at 10:30, Gunther Rademacher <grd at gmx.net> wrote: > ...sorry, I mixed up "declare" and "import" in my previous post. It should have been: > > > > > > > > > Hi Christian, > > > > > > but the instantiation occurs only when the calling code uses "import module", right? I still can't see a problem when just declaring the namespace properly. > > > > > > It remains unclear to me why "import module" would be necessary here. Is that because the calling code should be the same, regardless of using an XQuery module or a Java coded module? But isn't the Java variant supposed to have a URI using the "java:" scheme? I noticed that this is not enforced, though. > > > > > > > > Best regards > > > Gunther > > > > > > > > > > > Gesendet: Freitag, 08. April 2016 um 08:55 Uhr > > Von: "Christian Grün" <christian.gruen at gmail.com> > > An: "Gunther Rademacher" <grd at gmx.net> > > Cc: "Andy Bunce" <bunce.andy at gmail.com>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo > > > Hi Gunther, > > > > I agree, it wouldn’t make too much sense to add a default constructor > > to your code as long as there is the one-argument constructor that > > will be called by the parseXQuery function. > > > > The reason why a default constructor is required in BaseX is because > > "import module" will always create an instance of the imported Java > > class, which can then be addressed in the XQuery code, using the > > assigned prefix [1]. > > > > @Andy: For creating a BaseX module, you could add another simple Java > > class, which will then call the actual parser class: > > > > import org.basex.query.value.item.Str; > > import org.basex.query.value.node.ANode; > > public class XQuery31Parser { > > public ANode parseXQuery(Str str) throws IOException { > > return CR_xquery_31_20151217.parseXQuery(str); > > } > > } > > > > Hope this helps, > > Christian > > > > [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports > > > > > > > > On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: > > > Hi Andy, Christian, > > > > > > a default constructor is added implicitly, when a class does not provide any > > > constructors itself. A REx-generated class however comes with a constructor. > > > In that case any instantiation must provide arguments for some defined > > > constructor. > > > > > > However I do not see a real reason for instantiating the class at load time. > > > The generated parse function is static and it takes care of instantiating a > > > parser object internally. > > > > > > I just did a quick test and found that I see this instantiating problem when > > > using "import module namespace ...". No problem when using "declare > > > namespace ...." or just an EQName literal instead. I have put my extension > > > function class files into the classpath for checking this. > > > > > > Am I missing something here? > > > > > > Best regards > > > Gunther > > > > > > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > > > Von: "Christian Grün" <christian.gruen at gmail.com> > > > An: "Andy Bunce" <bunce.andy at gmail.com> > > > Cc: "Gunther Rademacher" <grd at gmx.net>, "basex-talk at mailman.uni-konstanz.de" > > > <basex-talk at mailman.uni-konstanz.de> > > > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > > >> I can't see why Java's Default Constructor [1] rule does not apply here? > > > > > > Well, me neither ;) Maybe it’s got to do with the way we instantiate > > > the class via reflection? I didn’t track this down yet (I should > > > probably do so). > > > > > > > > >> /Andy > > >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 > > >> > > >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> > > >> wrote: > > >>> > > >>> > No constructor is the issue. Adding > > >>> > public CR_xquery_31_20151217() {} > > >>> > to java src fixes it. > > >>> > > >>> Thanks! @Gunther: Do you think such a dummy constructor could be added > > >>> to the Java class? > > >>> > > >>> > > >>> > > >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: > > >>> >> > > >>> >> C:\Program Files (x86)\BaseX\bin > > >>> >> +>basex -d > > >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] > > >>> >> Try 'help' to get more information. > > >>> >> > xquery import module namespace > > >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 > > >>> >> Creating Database... > > >>> >> . 27.04 ms (25844 KB) > > >>> >> Creating Database... > > >>> >> . 4.83 ms (25844 KB) > > >>> >> Creating Database... > > >>> >> . 5.0 ms (25844 KB) > > >>> >> Creating Database... > > >>> >> . 3.52 ms (26509 KB) > > >>> >> Creating Database... > > >>> >> . 4.36 ms (26509 KB) > > >>> >> Creating Database... > > >>> >> . 8.26 ms (26509 KB) > > >>> >> Creating Database... > > >>> >> . 8.37 ms (26509 KB) > > >>> >> Creating Database... > > >>> >> . 4.32 ms (27175 KB) > > >>> >> Creating Database... > > >>> >> . 11.38 ms (27175 KB) > > >>> >> java.lang.InstantiationException: > > >>> >> org.basex.modules.CR_xquery_31_20151217 > > >>> >> at java.lang.Class.newInstance(Unknown Source) > > >>> >> at > > >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >>> >> at > > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >>> >> at org.basex.core.Command.execute(Command.java:94) > > >>> >> at > > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >>> >> Caused by: java.lang.NoSuchMethodException: > > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >>> >> ... 18 more > > >>> >> org.basex.query.QueryException: Could not instantiate > > >>> >> org.basex.modules.CR_xquery_31_20151217: > > >>> >> org.basex.modules.CR_xquery_31_20151217. > > >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > >>> >> at > > >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >>> >> at > > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >>> >> at org.basex.core.Command.execute(Command.java:94) > > >>> >> at > > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >>> >> Caused by: java.lang.InstantiationException: > > >>> >> org.basex.modules.CR_xquery_31_20151217 > > >>> >> at java.lang.Class.newInstance(Unknown Source) > > >>> >> at > > >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >>> >> ... 16 more > > >>> >> Caused by: java.lang.NoSuchMethodException: > > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >>> >> ... 18 more > > >>> >> org.basex.query.QueryException: Could not instantiate > > >>> >> org.basex.modules.CR_xquery_31_20151217: > > >>> >> org.basex.modules.CR_xquery_31_20151217. > > >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > >>> >> at > > >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >>> >> at > > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >>> >> at org.basex.core.Command.execute(Command.java:94) > > >>> >> at > > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >>> >> Caused by: java.lang.InstantiationException: > > >>> >> org.basex.modules.CR_xquery_31_20151217 > > >>> >> at java.lang.Class.newInstance(Unknown Source) > > >>> >> at > > >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >>> >> ... 16 more > > >>> >> Caused by: java.lang.NoSuchMethodException: > > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >>> >> ... 18 more > > >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: > > >>> >> [XQST0059] Could not instantiate > > >>> >> org.basex.modules.CR_xquery_31_20151217: > > >>> >> org.basex.modules.CR_xquery_31_20151217. > > >>> >> at org.basex.core.Command.execute(Command.java:101) > > >>> >> at > > >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >>> >> Caused by: org.basex.query.QueryException: Could not instantiate > > >>> >> org.basex.modules.CR_xquery_31_20151217: > > >>> >> org.basex.modules.CR_xquery_31_20151217. > > >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > >>> >> at > > >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >>> >> at > > >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >>> >> at > > >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >>> >> at org.basex.core.Command.execute(Command.java:94) > > >>> >> ... 7 more > > >>> >> Caused by: java.lang.InstantiationException: > > >>> >> org.basex.modules.CR_xquery_31_20151217 > > >>> >> at java.lang.Class.newInstance(Unknown Source) > > >>> >> at > > >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >>> >> ... 16 more > > >>> >> Caused by: java.lang.NoSuchMethodException: > > >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >>> >> ... 18 more > > >>> >> Stopped at ., 1/68: > > >>> >> [XQST0059] Could not instantiate > > >>> >> org.basex.modules.CR_xquery_31_20151217: > > >>> >> org.basex.modules.CR_xquery_31_20151217. > > >>> >> > > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> > > >>> >> On 7 April 2016 at 15:55, Christian Grün <christian.gruen at gmail.com> > > >>> >> wrote: > > >>> >>> > > >>> >>> > If instead I install it to the repo. It appears as > > >>> >>> > "org.basex.modules.CR_xquery_31_20151217" > > >>> >>> > but > > >>> >>> > import module namespace > > >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; > > >>> >>> > Fails with > > >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > > >>> >>> > org.basex.modules.CR_xquery_31_20151217 > > >>> >>> > > > >>> >>> > Any ideas where the problem could be? > > >>> >>> > > >>> >>> It sounds as if it’s not possible to create an instance of this > > >>> >>> class. > > >>> >>> Could you possibly forward the stack trace (triggered by -d)? > > >>> >> > > >>> >> > > >>> > > > >> > > >>
CG
Christian Grün8 Apr 2016 13:01 #
+1 ;)
Quoted text · Gunther Rademacher · 384 lines
On Fri, Apr 8, 2016 at 12:45 PM, Gunther Rademacher <grd at gmx.net> wrote: > Hi Andy, > > thanks for the hint, it helped me reproducing the problem. > > Well, if a BaseX repository module needs a zero argument constructor, it > makes sense to have REx create one as an effect of the -basex option. Will > take care of this. > > Best regards > Gunther > > Gesendet: Freitag, 08. April 2016 um 11:34 Uhr > Von: "Andy Bunce" <bunce.andy at gmail.com> > An: "Gunther Rademacher" <grd at gmx.net> > Cc: "Christian Grün" <christian.gruen at gmail.com>, > "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > Hi, > I want a solution that lives in the repository. This is to allow > installation to be automated. That is not to require users to manually place > jar files and/or edit classpaths. I think this requires the "import module" > form. > > I am happy to go with Christian's Java extra class or maybe Ex-path xar > packaging with a small XQuery module and the existing jar in order to > achieve this. > > Thanks > /Andy > > > On 8 April 2016 at 10:30, Gunther Rademacher <grd at gmx.net> wrote: >> >> ...sorry, I mixed up "declare" and "import" in my previous post. It should >> have been: >> >> >> Hi Christian, >> >> but the instantiation occurs only when the calling code uses "import >> module", right? I still can't see a problem when just declaring the >> namespace properly. >> >> It remains unclear to me why "import module" would be necessary here. Is >> that because the calling code should be the same, regardless of using an >> XQuery module or a Java coded module? But isn't the Java variant supposed to >> have a URI using the "java:" scheme? I noticed that this is not enforced, >> though. >> >> Best regards >> Gunther >> >> >> Gesendet: Freitag, 08. April 2016 um 08:55 Uhr >> Von: "Christian Grün" <christian.gruen at gmail.com> >> An: "Gunther Rademacher" <grd at gmx.net> >> Cc: "Andy Bunce" <bunce.andy at gmail.com>, >> "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> >> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo >> Hi Gunther, >> >> I agree, it wouldn’t make too much sense to add a default constructor >> to your code as long as there is the one-argument constructor that >> will be called by the parseXQuery function. >> >> The reason why a default constructor is required in BaseX is because >> "import module" will always create an instance of the imported Java >> class, which can then be addressed in the XQuery code, using the >> assigned prefix [1]. >> >> @Andy: For creating a BaseX module, you could add another simple Java >> class, which will then call the actual parser class: >> >> import org.basex.query.value.item.Str; >> import org.basex.query.value.node.ANode; >> public class XQuery31Parser { >> public ANode parseXQuery(Str str) throws IOException { >> return CR_xquery_31_20151217.parseXQuery(str); >> } >> } >> >> Hope this helps, >> Christian >> >> [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports >> >> >> >> On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: >> > Hi Andy, Christian, >> > >> > a default constructor is added implicitly, when a class does not provide >> > any >> > constructors itself. A REx-generated class however comes with a >> > constructor. >> > In that case any instantiation must provide arguments for some defined >> > constructor. >> > >> > However I do not see a real reason for instantiating the class at load >> > time. >> > The generated parse function is static and it takes care of >> > instantiating a >> > parser object internally. >> > >> > I just did a quick test and found that I see this instantiating problem >> > when >> > using "import module namespace ...". No problem when using "declare >> > namespace ...." or just an EQName literal instead. I have put my >> > extension >> > function class files into the classpath for checking this. >> > >> > Am I missing something here? >> > >> > Best regards >> > Gunther >> > >> > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr >> > Von: "Christian Grün" <christian.gruen at gmail.com> >> > An: "Andy Bunce" <bunce.andy at gmail.com> >> > Cc: "Gunther Rademacher" <grd at gmx.net>, >> > "basex-talk at mailman.uni-konstanz.de" >> > <basex-talk at mailman.uni-konstanz.de> >> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo >> >> I can't see why Java's Default Constructor [1] rule does not apply >> >> here? >> > >> > Well, me neither ;) Maybe it’s got to do with the way we instantiate >> > the class via reflection? I didn’t track this down yet (I should >> > probably do so). >> > >> > >> >> /Andy >> >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 >> >> >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> >> >> wrote: >> >>> >> >>> > No constructor is the issue. Adding >> >>> > public CR_xquery_31_20151217() {} >> >>> > to java src fixes it. >> >>> >> >>> Thanks! @Gunther: Do you think such a dummy constructor could be added >> >>> to the Java class? >> >>> >> >>> >> >>> >> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: >> >>> >> >> >>> >> C:\Program Files (x86)\BaseX\bin >> >>> >> +>basex -d >> >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >> >>> >> Try 'help' to get more information. >> >>> >> > xquery import module namespace >> >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 >> >>> >> Creating Database... >> >>> >> . 27.04 ms (25844 KB) >> >>> >> Creating Database... >> >>> >> . 4.83 ms (25844 KB) >> >>> >> Creating Database... >> >>> >> . 5.0 ms (25844 KB) >> >>> >> Creating Database... >> >>> >> . 3.52 ms (26509 KB) >> >>> >> Creating Database... >> >>> >> . 4.36 ms (26509 KB) >> >>> >> Creating Database... >> >>> >> . 8.26 ms (26509 KB) >> >>> >> Creating Database... >> >>> >> . 8.37 ms (26509 KB) >> >>> >> Creating Database... >> >>> >> . 4.32 ms (27175 KB) >> >>> >> Creating Database... >> >>> >> . 11.38 ms (27175 KB) >> >>> >> java.lang.InstantiationException: >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >>> >> at >> >>> >> >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >>> >> at >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >>> >> at >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >>> >> ... 18 more >> >>> >> org.basex.query.QueryException: Could not instantiate >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >>> >> at >> >>> >> >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >>> >> at >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >>> >> at >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >>> >> Caused by: java.lang.InstantiationException: >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >>> >> at >> >>> >> >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >>> >> ... 16 more >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >>> >> ... 18 more >> >>> >> org.basex.query.QueryException: Could not instantiate >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >>> >> at >> >>> >> >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >>> >> at >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >>> >> at >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >>> >> Caused by: java.lang.InstantiationException: >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >>> >> at >> >>> >> >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >>> >> ... 16 more >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >>> >> ... 18 more >> >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: >> >>> >> [XQST0059] Could not instantiate >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >>> >> at org.basex.core.Command.execute(Command.java:101) >> >>> >> at >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >>> >> Caused by: org.basex.query.QueryException: Could not instantiate >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >>> >> at >> >>> >> >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >>> >> at >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >>> >> at >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >>> >> ... 7 more >> >>> >> Caused by: java.lang.InstantiationException: >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >>> >> at >> >>> >> >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >>> >> ... 16 more >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >>> >> ... 18 more >> >>> >> Stopped at ., 1/68: >> >>> >> [XQST0059] Could not instantiate >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >>> >> > >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> On 7 April 2016 at 15:55, Christian Grün >> >>> >> <christian.gruen at gmail.com> >> >>> >> wrote: >> >>> >>> >> >>> >>> > If instead I install it to the repo. It appears as >> >>> >>> > "org.basex.modules.CR_xquery_31_20151217" >> >>> >>> > but >> >>> >>> > import module namespace >> >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; >> >>> >>> > Fails with >> >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: >> >>> >>> > org.basex.modules.CR_xquery_31_20151217 >> >>> >>> > >> >>> >>> > Any ideas where the problem could be? >> >>> >>> >> >>> >>> It sounds as if it’s not possible to create an instance of this >> >>> >>> class. >> >>> >>> Could you possibly forward the stack trace (triggered by -d)? >> >>> >> >> >>> >> >> >>> > >> >> >> >>
AB
Andy Bunce10 Apr 2016 23:27 #
Hi Gunther Christian,
Quoted text · Christian Grün · 1 line
>Will take care of this.
Thanks that's great. I have added the constructor by hand for a couple of examples and released a new ex-xparse version [1] based on this. I am very happy with the results - it is orders of magnitude faster and more functional than the previous version.
I would welcome any comments on this in general or on this issue [2]
/Andy
[1] https://github.com/expkg-zone58/ex-xparse/releases/tag/v0.3.6 [2] https://github.com/expkg-zone58/ex-xparse/issues/2
Quoted text · Christian Grün · 411 lines
On 8 April 2016 at 12:01, Christian Grün <christian.gruen at gmail.com> wrote: > +1 ;) > > > On Fri, Apr 8, 2016 at 12:45 PM, Gunther Rademacher <grd at gmx.net> wrote: > > Hi Andy, > > > > thanks for the hint, it helped me reproducing the problem. > > > > Well, if a BaseX repository module needs a zero argument constructor, it > > makes sense to have REx create one as an effect of the -basex option. > Will > > take care of this. > > > > Best regards > > Gunther > > > > Gesendet: Freitag, 08. April 2016 um 11:34 Uhr > > Von: "Andy Bunce" <bunce.andy at gmail.com> > > An: "Gunther Rademacher" <grd at gmx.net> > > Cc: "Christian Grün" <christian.gruen at gmail.com>, > > "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de > > > > > > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > > Hi, > > I want a solution that lives in the repository. This is to allow > > installation to be automated. That is not to require users to manually > place > > jar files and/or edit classpaths. I think this requires the "import > module" > > form. > > > > I am happy to go with Christian's Java extra class or maybe Ex-path xar > > packaging with a small XQuery module and the existing jar in order to > > achieve this. > > > > Thanks > > /Andy > > > > > > On 8 April 2016 at 10:30, Gunther Rademacher <grd at gmx.net> wrote: > >> > >> ...sorry, I mixed up "declare" and "import" in my previous post. It > should > >> have been: > >> > >> > >> Hi Christian, > >> > >> but the instantiation occurs only when the calling code uses "import > >> module", right? I still can't see a problem when just declaring the > >> namespace properly. > >> > >> It remains unclear to me why "import module" would be necessary here. Is > >> that because the calling code should be the same, regardless of using an > >> XQuery module or a Java coded module? But isn't the Java variant > supposed to > >> have a URI using the "java:" scheme? I noticed that this is not > enforced, > >> though. > >> > >> Best regards > >> Gunther > >> > >> > >> Gesendet: Freitag, 08. April 2016 um 08:55 Uhr > >> Von: "Christian Grün" <christian.gruen at gmail.com> > >> An: "Gunther Rademacher" <grd at gmx.net> > >> Cc: "Andy Bunce" <bunce.andy at gmail.com>, > >> "basex-talk at mailman.uni-konstanz.de" < > basex-talk at mailman.uni-konstanz.de> > >> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from > repo > >> Hi Gunther, > >> > >> I agree, it wouldn’t make too much sense to add a default constructor > >> to your code as long as there is the one-argument constructor that > >> will be called by the parseXQuery function. > >> > >> The reason why a default constructor is required in BaseX is because > >> "import module" will always create an instance of the imported Java > >> class, which can then be addressed in the XQuery code, using the > >> assigned prefix [1]. > >> > >> @Andy: For creating a BaseX module, you could add another simple Java > >> class, which will then call the actual parser class: > >> > >> import org.basex.query.value.item.Str; > >> import org.basex.query.value.node.ANode; > >> public class XQuery31Parser { > >> public ANode parseXQuery(Str str) throws IOException { > >> return CR_xquery_31_20151217.parseXQuery(str); > >> } > >> } > >> > >> Hope this helps, > >> Christian > >> > >> [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports > >> > >> > >> > >> On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> > wrote: > >> > Hi Andy, Christian, > >> > > >> > a default constructor is added implicitly, when a class does not > provide > >> > any > >> > constructors itself. A REx-generated class however comes with a > >> > constructor. > >> > In that case any instantiation must provide arguments for some defined > >> > constructor. > >> > > >> > However I do not see a real reason for instantiating the class at load > >> > time. > >> > The generated parse function is static and it takes care of > >> > instantiating a > >> > parser object internally. > >> > > >> > I just did a quick test and found that I see this instantiating > problem > >> > when > >> > using "import module namespace ...". No problem when using "declare > >> > namespace ...." or just an EQName literal instead. I have put my > >> > extension > >> > function class files into the classpath for checking this. > >> > > >> > Am I missing something here? > >> > > >> > Best regards > >> > Gunther > >> > > >> > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > >> > Von: "Christian Grün" <christian.gruen at gmail.com> > >> > An: "Andy Bunce" <bunce.andy at gmail.com> > >> > Cc: "Gunther Rademacher" <grd at gmx.net>, > >> > "basex-talk at mailman.uni-konstanz.de" > >> > <basex-talk at mailman.uni-konstanz.de> > >> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > >> >> I can't see why Java's Default Constructor [1] rule does not apply > >> >> here? > >> > > >> > Well, me neither ;) Maybe it’s got to do with the way we instantiate > >> > the class via reflection? I didn’t track this down yet (I should > >> > probably do so). > >> > > >> > > >> >> /Andy > >> >> > http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 > >> >> > >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> > >> >> wrote: > >> >>> > >> >>> > No constructor is the issue. Adding > >> >>> > public CR_xquery_31_20151217() {} > >> >>> > to java src fixes it. > >> >>> > >> >>> Thanks! @Gunther: Do you think such a dummy constructor could be > added > >> >>> to the Java class? > >> >>> > >> >>> > >> >>> > >> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> > wrote: > >> >>> >> > >> >>> >> C:\Program Files (x86)\BaseX\bin > >> >>> >> +>basex -d > >> >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] > >> >>> >> Try 'help' to get more information. > >> >>> >> > xquery import module namespace > >> >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 > >> >>> >> Creating Database... > >> >>> >> . 27.04 ms (25844 KB) > >> >>> >> Creating Database... > >> >>> >> . 4.83 ms (25844 KB) > >> >>> >> Creating Database... > >> >>> >> . 5.0 ms (25844 KB) > >> >>> >> Creating Database... > >> >>> >> . 3.52 ms (26509 KB) > >> >>> >> Creating Database... > >> >>> >> . 4.36 ms (26509 KB) > >> >>> >> Creating Database... > >> >>> >> . 8.26 ms (26509 KB) > >> >>> >> Creating Database... > >> >>> >> . 8.37 ms (26509 KB) > >> >>> >> Creating Database... > >> >>> >> . 4.32 ms (27175 KB) > >> >>> >> Creating Database... > >> >>> >> . 11.38 ms (27175 KB) > >> >>> >> java.lang.InstantiationException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > >> >>> >> at > >> >>> >> > >> >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> >>> >> at > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > >> >>> >> at > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > >> >>> >> Caused by: java.lang.NoSuchMethodException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >> >>> >> ... 18 more > >> >>> >> org.basex.query.QueryException: Could not instantiate > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > >> >>> >> at > >> >>> >> > >> >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> >>> >> at > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > >> >>> >> at > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > >> >>> >> Caused by: java.lang.InstantiationException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > >> >>> >> at > >> >>> >> > >> >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> >>> >> ... 16 more > >> >>> >> Caused by: java.lang.NoSuchMethodException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >> >>> >> ... 18 more > >> >>> >> org.basex.query.QueryException: Could not instantiate > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > >> >>> >> at > >> >>> >> > >> >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> >>> >> at > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > >> >>> >> at > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > >> >>> >> Caused by: java.lang.InstantiationException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > >> >>> >> at > >> >>> >> > >> >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> >>> >> ... 16 more > >> >>> >> Caused by: java.lang.NoSuchMethodException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >> >>> >> ... 18 more > >> >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: > >> >>> >> [XQST0059] Could not instantiate > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > >> >>> >> at org.basex.core.Command.execute(Command.java:101) > >> >>> >> at > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > >> >>> >> Caused by: org.basex.query.QueryException: Could not instantiate > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > >> >>> >> at > >> >>> >> > >> >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > >> >>> >> at > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > >> >>> >> at > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > >> >>> >> ... 7 more > >> >>> >> Caused by: java.lang.InstantiationException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > >> >>> >> at > >> >>> >> > >> >>> >> > org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > >> >>> >> ... 16 more > >> >>> >> Caused by: java.lang.NoSuchMethodException: > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > >> >>> >> ... 18 more > >> >>> >> Stopped at ., 1/68: > >> >>> >> [XQST0059] Could not instantiate > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > >> >>> >> > > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> On 7 April 2016 at 15:55, Christian Grün > >> >>> >> <christian.gruen at gmail.com> > >> >>> >> wrote: > >> >>> >>> > >> >>> >>> > If instead I install it to the repo. It appears as > >> >>> >>> > "org.basex.modules.CR_xquery_31_20151217" > >> >>> >>> > but > >> >>> >>> > import module namespace > >> >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; > >> >>> >>> > Fails with > >> >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > >> >>> >>> > org.basex.modules.CR_xquery_31_20151217 > >> >>> >>> > > >> >>> >>> > Any ideas where the problem could be? > >> >>> >>> > >> >>> >>> It sounds as if it’s not possible to create an instance of this > >> >>> >>> class. > >> >>> >>> Could you possibly forward the stack trace (triggered by -d)? > >> >>> >> > >> >>> >> > >> >>> > > >> >> > >> >> >
GR
Gunther Rademacher11 Apr 2016 22:59 #
Hi Andy,
the default constructor for -basex has been added with REx v5.39.
For controlling the namespace, please use the "Name/Namespace" option at parser generation time. Its effect depends on the target:
for XQuery, it will be used as the module namespace. The output file name still depends on the input file name,
for Java, it will be used as the package- and class name, thus also affecting the output file name, and for -basex the external function/module namespace.
Best regards
Gunther
Gesendet: Sonntag, 10. April 2016 um 23:27 Uhr
Quoted text · Andy Bunce · 785 lines
Von: "Andy Bunce" <bunce.andy at gmail.com> An: "Christian Grün" <christian.gruen at gmail.com> Cc: "Gunther Rademacher" <grd at gmx.net>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo Hi Gunther Christian, >Will take care of this. Thanks that's great. I have added the constructor by hand for a couple of examples and released a new ex-xparse version [1] based on this. I am very happy with the results - it is orders of magnitude faster and more functional than the previous version. I would welcome any comments on this in general or on this issue [2] /Andy [1] https://github.com/expkg-zone58/ex-xparse/releases/tag/v0.3.6 [2] https://github.com/expkg-zone58/ex-xparse/issues/2 On 8 April 2016 at 12:01, Christian Grün <christian.gruen at gmail.com> wrote: > +1 ;) > > > > > > On Fri, Apr 8, 2016 at 12:45 PM, Gunther Rademacher <grd at gmx.net> wrote: > > > Hi Andy, > > > > > > thanks for the hint, it helped me reproducing the problem. > > > > > > Well, if a BaseX repository module needs a zero argument constructor, it > > > makes sense to have REx create one as an effect of the -basex option. Will > > > take care of this. > > > > > > Best regards > > > Gunther > > > > > > Gesendet: Freitag, 08. April 2016 um 11:34 Uhr > > > Von: "Andy Bunce" <bunce.andy at gmail.com> > > > An: "Gunther Rademacher" <grd at gmx.net> > > > Cc: "Christian Grün" <christian.gruen at gmail.com>, > > > "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > > > > > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > > > Hi, > > > I want a solution that lives in the repository. This is to allow > > > installation to be automated. That is not to require users to manually place > > > jar files and/or edit classpaths. I think this requires the "import module" > > > form. > > > > > > I am happy to go with Christian's Java extra class or maybe Ex-path xar > > > packaging with a small XQuery module and the existing jar in order to > > > achieve this. > > > > > > Thanks > > > /Andy > > > > > > > > > On 8 April 2016 at 10:30, Gunther Rademacher <grd at gmx.net> wrote: > > >> > > >> ...sorry, I mixed up "declare" and "import" in my previous post. It should > > >> have been: > > >> > > >> > > >> Hi Christian, > > >> > > >> but the instantiation occurs only when the calling code uses "import > > >> module", right? I still can't see a problem when just declaring the > > >> namespace properly. > > >> > > >> It remains unclear to me why "import module" would be necessary here. Is > > >> that because the calling code should be the same, regardless of using an > > >> XQuery module or a Java coded module? But isn't the Java variant supposed to > > >> have a URI using the "java:" scheme? I noticed that this is not enforced, > > >> though. > > >> > > >> Best regards > > >> Gunther > > >> > > >> > > >> Gesendet: Freitag, 08. April 2016 um 08:55 Uhr > > >> Von: "Christian Grün" <christian.gruen at gmail.com> > > >> An: "Gunther Rademacher" <grd at gmx.net> > > >> Cc: "Andy Bunce" <bunce.andy at gmail.com>, > > >> "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > >> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo > > >> Hi Gunther, > > >> > > >> I agree, it wouldn’t make too much sense to add a default constructor > > >> to your code as long as there is the one-argument constructor that > > >> will be called by the parseXQuery function. > > >> > > >> The reason why a default constructor is required in BaseX is because > > >> "import module" will always create an instance of the imported Java > > >> class, which can then be addressed in the XQuery code, using the > > >> assigned prefix [1]. > > >> > > >> @Andy: For creating a BaseX module, you could add another simple Java > > >> class, which will then call the actual parser class: > > >> > > >> import org.basex.query.value.item.Str; > > >> import org.basex.query.value.node.ANode; > > >> public class XQuery31Parser { > > >> public ANode parseXQuery(Str str) throws IOException { > > >> return CR_xquery_31_20151217.parseXQuery(str); > > >> } > > >> } > > >> > > >> Hope this helps, > > >> Christian > > >> > > >> [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports > > >> > > >> > > >> > > >> On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: > > >> > Hi Andy, Christian, > > >> > > > >> > a default constructor is added implicitly, when a class does not provide > > >> > any > > >> > constructors itself. A REx-generated class however comes with a > > >> > constructor. > > >> > In that case any instantiation must provide arguments for some defined > > >> > constructor. > > >> > > > >> > However I do not see a real reason for instantiating the class at load > > >> > time. > > >> > The generated parse function is static and it takes care of > > >> > instantiating a > > >> > parser object internally. > > >> > > > >> > I just did a quick test and found that I see this instantiating problem > > >> > when > > >> > using "import module namespace ...". No problem when using "declare > > >> > namespace ...." or just an EQName literal instead. I have put my > > >> > extension > > >> > function class files into the classpath for checking this. > > >> > > > >> > Am I missing something here? > > >> > > > >> > Best regards > > >> > Gunther > > >> > > > >> > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > > >> > Von: "Christian Grün" <christian.gruen at gmail.com> > > >> > An: "Andy Bunce" <bunce.andy at gmail.com> > > >> > Cc: "Gunther Rademacher" <grd at gmx.net>, > > >> > "basex-talk at mailman.uni-konstanz.de" > > >> > <basex-talk at mailman.uni-konstanz.de> > > >> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > > >> >> I can't see why Java's Default Constructor [1] rule does not apply > > >> >> here? > > >> > > > >> > Well, me neither ;) Maybe it’s got to do with the way we instantiate > > >> > the class via reflection? I didn’t track this down yet (I should > > >> > probably do so). > > >> > > > >> > > > >> >> /Andy > > >> >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 > > >> >> > > >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> > > >> >> wrote: > > >> >>> > > >> >>> > No constructor is the issue. Adding > > >> >>> > public CR_xquery_31_20151217() {} > > >> >>> > to java src fixes it. > > >> >>> > > >> >>> Thanks! @Gunther: Do you think such a dummy constructor could be added > > >> >>> to the Java class? > > >> >>> > > >> >>> > > >> >>> > > >> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: > > >> >>> >> > > >> >>> >> C:\Program Files (x86)\BaseX\bin > > >> >>> >> +>basex -d > > >> >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] > > >> >>> >> Try 'help' to get more information. > > >> >>> >> > xquery import module namespace > > >> >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 > > >> >>> >> Creating Database... > > >> >>> >> . 27.04 ms (25844 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 4.83 ms (25844 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 5.0 ms (25844 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 3.52 ms (26509 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 4.36 ms (26509 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 8.26 ms (26509 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 8.37 ms (26509 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 4.32 ms (27175 KB) > > >> >>> >> Creating Database... > > >> >>> >> . 11.38 ms (27175 KB) > > >> >>> >> java.lang.InstantiationException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > >> >>> >> at > > >> >>> >> > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > >> >>> >> at > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >> >>> >> ... 18 more > > >> >>> >> org.basex.query.QueryException: Could not instantiate > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > >> >>> >> at > > >> >>> >> > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > >> >>> >> at > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >> >>> >> Caused by: java.lang.InstantiationException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > >> >>> >> at > > >> >>> >> > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >> >>> >> ... 16 more > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >> >>> >> ... 18 more > > >> >>> >> org.basex.query.QueryException: Could not instantiate > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > >> >>> >> at > > >> >>> >> > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > >> >>> >> at > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >> >>> >> Caused by: java.lang.InstantiationException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > >> >>> >> at > > >> >>> >> > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >> >>> >> ... 16 more > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >> >>> >> ... 18 more > > >> >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: > > >> >>> >> [XQST0059] Could not instantiate > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > >> >>> >> at org.basex.core.Command.execute(Command.java:101) > > >> >>> >> at > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > >> >>> >> Caused by: org.basex.query.QueryException: Could not instantiate > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > >> >>> >> at > > >> >>> >> > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > >> >>> >> at > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > >> >>> >> ... 7 more > > >> >>> >> Caused by: java.lang.InstantiationException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > >> >>> >> at > > >> >>> >> > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > >> >>> >> ... 16 more > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > >> >>> >> ... 18 more > > >> >>> >> Stopped at ., 1/68: > > >> >>> >> [XQST0059] Could not instantiate > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > >> >>> >> > > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> > > >> >>> >> On 7 April 2016 at 15:55, Christian Grün > > >> >>> >> <christian.gruen at gmail.com> > > >> >>> >> wrote: > > >> >>> >>> > > >> >>> >>> > If instead I install it to the repo. It appears as > > >> >>> >>> > "org.basex.modules.CR_xquery_31_20151217" > > >> >>> >>> > but > > >> >>> >>> > import module namespace > > >> >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; > > >> >>> >>> > Fails with > > >> >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > > >> >>> >>> > org.basex.modules.CR_xquery_31_20151217 > > >> >>> >>> > > > >> >>> >>> > Any ideas where the problem could be? > > >> >>> >>> > > >> >>> >>> It sounds as if it’s not possible to create an instance of this > > >> >>> >>> class. > > >> >>> >>> Could you possibly forward the stack trace (triggered by -d)? > > >> >>> >> > > >> >>> >> > > >> >>> > > > >> >> > > >> >>
AB
Andy Bunce12 Apr 2016 00:21 #
Hi Gunther,
Thanks for the 5.39 update.
It is not how to set the namespace but what would be the best choice of namespace here :)
I would like to make it clear that I am just packaging your good work here (almost 40 years from the copyright?).
I find choosing namespaces the hardest part of XQuery. I guess bottlecaps is about bottlecaps and not the right thing to use here.
Best regards
/Andy
Quoted text · Gunther Rademacher · 459 lines
On 11 April 2016 at 21:59, Gunther Rademacher <grd at gmx.net> wrote: > Hi Andy, > > the default constructor for -basex has been added with REx v5.39. > > For controlling the namespace, please use the "Name/Namespace" option at > parser generation time. Its effect depends on the target: > > - for XQuery, it will be used as the module namespace. The output file > name still depends on the input file name, > - for Java, it will be used as the package- and class name, thus also > affecting the output file name, and for -basex the external function/module > namespace. > > Best regards > Gunther > > *Gesendet:* Sonntag, 10. April 2016 um 23:27 Uhr > *Von:* "Andy Bunce" <bunce.andy at gmail.com> > *An:* "Christian Grün" <christian.gruen at gmail.com> > *Cc:* "Gunther Rademacher" <grd at gmx.net>, " > basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > *Betreff:* Re: Re: [basex-talk] Problem deleting jar packaged item from > repo > Hi Gunther Christian, > > >Will take care of this. > > Thanks that's great. I have added the constructor by hand for a couple of > examples and released a new ex-xparse version [1] based on this. I am very > happy with the results - it is orders of magnitude faster and more > functional than the previous version. > I would welcome any comments on this in general or on this issue [2] > > /Andy > [1] https://github.com/expkg-zone58/ex-xparse/releases/tag/v0.3.6 > [2] https://github.com/expkg-zone58/ex-xparse/issues/2 > > On 8 April 2016 at 12:01, Christian Grün <christian.gruen at gmail.com> > wrote: >> >> +1 ;) >> >> >> On Fri, Apr 8, 2016 at 12:45 PM, Gunther Rademacher <grd at gmx.net> wrote: >> > Hi Andy, >> > >> > thanks for the hint, it helped me reproducing the problem. >> > >> > Well, if a BaseX repository module needs a zero argument constructor, it >> > makes sense to have REx create one as an effect of the -basex option. >> Will >> > take care of this. >> > >> > Best regards >> > Gunther >> > >> > Gesendet: Freitag, 08. April 2016 um 11:34 Uhr >> > Von: "Andy Bunce" <bunce.andy at gmail.com> >> > An: "Gunther Rademacher" <grd at gmx.net> >> > Cc: "Christian Grün" <christian.gruen at gmail.com>, >> > "basex-talk at mailman.uni-konstanz.de" < >> basex-talk at mailman.uni-konstanz.de> >> > >> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo >> > Hi, >> > I want a solution that lives in the repository. This is to allow >> > installation to be automated. That is not to require users to manually >> place >> > jar files and/or edit classpaths. I think this requires the "import >> module" >> > form. >> > >> > I am happy to go with Christian's Java extra class or maybe Ex-path xar >> > packaging with a small XQuery module and the existing jar in order to >> > achieve this. >> > >> > Thanks >> > /Andy >> > >> > >> > On 8 April 2016 at 10:30, Gunther Rademacher <grd at gmx.net> wrote: >> >> >> >> ...sorry, I mixed up "declare" and "import" in my previous post. It >> should >> >> have been: >> >> >> >> >> >> Hi Christian, >> >> >> >> but the instantiation occurs only when the calling code uses "import >> >> module", right? I still can't see a problem when just declaring the >> >> namespace properly. >> >> >> >> It remains unclear to me why "import module" would be necessary here. >> Is >> >> that because the calling code should be the same, regardless of using >> an >> >> XQuery module or a Java coded module? But isn't the Java variant >> supposed to >> >> have a URI using the "java:" scheme? I noticed that this is not >> enforced, >> >> though. >> >> >> >> Best regards >> >> Gunther >> >> >> >> >> >> Gesendet: Freitag, 08. April 2016 um 08:55 Uhr >> >> Von: "Christian Grün" <christian.gruen at gmail.com> >> >> An: "Gunther Rademacher" <grd at gmx.net> >> >> Cc: "Andy Bunce" <bunce.andy at gmail.com>, >> >> "basex-talk at mailman.uni-konstanz.de" < >> basex-talk at mailman.uni-konstanz.de> >> >> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from >> repo >> >> Hi Gunther, >> >> >> >> I agree, it wouldn’t make too much sense to add a default constructor >> >> to your code as long as there is the one-argument constructor that >> >> will be called by the parseXQuery function. >> >> >> >> The reason why a default constructor is required in BaseX is because >> >> "import module" will always create an instance of the imported Java >> >> class, which can then be addressed in the XQuery code, using the >> >> assigned prefix [1]. >> >> >> >> @Andy: For creating a BaseX module, you could add another simple Java >> >> class, which will then call the actual parser class: >> >> >> >> import org.basex.query.value.item.Str; >> >> import org.basex.query.value.node.ANode; >> >> public class XQuery31Parser { >> >> public ANode parseXQuery(Str str) throws IOException { >> >> return CR_xquery_31_20151217.parseXQuery(str); >> >> } >> >> } >> >> >> >> Hope this helps, >> >> Christian >> >> >> >> [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports >> >> >> >> >> >> >> >> On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> >> wrote: >> >> > Hi Andy, Christian, >> >> > >> >> > a default constructor is added implicitly, when a class does not >> provide >> >> > any >> >> > constructors itself. A REx-generated class however comes with a >> >> > constructor. >> >> > In that case any instantiation must provide arguments for some >> defined >> >> > constructor. >> >> > >> >> > However I do not see a real reason for instantiating the class at >> load >> >> > time. >> >> > The generated parse function is static and it takes care of >> >> > instantiating a >> >> > parser object internally. >> >> > >> >> > I just did a quick test and found that I see this instantiating >> problem >> >> > when >> >> > using "import module namespace ...". No problem when using "declare >> >> > namespace ...." or just an EQName literal instead. I have put my >> >> > extension >> >> > function class files into the classpath for checking this. >> >> > >> >> > Am I missing something here? >> >> > >> >> > Best regards >> >> > Gunther >> >> > >> >> > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr >> >> > Von: "Christian Grün" <christian.gruen at gmail.com> >> >> > An: "Andy Bunce" <bunce.andy at gmail.com> >> >> > Cc: "Gunther Rademacher" <grd at gmx.net>, >> >> > "basex-talk at mailman.uni-konstanz.de" >> >> > <basex-talk at mailman.uni-konstanz.de> >> >> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from >> repo >> >> >> I can't see why Java's Default Constructor [1] rule does not apply >> >> >> here? >> >> > >> >> > Well, me neither ;) Maybe it’s got to do with the way we instantiate >> >> > the class via reflection? I didn’t track this down yet (I should >> >> > probably do so). >> >> > >> >> > >> >> >> /Andy >> >> >> >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 >> >> >> >> >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com >> > >> >> >> wrote: >> >> >>> >> >> >>> > No constructor is the issue. Adding >> >> >>> > public CR_xquery_31_20151217() {} >> >> >>> > to java src fixes it. >> >> >>> >> >> >>> Thanks! @Gunther: Do you think such a dummy constructor could be >> added >> >> >>> to the Java class? >> >> >>> >> >> >>> >> >> >>> >> >> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> >> wrote: >> >> >>> >> >> >> >>> >> C:\Program Files (x86)\BaseX\bin >> >> >>> >> +>basex -d >> >> >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] >> >> >>> >> Try 'help' to get more information. >> >> >>> >> > xquery import module namespace >> >> >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 >> >> >>> >> Creating Database... >> >> >>> >> . 27.04 ms (25844 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 4.83 ms (25844 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 5.0 ms (25844 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 3.52 ms (26509 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 4.36 ms (26509 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 8.26 ms (26509 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 8.37 ms (26509 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 4.32 ms (27175 KB) >> >> >>> >> Creating Database... >> >> >>> >> . 11.38 ms (27175 KB) >> >> >>> >> java.lang.InstantiationException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >> >>> >> at >> >> >>> >> >> >> >>> >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >> >>> >> at >> >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> >>> >> ... 18 more >> >> >>> >> org.basex.query.QueryException: Could not instantiate >> >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> >>> >> at >> >> >>> >> >> >> >>> >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >> >>> >> at >> >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >> >>> >> Caused by: java.lang.InstantiationException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >> >>> >> at >> >> >>> >> >> >> >>> >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> >>> >> ... 16 more >> >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> >>> >> ... 18 more >> >> >>> >> org.basex.query.QueryException: Could not instantiate >> >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> >>> >> at >> >> >>> >> >> >> >>> >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >> >>> >> at >> >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >> >>> >> Caused by: java.lang.InstantiationException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >> >>> >> at >> >> >>> >> >> >> >>> >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> >>> >> ... 16 more >> >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> >>> >> ... 18 more >> >> >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: >> >> >>> >> [XQST0059] Could not instantiate >> >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >> >>> >> at org.basex.core.Command.execute(Command.java:101) >> >> >>> >> at >> >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) >> >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) >> >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) >> >> >>> >> at org.basex.BaseX.console(BaseX.java:191) >> >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) >> >> >>> >> at org.basex.BaseX.main(BaseX.java:42) >> >> >>> >> Caused by: org.basex.query.QueryException: Could not instantiate >> >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) >> >> >>> >> at >> >> >>> >> >> >> >>> >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) >> >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) >> >> >>> >> at >> >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) >> >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) >> >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) >> >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) >> >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) >> >> >>> >> at org.basex.core.Command.execute(Command.java:94) >> >> >>> >> ... 7 more >> >> >>> >> Caused by: java.lang.InstantiationException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217 >> >> >>> >> at java.lang.Class.newInstance(Unknown Source) >> >> >>> >> at >> >> >>> >> >> >> >>> >> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) >> >> >>> >> ... 16 more >> >> >>> >> Caused by: java.lang.NoSuchMethodException: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() >> >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) >> >> >>> >> ... 18 more >> >> >>> >> Stopped at ., 1/68: >> >> >>> >> [XQST0059] Could not instantiate >> >> >>> >> org.basex.modules.CR_xquery_31_20151217: >> >> >>> >> org.basex.modules.CR_xquery_31_20151217. >> >> >>> >> > >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> >> >> >>> >> On 7 April 2016 at 15:55, Christian Grün >> >> >>> >> <christian.gruen at gmail.com> >> >> >>> >> wrote: >> >> >>> >>> >> >> >>> >>> > If instead I install it to the repo. It appears as >> >> >>> >>> > "org.basex.modules.CR_xquery_31_20151217" >> >> >>> >>> > but >> >> >>> >>> > import module namespace >> >> >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; >> >> >>> >>> > Fails with >> >> >>> >>> > Could not instantiate >> org.basex.modules.CR_xquery_31_20151217: >> >> >>> >>> > org.basex.modules.CR_xquery_31_20151217 >> >> >>> >>> > >> >> >>> >>> > Any ideas where the problem could be? >> >> >>> >>> >> >> >>> >>> It sounds as if it’s not possible to create an instance of this >> >> >>> >>> class. >> >> >>> >>> Could you possibly forward the stack trace (triggered by -d)? >> >> >>> >> >> >> >>> >> >> >> >>> > >> >> >> >> >> >> >> >
GR
Gunther Rademacher12 Apr 2016 12:50 #
Hi Andy,
there are no reservations from my part about the namespace. But I would not overload a namespace with too much information. Feel free to have it refer to the package rather than to resources backing it.
Best regards
Gunther
Gesendet: Dienstag, 12. April 2016 um 00:21 Uhr
Quoted text · Andy Bunce · 867 lines
Von: "Andy Bunce" <bunce.andy at gmail.com> An: "Gunther Rademacher" <grd at gmx.net> Cc: "Christian Grün" <christian.gruen at gmail.com>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo Hi Gunther, Thanks for the 5.39 update. It is not how to set the namespace but what would be the best choice of namespace here :) I would like to make it clear that I am just packaging your good work here (almost 40 years from the copyright?). I find choosing namespaces the hardest part of XQuery. I guess bottlecaps is about bottlecaps and not the right thing to use here. Best regards /Andy On 11 April 2016 at 21:59, Gunther Rademacher <grd at gmx.net> wrote: > Hi Andy, > > > > > > the default constructor for -basex has been added with REx v5.39. > > > > > > For controlling the namespace, please use the "Name/Namespace" option at parser generation time. Its effect depends on the target: > > > > for XQuery, it will be used as the module namespace. The output file name still depends on the input file name, > > for Java, it will be used as the package- and class name, thus also affecting the output file name, and for -basex the external function/module namespace. > > > > > Best regards > > > Gunther > > > > > > > Gesendet: Sonntag, 10. April 2016 um 23:27 Uhr > > Von: "Andy Bunce" <bunce.andy at gmail.com> > > An: "Christian Grün" <christian.gruen at gmail.com> > > Cc: "Gunther Rademacher" <grd at gmx.net>, "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo > > > > > > > > Hi Gunther Christian, > > > > >Will take care of this. > > > > Thanks that's great. I have added the constructor by hand for a couple of examples and released a new ex-xparse version [1] based on this. I am very happy with the results - it is orders of magnitude faster and more functional than the previous version. > > I would welcome any comments on this in general or on this issue [2] > > > > > /Andy > > > [1] https://github.com/expkg-zone58/ex-xparse/releases/tag/v0.3.6 > > [2] https://github.com/expkg-zone58/ex-xparse/issues/2 > > > > > > > > > > On 8 April 2016 at 12:01, Christian Grün <christian.gruen at gmail.com> wrote: > > > > +1 ;) > > > > > > > > > > > > On Fri, Apr 8, 2016 at 12:45 PM, Gunther Rademacher <grd at gmx.net> wrote: > > > > > Hi Andy, > > > > > > > > > > thanks for the hint, it helped me reproducing the problem. > > > > > > > > > > Well, if a BaseX repository module needs a zero argument constructor, it > > > > > makes sense to have REx create one as an effect of the -basex option. Will > > > > > take care of this. > > > > > > > > > > Best regards > > > > > Gunther > > > > > > > > > > Gesendet: Freitag, 08. April 2016 um 11:34 Uhr > > > > > Von: "Andy Bunce" <bunce.andy at gmail.com> > > > > > An: "Gunther Rademacher" <grd at gmx.net> > > > > > Cc: "Christian Grün" <christian.gruen at gmail.com>, > > > > > "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > > > > > > > > > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > > > > > Hi, > > > > > I want a solution that lives in the repository. This is to allow > > > > > installation to be automated. That is not to require users to manually place > > > > > jar files and/or edit classpaths. I think this requires the "import module" > > > > > form. > > > > > > > > > > I am happy to go with Christian's Java extra class or maybe Ex-path xar > > > > > packaging with a small XQuery module and the existing jar in order to > > > > > achieve this. > > > > > > > > > > Thanks > > > > > /Andy > > > > > > > > > > > > > > > On 8 April 2016 at 10:30, Gunther Rademacher <grd at gmx.net> wrote: > > > > >> > > > > >> ...sorry, I mixed up "declare" and "import" in my previous post. It should > > > > >> have been: > > > > >> > > > > >> > > > > >> Hi Christian, > > > > >> > > > > >> but the instantiation occurs only when the calling code uses "import > > > > >> module", right? I still can't see a problem when just declaring the > > > > >> namespace properly. > > > > >> > > > > >> It remains unclear to me why "import module" would be necessary here. Is > > > > >> that because the calling code should be the same, regardless of using an > > > > >> XQuery module or a Java coded module? But isn't the Java variant supposed to > > > > >> have a URI using the "java:" scheme? I noticed that this is not enforced, > > > > >> though. > > > > >> > > > > >> Best regards > > > > >> Gunther > > > > >> > > > > >> > > > > >> Gesendet: Freitag, 08. April 2016 um 08:55 Uhr > > > > >> Von: "Christian Grün" <christian.gruen at gmail.com> > > > > >> An: "Gunther Rademacher" <grd at gmx.net> > > > > >> Cc: "Andy Bunce" <bunce.andy at gmail.com>, > > > > >> "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > > > >> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo > > > > >> Hi Gunther, > > > > >> > > > > >> I agree, it wouldn’t make too much sense to add a default constructor > > > > >> to your code as long as there is the one-argument constructor that > > > > >> will be called by the parseXQuery function. > > > > >> > > > > >> The reason why a default constructor is required in BaseX is because > > > > >> "import module" will always create an instance of the imported Java > > > > >> class, which can then be addressed in the XQuery code, using the > > > > >> assigned prefix [1]. > > > > >> > > > > >> @Andy: For creating a BaseX module, you could add another simple Java > > > > >> class, which will then call the actual parser class: > > > > >> > > > > >> import org.basex.query.value.item.Str; > > > > >> import org.basex.query.value.node.ANode; > > > > >> public class XQuery31Parser { > > > > >> public ANode parseXQuery(Str str) throws IOException { > > > > >> return CR_xquery_31_20151217.parseXQuery(str); > > > > >> } > > > > >> } > > > > >> > > > > >> Hope this helps, > > > > >> Christian > > > > >> > > > > >> [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports > > > > >> > > > > >> > > > > >> > > > > >> On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd at gmx.net> wrote: > > > > >> > Hi Andy, Christian, > > > > >> > > > > > >> > a default constructor is added implicitly, when a class does not provide > > > > >> > any > > > > >> > constructors itself. A REx-generated class however comes with a > > > > >> > constructor. > > > > >> > In that case any instantiation must provide arguments for some defined > > > > >> > constructor. > > > > >> > > > > > >> > However I do not see a real reason for instantiating the class at load > > > > >> > time. > > > > >> > The generated parse function is static and it takes care of > > > > >> > instantiating a > > > > >> > parser object internally. > > > > >> > > > > > >> > I just did a quick test and found that I see this instantiating problem > > > > >> > when > > > > >> > using "import module namespace ...". No problem when using "declare > > > > >> > namespace ...." or just an EQName literal instead. I have put my > > > > >> > extension > > > > >> > function class files into the classpath for checking this. > > > > >> > > > > > >> > Am I missing something here? > > > > >> > > > > > >> > Best regards > > > > >> > Gunther > > > > >> > > > > > >> > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr > > > > >> > Von: "Christian Grün" <christian.gruen at gmail.com> > > > > >> > An: "Andy Bunce" <bunce.andy at gmail.com> > > > > >> > Cc: "Gunther Rademacher" <grd at gmx.net>, > > > > >> > "basex-talk at mailman.uni-konstanz.de" > > > > >> > <basex-talk at mailman.uni-konstanz.de> > > > > >> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo > > > > >> >> I can't see why Java's Default Constructor [1] rule does not apply > > > > >> >> here? > > > > >> > > > > > >> > Well, me neither ;) Maybe it’s got to do with the way we instantiate > > > > >> > the class via reflection? I didn’t track this down yet (I should > > > > >> > probably do so). > > > > >> > > > > > >> > > > > > >> >> /Andy > > > > >> >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 > > > > >> >> > > > > >> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen at gmail.com> > > > > >> >> wrote: > > > > >> >>> > > > > >> >>> > No constructor is the issue. Adding > > > > >> >>> > public CR_xquery_31_20151217() {} > > > > >> >>> > to java src fixes it. > > > > >> >>> > > > > >> >>> Thanks! @Gunther: Do you think such a dummy constructor could be added > > > > >> >>> to the Java class? > > > > >> >>> > > > > >> >>> > > > > >> >>> > > > > >> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy at gmail.com> wrote: > > > > >> >>> >> > > > > >> >>> >> C:\Program Files (x86)\BaseX\bin > > > > >> >>> >> +>basex -d > > > > >> >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone] > > > > >> >>> >> Try 'help' to get more information. > > > > >> >>> >> > xquery import module namespace > > > > >> >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2 > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 27.04 ms (25844 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 4.83 ms (25844 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 5.0 ms (25844 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 3.52 ms (26509 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 4.36 ms (26509 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 8.26 ms (26509 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 8.37 ms (26509 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 4.32 ms (27175 KB) > > > > >> >>> >> Creating Database... > > > > >> >>> >> . 11.38 ms (27175 KB) > > > > >> >>> >> java.lang.InstantiationException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > > > >> >>> >> at > > > > >> >>> >> > > > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > > > >> >>> >> at > > > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > > > >> >>> >> ... 18 more > > > > >> >>> >> org.basex.query.QueryException: Could not instantiate > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > > > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > > > >> >>> >> at > > > > >> >>> >> > > > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > > > >> >>> >> at > > > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > > > >> >>> >> Caused by: java.lang.InstantiationException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > > > >> >>> >> at > > > > >> >>> >> > > > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > > > >> >>> >> ... 16 more > > > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > > > >> >>> >> ... 18 more > > > > >> >>> >> org.basex.query.QueryException: Could not instantiate > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > > > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > > > >> >>> >> at > > > > >> >>> >> > > > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > > > >> >>> >> at > > > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > > > >> >>> >> Caused by: java.lang.InstantiationException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > > > >> >>> >> at > > > > >> >>> >> > > > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > > > >> >>> >> ... 16 more > > > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > > > >> >>> >> ... 18 more > > > > >> >>> >> org.basex.core.BaseXException: Stopped at ., 1/68: > > > > >> >>> >> [XQST0059] Could not instantiate > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > > > >> >>> >> at org.basex.core.Command.execute(Command.java:101) > > > > >> >>> >> at > > > > >> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132) > > > > >> >>> >> at org.basex.api.client.Session.execute(Session.java:36) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:103) > > > > >> >>> >> at org.basex.core.CLI.execute(CLI.java:87) > > > > >> >>> >> at org.basex.BaseX.console(BaseX.java:191) > > > > >> >>> >> at org.basex.BaseX.<init>(BaseX.java:166) > > > > >> >>> >> at org.basex.BaseX.main(BaseX.java:42) > > > > >> >>> >> Caused by: org.basex.query.QueryException: Could not instantiate > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > > > >> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343) > > > > >> >>> >> at > > > > >> >>> >> > > > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758) > > > > >> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172) > > > > >> >>> >> at > > > > >> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223) > > > > >> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57) > > > > >> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159) > > > > >> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267) > > > > >> >>> >> at org.basex.core.Command.execute(Command.java:94) > > > > >> >>> >> ... 7 more > > > > >> >>> >> Caused by: java.lang.InstantiationException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217 > > > > >> >>> >> at java.lang.Class.newInstance(Unknown Source) > > > > >> >>> >> at > > > > >> >>> >> > > > > >> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124) > > > > >> >>> >> ... 16 more > > > > >> >>> >> Caused by: java.lang.NoSuchMethodException: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>() > > > > >> >>> >> at java.lang.Class.getConstructor0(Unknown Source) > > > > >> >>> >> ... 18 more > > > > >> >>> >> Stopped at ., 1/68: > > > > >> >>> >> [XQST0059] Could not instantiate > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217: > > > > >> >>> >> org.basex.modules.CR_xquery_31_20151217. > > > > >> >>> >> > > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> >> On 7 April 2016 at 15:55, Christian Grün > > > > >> >>> >> <christian.gruen at gmail.com> > > > > >> >>> >> wrote: > > > > >> >>> >>> > > > > >> >>> >>> > If instead I install it to the repo. It appears as > > > > >> >>> >>> > "org.basex.modules.CR_xquery_31_20151217" > > > > >> >>> >>> > but > > > > >> >>> >>> > import module namespace > > > > >> >>> >>> > p="org.basex.modules.CR_xquery_31_20151217"; > > > > >> >>> >>> > Fails with > > > > >> >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217: > > > > >> >>> >>> > org.basex.modules.CR_xquery_31_20151217 > > > > >> >>> >>> > > > > > >> >>> >>> > Any ideas where the problem could be? > > > > >> >>> >>> > > > > >> >>> >>> It sounds as if it’s not possible to create an instance of this > > > > >> >>> >>> class. > > > > >> >>> >>> Could you possibly forward the stack trace (triggered by -d)? > > > > >> >>> >> > > > > >> >>> >> > > > > >> >>> > > > > > >> >> > > > > >> >>
Written for BaseX 8.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery