Error trying to load / parse XML file with DocumentBuilder - katalon-studio

I'm trying to load an XML file and have started to get an error after updating Katalon from 6.1.5 to 6.2.
Error in question:
java.lang.NoClassDefFoundError: org/w3c/dom/elementtraversal
Error is thrown when trying to parse the file.
Even though the error is pretty clear that the class is not recognized / found; I ruled out malformed XML file.
File docXmlFile = new File("C:\\data", "info.xml");
DocumentBuilderFactory factory = DocumentFactoryBuilder.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(docXmlFile); // error is thrown here!
Element root = doc.getDocumentElement(); // this line isn't reached
Trying to figure out what had changed as this code has been working for quite a while.
If i had to guess it's probably some dependency or missing JAR file, not sure which one and how to fix it.

According to this post on Katalon forum, this is a known issue that has been fixed in version 6.2.1.

Related

Groovy:General error during semantic analysis: java.lang.NoSuchMethodError:

Imported the gradle project from the "complete" folder and received the following error:
Groovy:General error during semantic analysis:
java.lang.NoSuchMethodError: 'org.codehaus.groovy.ast.expr.Expression org.codehaus.groovy.ast.tools.GeneralUtils.propX(org.codehaus.groovy.ast.expr.Expression, java.lang.String)'
I am using the latest version of Eclipse, 2020-12, with groovy tools installed.
From grails guide
https://guides.grails.org/gorm-without-grails/guide/index.html
Downloaded code sample from github
https://github.com/grails-guides/gorm-without-grails.git
It seems likely to be a version mismatch, but I cannot determine how to correct this problem.
I have tried to delete the offending file, src/main/groovy/demo/domain/Manufacturer.groovy, and the error appears on the file in this package on line 1.
The error does not appear in any other package. I have done the usual internet searches for resolutions that apply, but have thus far been unable to find a suitable solution. I am hopeful for a suggestion?
I think this error comes from an AST transform that references the older signature of GeneralUtils#propX. This method used to return Expression and was changed to return PropertyExpression.
The bridge method for binary compatibility was missing in groovy-eclipse. https://github.com/groovy/groovy-eclipse/commit/f6f448675d95f858b4ec65b6fc8e55f27ccaaa94

Google OR tools

I am learning to solve some optimisation programs using google or-tools.
I started with their example code and I an trying to run it in intellij.
But when I write the code and compile I get the following error.
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get()I
at com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get(Native Method)
at com.google.ortools.linearsolver.MPSolver$OptimizationProblemType.<clinit>(MPSolver.java:221)
I searched for some answers and I found that it requires jniortools.dll .
But I am working with ubuntu. Hence i assume i need to load the libjniortools.so file , am I right?.
So I included the line
static {
System.loadLibrary("libjniortools");
}
and I have a lib folder wherein I have put both com.google.ortools.jar and protobuf.jar along with all the other lib files that were present when I extracted the zip file(basically copy pasted the lib folder from extracted zip file).
I have added the jar paths in intellij as shown in figure
enter image description here
*the last 2 line of dependency in image
Then I have also tried giving the lib path in VM-options:
-Djava.library.path=/home/surajvashistha/IdeaProjects/LPModel/lib
After all this, I get the following error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no libjniortools in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1124)
at LP.<clinit>
I am stuck here and not able to move forward. Can anyone help?

Scala: FileNotFoundException when the file does exist

I started learning Scala a few weeks ago and I am now trying to read data from a .csv file.
However, the line val data = fromFile("test.csv") returns me the error
java.io.FileNotFoundException: test.csv (No such file or directory)
Usually, this error happens when the file does not exist, but I made sure that test.csv is in the root folder of my project (I am working on IntelliJ)
This code is in a scala worksheet, and the entire code looks like
import scala.io.Source.fromFile
object Test{
class Class1(...){...}
class Class2(...){...}
def function1(...)
val data = fromFile("test.csv")
}
I am afraid that this issue is caused by IntelliJ as I tried to install Eclipse and run my code there and it seemed to work. Do you have any idea of what could cause that error to happen?
Note: The file is supposed to be read in a method of Class1 but I took it out to see if it worked outside Class1 and it turns out it doesn't
EDIT: My test.csvcan be anywhere, as long as it works. I do not need a solution using a relative path

