• Upgrading Hibernate, Hibernate Search and Lucene versions

  • He we will discuss about how to make customization and improvement to the OpenKM source code.
He we will discuss about how to make customization and improvement to the OpenKM source code.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #54758  by alan_vallejo
 
Hi,

At this time I'm trying to update Hibernate, Hibernate Search and Lucene versions in OpenKM to the latest libraries that are allowed to work in Java 7. The principal reason or motivation to make this change is to apply Interceptor (https://docs.jboss.org/hibernate/search ... nterceptor) class in the NodeDocument bean so that we can decide what documents should be indexed based on it's own properties.

So the actual versions in the OpenKM Community Version 6.3.13-DEV (portable development machine with Linux Mint) are:

Hibernate Search: 3.4.2
Hibernate ORM: 3.6.1
Lucene: 3.1.0


and the versions I want to upgrade to are:

Hibernate Search: 5.6.6.Final
Hibernate ORM: 5.1.17.Final
Lucene: 5.5.5


At the moment, after 3 days of hard work, I've fixed and reeimplemented all compilation errors and I'm trying to start the application. So, I've manage to fix some execution errors at the start but I'm stuck with the 3rd error in this list:

1st error:
java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
Solution applied (https://informaticadantesca.blogspot.co ... rnate.html):
Added to pom.xml:
Code: Select all
	<dependency>
	  <groupId>org.codehaus.woodstox</groupId>
	  <artifactId>stax2-api</artifactId>
	  <version>4.2.1</version>
	  <scope>runtime</scope>
	</dependency>
		 
	<dependency>
	  <groupId>org.codehaus.woodstox</groupId>
	  <artifactId>stax2-api</artifactId>
	  <version>3.1.4</version>
	  <scope>runtime</scope>
	</dependency>
2nd error:
java.lang.NoClassDefFoundError: org/hibernate/type/StringClobType
Solution applied:
Change all references of @Type(type = "org.hibernate.type.StringClobType") with @Type(type = "org.hibernate.type.TextType")

3rd error:
This is the one I'm struggling with. Any commands or recomendations would be appreciated.
I've searched through the project and I haven't found any references to this class. So I suppose that the error is related with another package or dependency. I tried to figure out which dependency could be but I'm still after 5 hours in the same point.
Code: Select all
java.lang.NoClassDefFoundError: org/hibernate/type/ImmutableType
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2337)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:829)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1278)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:184)
	at org.hibernate.type.TypeResolver.heuristicType(TypeResolver.java:110)
	at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:439)
	at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:421)
	at org.hibernate.mapping.Property.isValid(Property.java:226)
	at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:595)
	at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
	at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:422)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:711)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:727)
	at com.openkm.dao.HibernateUtil.getSessionFactory(HibernateUtil.java:183)
	at com.openkm.dao.HibernateUtil.getSessionFactory(HibernateUtil.java:87)
	at com.openkm.servlet.RepositoryStartupServlet.init(RepositoryStartupServlet.java:88)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1144)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4978)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5290)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1140)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.hibernate.type.ImmutableType
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
	... 40 more

Jun 11, 2024 2:02:40 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [RepositoryStartup] in web application [/OpenKM] threw load() exception
java.lang.ClassNotFoundException: org.hibernate.type.ImmutableType
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2337)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:829)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1278)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:184)
	at org.hibernate.type.TypeResolver.heuristicType(TypeResolver.java:110)
	at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:439)
	at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:421)
	at org.hibernate.mapping.Property.isValid(Property.java:226)
	at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:595)
	at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
	at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:422)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:711)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:727)
	at com.openkm.dao.HibernateUtil.getSessionFactory(HibernateUtil.java:183)
	at com.openkm.dao.HibernateUtil.getSessionFactory(HibernateUtil.java:87)
	at com.openkm.servlet.RepositoryStartupServlet.init(RepositoryStartupServlet.java:88)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1144)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4978)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5290)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1140)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Thanks a lot for at least reading this post and I would appreciatte any help or direction to follow.
 #54774  by alan_vallejo
 
UPDATE

Hi, I found that the problem is related with this package 3.3.1.OKM. So I'm stuck because this package works with org.hibernate:hibernate:jar:3.2.6.ga:compile which has a dependency with the version of hibernate that was installed before starting the upgrade.

So, as this version belongs to OKM (3.3.1.OKM), which version should I upgrade to in the pom.xml?
Code: Select all
      
...
    <!-- Workflow library from JBoss -->
      <dependency>
      <groupId>org.jbpm.jbpm3</groupId>
      <artifactId>jbpm-jpdl</artifactId>
      <version>3.3.1.OKM</version>
      <exclusions>
        <exclusion>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate</artifactId>
        </exclusion>
        <exclusion>
          <groupId>bsh</groupId>
          <artifactId>bsh</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.jackrabbit</groupId>
          <artifactId>jackrabbit-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jbpm.jbpm3</groupId>
      <artifactId>jbpm-identity</artifactId>
      <version>3.3.1.OKM</version>
    </dependency>
...

Please, if you think I shouldn't make this change or you feel uncomfortable giving me advise tell me.

Thanks in advance!
 #54799  by jllort
 
You can not upgrade spring security or hibernate search without upgrading the spring version. There's a hard link between the spring version and these libraries. This is a major upgrade.

I suggest being patient and waiting until we share the next major release of the OpenKM -> expected for the end of the year. We have been working from the beginning of this year on this release, but still there's a lot of work until we are able to share it.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.