Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org/w3c/dom/ls/DocumentLS #4

Open
drelhaj opened this issue Nov 25, 2020 · 4 comments
Open

org/w3c/dom/ls/DocumentLS #4

drelhaj opened this issue Nov 25, 2020 · 4 comments

Comments

@drelhaj
Copy link

drelhaj commented Nov 25, 2020

When I try to run the jar bundles with any FSA I always get the following error

Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.apache.xerces.jaxp.DocumentBuilderImpl.(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
at edu.duke.cs.jflap.file.XMLCodec.decode(XMLCodec.java:59)
at edu.duke.cs.jflap.file.XMLCodec.decode(XMLCodec.java:90)
at es.usc.citius.jflap.cli.IO.loadAutomaton(IO.java:37)
at es.usc.citius.jflap.cli.CommandLine$RunInputCommand.run(CommandLine.java:79)
at es.usc.citius.jflap.cli.CommandLine$Cli.parseAndRun(CommandLine.java:136)
at es.usc.citius.jflap.cli.CommandLine.main(CommandLine.java:21)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ls.DocumentLS
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 17 more

@sbrokal1
Copy link

Any solution to this?

@drelhaj
Copy link
Author

drelhaj commented Apr 25, 2022

I'm running the bundle jar file wrapped in Python code see code below for testing an input and for testing equivalence for FSAs

#this method takes an input array and a jflap FSA machine
def testInput(input, machine):#input is an array e.g. input = ["abc","aabbcc"]
    from subprocess import Popen, PIPE, STDOUT
    from threading import Timer
    p = Popen(['java', '-jar', 'jflaplib-cli-1.3-bundle.jar', 'run', machine, input], stdout=PIPE, stderr=STDOUT)
    timer = Timer(10, p.kill)
    try:
        timer.start()#timeout in case of infinite loops
        for line in p.stdout:
            return line
        return 'false'
    finally:
        timer.cancel()
#check if one machine is equivalent to another
def checkEquivalence(machine1, machine2):
    from subprocess import Popen, PIPE, STDOUT
    from threading import Timer

    p = Popen(['java', '-jar', 'jflaplib-cli-1.3-bundle.jar', 'equivalent', machine1, machine2], stdout=PIPE, stderr=STDOUT)
    timer = Timer(10, p.kill)

    checkResult = ""
    try:
        timer.start()
        for line in p.stdout:
            checkResult = line
        return checkResult
    finally:
        timer.cancel()

@ushahid
Copy link

ushahid commented Apr 15, 2023

I have written a similar utility inspired by this repo, you can try it out here:

https://github.com/ushahid/jflap-cli

@DylanLukes
Copy link

DylanLukes commented Aug 5, 2024

Quick Fix

If you're using Gradle (solution is similar for Maven, see related reading) you can address this issue by overriding the xerces:xercesImpl used in your project. The version used in this project is rather old, and it appears there are some issues using it today. If you need to shell out to the JAR, you could try forking and modifying this project replacing the dependency.

dependencies {
    // ...
    implementation("com.github.citiususc:jflap-lib:1.3") {
        exclude(group = "xerces", module = "xercesImpl")
    }
    implementation("xerces:xercesImpl:2.12.2")
    // ...
}

Related Reading

Here is a related issue: https://stackoverflow.com/questions/62006284/noclassdeffounderror-org-w3c-dom-ls-documentls-issue-occurring-only-on-deploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants