Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2320

Non existing xml tags are being ignored by the optaplanner-quarkus extension

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Not a Bug
    • Minor
    • None
    • None
    • optaplanner-quarkus
    • None
    • Undefined
    • NEW
    • NEW

    Description

      I have a hello world optaplanner-quarkus project, solution is defined, entities, etc., all is working well.

      1) I want to use my own solver configuration src/main/resources/mySolverConfig.xml

      2) I configure the application.properties to use the file in 1)
      quarkus.optaplanner.solver-config-xml=mySolverConfig.xml

      3) I have a service that injects the solver factory and creates solver instances, etc.
      Everything works well.

      4) No I've edit the mySolverConfig.xml and add this two lines in the middle

      SOME FREE TEXT
      
      <nonExistingTag name="whatever name"> </nonExistingTag>
      

      Note that I'm adding a raw text line and well formed xml tag that has no meaning.

      5) I rebuild the application, etc.

      6) I start my service etc, and can inject the solver factory, etc, everything continues working.

      The <nonExistingTag> is basically being ignored and the "SOME FREE TEXT" line too.

      To double check, now I add this instead.

      <nonExistingTag name="whatever name"> </nonExistingTag
      

      (note that this time I'm adding the same tag but the xml is not well formed since I'm not adding the ">" at the end of the line)

      7) now I compile the project again, and this time, at compile time the error below is thrown, which confirms that:
      7.1) I the first execution the nonExistingTag and the free text line are just ignored
      7.2) the configuration and all the setup I had was ok, since, now, a parsing error is detected at build time.

      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 6.178 s
      [INFO] Finished at: 2021-01-26T17:44:41+01:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.11.0.Final:build (default) on project task-assigning-service: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
      [ERROR] [error]: Build step org.optaplanner.quarkus.deployment.OptaPlannerProcessor#recordAndRegisterBeans threw an exception: java.lang.IllegalArgumentException: Unmarshalling of solverConfigResource (taskAssigningDefaultSolverConfig.xml) fails.
      [ERROR] at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:124)
      [ERROR] at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:97)
      [ERROR] at org.optaplanner.quarkus.deployment.OptaPlannerProcessor.recordAndRegisterBeans(OptaPlannerProcessor.java:141)
      [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      [ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      [ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:972)
      [ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
      [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
      [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
      [ERROR] at java.base/java.lang.Thread.run(Thread.java:834)
      [ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      [ERROR] Caused by: org.optaplanner.core.impl.io.OptaPlannerXmlSerializationException: Failed to parse an XML for a root class (org.optaplanner.core.config.solver.SolverConfig).
      [ERROR] at org.optaplanner.core.impl.io.jaxb.GenericJaxbIO.parseXml(GenericJaxbIO.java:241)
      [ERROR] at org.optaplanner.core.impl.io.jaxb.SolverConfigIO.read(SolverConfigIO.java:31)
      [ERROR] at org.optaplanner.core.config.solver.SolverConfig.createFromXmlReader(SolverConfig.java:208)
      [ERROR] at org.optaplanner.core.config.solver.SolverConfig.createFromXmlInputStream(SolverConfig.java:182)
      [ERROR] at org.optaplanner.core.config.solver.SolverConfig.createFromXmlResource(SolverConfig.java:122)
      [ERROR] ... 12 more
      [ERROR] Caused by: org.xml.sax.SAXParseException; lineNumber: 37; columnNumber: 3; The end-tag for element type "nonExistingTag" must end with a '>' delimiter.
      [ERROR] at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:261)
      [ERROR] at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
      [ERROR] at org.optaplanner.core.impl.io.jaxb.GenericJaxbIO.parseXml(GenericJaxbIO.java:238)
      [ERROR] ... 16 more

      In the application.properties the mySolverConfig.xml

      Attachments

        Issue Links

          Activity

            People

              rsynek@redhat.com Radovan Synek
              wmedvede@redhat.com Walter Medvedeo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: