You can translate the question and the replies:

Custom Policy log4j Error

I am using denodo-commons-custom.jar and denodo-vdp-jdbcdriver-8.0-update-20230914.jar in a custom policy. When I run the program I get this error: `Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager` The error occurs when execution hits a line that is trying to instantiate an instance of CustomRestrictionPolicyValue. I have added both of the aformentioned jars to the class path and module path for the project without success.
user
08-04-2024 18:01:40 -0400
code

3 Answers

Are denodo-commons-custom.jar or denodo-vdp-jdbcdriver-8.0-update-20230914.jar using log4j? Would the log4j code be packaged in the jDenodo jar or is it expecting log4j to be on the local, executing machine?
user
10-04-2024 10:37:05 -0400
This can be closed. The issue was resolved by writing the code in such a way that it didn't create a new CustomRestrictionPolicyValue object.
user
10-04-2024 17:08:29 -0400
Hi, I am glad that you made it work and found the solution. Just some steps you can ensure in future: From the logs, I can see that the Java Virtual Machine (JVM) is unable to locate the LogManager class from the Apache Log4j library. The class is usually located in log4j-core jar file. * First, ensure that log4j-core jar file is correctly included in your classpath. The classpath should include all necessary jar files for your java application. * Ensure that log4j-core dependency is defined in pom.xml file correctly. * Double-check that the JAR files `denodo-commons-custom.jar` and `denodo-vdp-jdbcdriver-8.0-update-20230914.jar` contain the necessary `org.apache.logging.log4j.LogManager class`. Sometimes, especially in large projects, it's easy to mix up JAR files or versions. * Use JDBC driver of included in same update or drivers from older updates. Do not use the JDBC driver included in latest update to connect Denodo server in older update. You can refer to documentation [Access Through JDBC ](https://community.denodo.com/docs/html/browse/8.0/en/vdp/developer/access_through_jdbc/access_through_jdbc) * Check if there are any conflicting dependencies in your project. You can use tools like Maven and Gradle or manage dependencies to resolve conflicts. Also remember, the 4 elements that are required to connect a server via JDBC: 1. Class that implements the JDBC driver `com.denodo.vdp.jdbc.Driver` 2. Connection string which points out the machine, port and name of the database, like: > jdbc:denodo://<hostname>:<port>/<databaseName> 3. Username 4. Password You can also refer to [Developing Custom Functions](https://community.denodo.com/docs/html/browse/latest/en/vdp/developer/developing_extensions/developing_custom_functions/developing_custom_functions) Hope it helps!
Denodo Team
10-04-2024 23:23:23 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here