Automatic log4j configuration and bundleresource

Two issues / questions:
1) In many of the log4j threads / forums / etc., I am seeing the results of defining the log4j.debug containing log4j configuration file references prefixed with "file:" as shown below:
log4j: Using URL [file:/data/app/conf/log4j.properties] for automatic log4j configuration.
In the code I am updating (authored by another developer now working someplace else), I am seeing:
log4j: Using URL [bundleresource://23/log4j.properties] for automatic log4j configuration
What/where is the "bundleresource" as shown above? I am thinking this is a dedicated resource Eclipse plug-in that I have been unable to identify.
2) This question stems from a larger issue of not being able to load a log4j configuration file without explicitly inserting it into the command line arguments of the JVM (e.g., -Dlog4j.configuration). I am replacing an Eclipse plugin-based application on a test server that does not have this command line argument specified in a start up script and is able to correctly fire up with log4j being initialized correctly. When I go to replace this application with the latest build from our source repository, the application fails to locate the log4j configuration file. Any thoughts on why the first application can start up and locate the log4j configuration file while the second (newer) application cannot?
Any help would be greatly appreciated.
Thanks!
Update / Edit
Output from the application with log4j.debug defined:
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader#9fe666.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader#9fe666 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader#9fe666.
log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader#9fe666 class loader.
log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
You can load a properties file for Log4j by first loading the properties, then tossing it into log4j's property configurator:
Properties props = new Properties();
FileInputStream fis = new FileInputStream("mylog4j.properties");
props.load(fis);
fis.close();
PropertyConfigurator.configure(props);
The bundleresource seems like a library specific thing. I recommend using grep on the sourcecode:
grep -irn ./ -e "bundleresource"

Unable to properly link external Java library in Eclipse

I've been struggling to properly integrate this Netflix Java Client to access Netflix's API into a very basic Eclipse Java Web Project.
Whenever I try to publish any content referring to this library, I get errors like the following, indicating an inability to resolve the type of the classes in the external library I'm trying to use.
Aug 20, 2011 11:48:42 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/OSNet03] threw exception [Unable to compile class for JSP:
An error occurred at line: 19 in the jsp file: /index.jsp
NetflixAPIClient cannot be resolved to a type
16: String myConsumerKey = new String("cefjbgekg7566cqrp2atua2n");
17: String myConsumerSecret = new String("redacted");
18:
19: NetflixAPIClient apiClient = new NetflixAPIClient(myConsumerKey, myConsumerSecret);
20: String uri = APIEndpoints.MOVIE_URI + "/2361637";
21: String details = null;
At the top of the file I include the proper class directories like this:
<%# page import="com.netflix.api.*" %>
<%# page import="com.netflix.api.client.*" %>
<%# page import="com.netflix.api.client.dal.*" %>
And I don't receive any errors from Eclipse telling me it can't resolve the classes. Only once I publish it to the server does this error occur.
I've tried building with jre7 and jdk1.7.0. The library I'm trying to work with includes elements that are from Java v6 and v5.
I included the library by building it with Maven and placing the directory in my WEB-INF/lib folder and then including the jar netflix-client-2.3-SNAPSHOT.jar in my Build Path.
I've looked all over the web for possible causes and tried every prescribed solution I've found but none have worked.
You may be able to tell I'm very new to using Eclipse and Java Web Programming but I'm trying to figure things out as best I can as I go.
check if build automatically is on :P. if not try turning it on for once.
if yes then check the project build path and look for libraries. check if the correct jars are there.
also check if your jars are not corrupted.
these are the usual problems for more wait for sm1 else to answer.
you could also try searching for the resource class that can't be resolved using Ctrl+Shift+R and see if the class turns up.
if you don't get it, then just extract the jar and see if the class is there for real.