-2

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' at org.databene.commons.ExceptionMapper.configurationException(ExceptionMapper.java:121) at org.databene.commons.BeanUtil.forName(BeanUtil.java:358) at org.databene.commons.BeanUtil.newInstance(BeanUtil.java:423) at org.databene.benerator.BeneratorFactory.getInstance(BeneratorFactory.java:56) at org.databene.benerator.util.GeneratorUtil.init(GeneratorUtil.java:54) at testGeneration.TestCaseGenerator.generateTests(TestCaseGenerator.java:326)

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:

GeneratorUtil.init(stringGenerator);

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?

Community
  • 1
  • 1
EulerM
  • 1
  • 3

1 Answers1

0

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

Ramachandran.A.G
  • 4,788
  • 1
  • 12
  • 24
  • Ramachandran, you mentioned a jar that was already added in my Idea project. In fact, the class pointed in the error is in the jar databene-benerator. – EulerM Sep 15 '16 at 12:42