0

I'm trying to use Hibernate with jasperreports, using jasersoft studio (6.10.0),

I'm using hibernate 5 in my project, so I'm using annotations to map classes.

When I'm creating the Hibernate Data Adapter, I chose to use "Annotations" but I got the following error:

java.lang.ClassNotFoundException: org.hibernate.cfg.AnnotationConfiguration cannot be found by net.sf.jasperreports_6.10.0.final 

Am I missing some jar files?

1
  • 1
    Note hibernate is an optional dependance of jasper report, please check that first that you have hibernate in class path. Commented Oct 4, 2019 at 16:18

1 Answer 1

0

In Hibernate 3.6, “org.hibernate.cfg.AnnotationConfiguration” is deprecated, and all its functionality has been moved to “org.hibernate.cfg.Configuration“.

So , you can safely replace your “AnnotationConfiguration” with “Configuration” class.

Taken from Hibernate – The type AnnotationConfiguration is deprecated

In practical terms, it means you need to use other version of jasperreports that doesn't use deprecated API or downgrade Hibernate.

Sign up to request clarification or add additional context in comments.

2 Comments

This is pretty much the same as this other answer and as information jasper reports 6.10 have Hibernate 5.4.1.Final as a dependency. Hence it does not in itself use deprecated api and it is the latest version, hence "need to use other version" is not a feasible answer. Furthermore deprecated methods do not throw java.lang.ClassNotFoundException
@PetterFriberg Furthermore deprecated methods do not throw java.lang.ClassNotFoundException. This is not correct. Simply write a method that throws ClassNotFoundException when it doesn't find its dependency and annotate it a @Deprecated.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.