java - How to Get Spring JPA, Hibernate, and OSGi to Play Nice? -


I am trying to get a war file to run inside a Karaf OSGi container. The application is run correctly in stand-alone JT 6.1.26, but when this program is run inside a curve, I get the following exception and the curf instance is freezed:

  WARN org.hibernate.ejb .packaging.InputStreamZippedJarVisitor - Unable to find file (ignored): Bundle: //125.0: 240 / java.lang.NullPointerException: has zero in   

Note that The application is not trusting Hibernate in a different OSGI bundle; This includes the hibernate jar in Web-INF / Lib.

I have examined the information of this post: However, the application is using J.P.A. rather than using Hibernation directly. The configuration of the application is the second option found in this post:. As such, I do not have a handle on the Hibernate session federation which allows me to set annotated classes property.

Any ideas on how to get an exception?

I worked with the author in parallel and here I will post our solution here, Runs on

An exception is thrown because Hibernate tries to open the jar to see tremendous orbits. As mentioned in other posts, OSGI does not allow Hibernate to work like a Classloader, so it fails. The solution was specifying all the sections which were required to be manually loaded and then asking them not to try to load anything.

We use a persistence.xml file and a orm.xml file (we use default names, so let us know in our applicationContext. Xml .)

Our Persistence.xml file should only include orm.xml in & Lt; Mapping-file & gt; tag has been pointed to use. In addition, to keep trying to load additional classes from Hibernate, & lt; Exclude-unlisted-classes / & gt; tag is also included.

Use our orm.xml file with the entity class = "path.to.my.class" metadata-full = "false" /> Each entity was used to call the class. Hibernate says to use annotations found in the classroom to complete the metadata-full part configuration.

Comments