Hi Pham,
If you use BaseX with Java, you should either work with the Client/Server architecture (see [1] for examples) or ensure that all operations are based on and registered via the same database context (Context.java). Feel free to share a minimum Java example with us.
Best, Christian
[1] https://docs.basex.org/wiki/Java_Examples
On Thu, Jul 2, 2020 at 11:01 AM Pham Huu Bang a09550@gmail.com wrote:
Hello,
I have a Java web application which relies on BaseX library to mostly read XML files (they are quite big, e.g: 20 MB per file) by XQuery. The XQuery is also quite complicated. It takes ~3 seconds to query. Configuration file .basex: https://pastebin.com/3EH7MJi5
I got the error below when multiple requests are processed in parallel. I wonder how BaseX can work in this case without error like this?
Thanks,
Version: BaseX 9.2.4 Java: Oracle Corporation, 1.8.0_222 OS: Linux, amd64 Stack Trace: java.nio.channels.OverlappingFileLockException at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255) at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152) at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1107) at org.basex.io.random.TableDiskAccess.lock(TableDiskAccess.java:147) at org.basex.io.random.TableDiskAccess.<init>(TableDiskAccess.java:79) at org.basex.data.DiskData.init(DiskData.java:125) at org.basex.data.DiskData.<init>(DiskData.java:84) at org.basex.core.cmd.Open.open(Open.java:99) at org.basex.core.cmd.Open.run(Open.java:48) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.core.Command.execute(Command.java:116)