How To Use Hibernate 4 with WildFly 13

1k Views Asked by At

Is it possible to run applications using hibernate-core-4.x on Wildfly 13?

I'm pretty sure that hibernate 4 is not supported on WildFly13, however I have a requirement to do it anyways. Part of the reasoning for this is that the application is using some classes that are no longer present in hibernate 5 (Mappings for example), and it would be a huge effort to change them.

My preference is to just update the application, but I need to show "due diligence" (or whatever) to justify the effort.

The exceptions we are seeing have to do with getting hibernate 4 to play nice with infinispan 9, or maybe down grading infinispan to version "6.x" as well.

All my relevant experience up to know has been with Tomcat, so I'm needing some help on this by either getting it to work, or being able to show official documentation or statements saying hibernate 4 is not supported.

Stacktrace

2018-07-11 17:30:17,034 ERROR (Thread-1 (ActiveMQ-client-global-threads)) [stderr] at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:174)

2018-07-11 17:30:17,050 ERROR (Thread-1 (ActiveMQ-client-global-threads)) [stderr] at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:150)

2018-07-11 17:30:17,050 ERROR (Thread-1 (ActiveMQ-client-global-threads)) [stderr] at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:137)

2018-07-11 17:30:17,050 ERROR (Thread-1 (ActiveMQ-client-global-threads)) [stderr] at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:123)

2018-07-11 17:30:17,050 ERROR (Thread-1 (ActiveMQ-client-global-threads)) [stderr] at org.hibernate.cache.infinispan.InfinispanRegionFactory.createCacheManager(InfinispanRegionFactory.java:415)

2018-07-11 17:30:17,050 ERROR (Thread-1 (ActiveMQ-client-global-threads)) [stderr] at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:323)

Code in parser registry throwing the exception:

public void parseElement(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException {

    QName name = reader.getName();

    ParserRegistry.NamespaceParserPair parser = (ParserRegistry.NamespaceParserPair)this.parserMappings.get(name);
    if (parser == null)
    {
        String uri = name.getNamespaceURI();
        int lastColon = uri.lastIndexOf(':');
        String baseUri = uri.substring(0, lastColon + 1) + "*";
        parser = (ParserRegistry.NamespaceParserPair)this.parserMappings.get(new QName(baseUri, name.getLocalPart()));
        if ((parser == null) || (!isSupportedNamespaceVersion(parser.namespace, uri.substring(lastColon + 1)))) throw log.unsupportedConfiguration(name.getLocalPart(), name.getNamespaceURI());
    }
    Schema oldSchema = reader.getSchema();
    reader.setSchema(Schema.fromNamespaceURI(name.getNamespaceURI()));
    parser.parser.readElement(reader, holder);
    reader.setSchema(oldSchema);
}
1

There are 1 best solutions below

0
On

I solved it in my project using jboss-deployment-structure.xml in my project with the following:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
        <dependencies>
            <module name="org.hibernate" slot="4.3"/>
        </dependencies>
</deployment>
</jboss-deployment-structure>  

There also slot 4.1

I hope it helps.