Compilation of java action failed

0
C:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:15: error: package org.json.simple does not existimport org.json.simple.JSONArray;                      ^C:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:16: error: package org.json.simple does not existimport org.json.simple.JSONObject;                      ^C:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:17: error: package org.json.simple.parser does not existimport org.json.simple.parser.JSONParser;                             ^C:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:18: error: package org.json.simple.parser does not existimport org.json.simple.parser.ParseException;                             ^C:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:75: error: cannot find symbol    public static Document createAdvanced(IMendixObject objectToIndex, IContext context, FacetsConfig config, List<Facet> facets, String body) throws IOException, CoreException, ParseException {                                                                                                                                                                                  ^  symbol:   class ParseException  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:99: error: cannot find symbol    private static void indexJsonObject(Document doc, JSONObject body, StringBuilder contentBuilder, String prefix) {                                                      ^  symbol:   class JSONObject  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:86: error: cannot find symbol        JSONParser parser = new JSONParser();        ^  symbol:   class JSONParser  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:86: error: cannot find symbol        JSONParser parser = new JSONParser();                                ^  symbol:   class JSONParser  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:87: error: cannot find symbol        JSONObject bodytoindex = (JSONObject) parser.parse(body);        ^  symbol:   class JSONObject  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:87: error: cannot find symbol        JSONObject bodytoindex = (JSONObject) parser.parse(body);                                  ^  symbol:   class JSONObject  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:110: error: cannot find symbol             if(i instanceof JSONObject) {                             ^  symbol:   class JSONObject  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:111: error: cannot find symbol                 JSONObject keyObject = (JSONObject) i;                 ^  symbol:   class JSONObject  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:111: error: cannot find symbol                 JSONObject keyObject = (JSONObject) i;                                         ^  symbol:   class JSONObject  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:113: error: cannot find symbol             }else if (i instanceof JSONArray) {                                    ^  symbol:   class JSONArray  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:114: error: cannot find symbol                JSONArray arrayJSON = (JSONArray) i;                ^  symbol:   class JSONArray  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:114: error: cannot find symbol                JSONArray arrayJSON = (JSONArray) i;                                       ^  symbol:   class JSONArray  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:115: error: cannot find symbol                Iterator<JSONObject> arrayIterator = arrayJSON.iterator();                         ^  symbol:   class JSONObject  location: class IndexHelperC:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\supportfunctions\IndexHelper.java:117: error: cannot find symbol                    JSONObject arrayEntryToProcess = arrayIterator.next();                    ^  symbol:   class JSONObject  location: class IndexHelperNote: Some input files use or override a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: C:\Users\MX\Mendix\Zepto_Z-main\javasource\globalsearch\actions\AfterStartup.java uses unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.18 errors FAILURE: Build failed with an exception. * What went wrong:Execution failed for task ':compile'.> Compilation failed; see the compiler error output for details. * Try:> Run with --stacktrace option to get the stack trace.> Run with --debug option to get more log output.> Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 2s
asked
2 answers
2

These errors are usually down to a clash of jar files in your application's userlib folder. Newer versions may new methods that don't exist in previous versions which could cause problems.

 

To fix this, go into your userlib, and look for any duplicates you can see. Delete the duplicates with the lower version numbers, keeping only the version with the highest version number.

 

For example, if your userlib has jsoup-1.15.3.jar and jsoup-1.16.1.jar, you would delete 1.15.3 and keep 1.16.1. 

 

I hope this helps. Good luck!

answered
0

Hi Sabitha,

It seems you're having trouble with some custom Java in Mendix. Could you elaborate what you try to achieve, what you did you get this error and what you already tried to solve it?

 

According to the AI-generated summary:

The error message indicates missing packages and classes from the org.json.simple library.

The user needs to ensure they have the correct dependencies installed and configured properly.

Suggested Solution:

The user can try adding the following dependency to their pom.xml file:

<dependency> <groupId>org.json.simple</groupId> <artifactId>json-simple</artifactId> <version>1.1.1</version> </dependency>

Additionally, the user may need to adjust their import statements to match the correct package names.

 

Kind regards,

Johan

answered