I have tried by several ways (Google, Stack Overflow...) and by several days resolve the following error without success. This error only happens if I run the application. Compilation is not affected.
org.databene.commons.ConfigurationError: Class not found: 'org.databene.benerator.engine.DefaultBeneratorFactory'
That is, if I try to instantiate an object of DefaultBeneratorFactory class, no problem appears. The error manifests when I call a method to initiate a generator:
The application I have developed is a plugin for Intellij Idea Community Edition (version 2016.2.4) in OS X El Capitan. The Java environment is Oracle JDK 8u102. My plugin uses Databene Benerator framework that can be downloaded as a set of Jars. I included the corresponding jars as Libraries in the project:
The libraries in Project Settings
See the Dependencies:
The dependencies in Project Settings
I followed some suggestions:
1) Mark the export option for each Jar. Link
2) Change the Output Path and Set Global Libraries. Link
3) Use previous versions of IDEA, try an earlier JDK, Invalidate Cache of IDEA.
Another important information, an Eclipse version of my plugin is fully functional in the same environment, with the same version of Benerator framework. So, I think there is some particularity of IDEA here.
Any help is greatly appreciated!!
I think the problem is how Intellij Idea deals with the classes inside the jar. The DefaultBeneratorFactory.class is in the jar in the correct path: org/databene/benerator/engine. Anyone can explain this?
Euler , the most common reason is the following. You have included dependencies that in turn reference the classes during execution and giving you a Exception. The IDE will not complain at compile time because all the pre-reqs are fulfilled , when the execution happens these classes would not be found for the jars/libraries that reference them and the exception is raised. To get around , the easiest is to use a framework like maven or gradle for example which can download these dependencies for you. When you mavenize for example all transitive dependencies get downloaded.Else you will have to manually download these jars . In your case , the following jar needs to be added. If there are other deps , the ClassNOtFOund will still keep coming up and you will need to solve them one at a time. HTH