org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype - spring

I am migrating my java web application from Jboss 7.1.1 Final to Wildfly 10,using :
spring 4.2.0,
hibernate 5.0.7,
jpa 2.1
and Mysql database.
I getting the following error while trying to run my code.
2016-07-20 19:30:50,176 ERROR [org.jboss.msc.service.fail]
(ServerService Thread Pool -- 61) MSC000001: Failed to start service
jboss.persistenceunit."ccp-ear-1.0-SNAPSHOT.ear/ccp-entities-1.0-SNAPSHOT.jar#ccpPU":
org.jboss.msc.service.StartException in service
jboss.persistenceunit."ccp-ear-1.0-SNAPSHOT.ear/ccp-entities-1.0-SNAPSHOT.jar#ccpPU":
java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
at
org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) at
org.jboss.threads.JBossThread.run(JBossThread.java:320) Caused by:
java.util.ServiceConfigurationError:
org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.envers.boot.internal.EnversIntegrator not a subtype at
java.util.ServiceLoader.fail(ServiceLoader.java:239) at
java.util.ServiceLoader.access$300(ServiceLoader.java:185) at
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:324)
at
org.hibernate.integrator.internal.IntegratorServiceImpl.(IntegratorServiceImpl.java:40)
at
org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:213)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:365)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:166)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:34)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:165)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:160)
at
org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
... 7 more

You need to delete the hibernate.cfg.xml and move the configuration from this file to persistence.xml.
Then You have also to remove all hibernate files from WEB-INF/lib folder, because WildFly has its own ones and this situation also possibly made a conflict.
More details on this problem in this link : JBoss Community Forum

I also had a similar issue with Wildfly 10.0.0.Final. In my project also we have all hibernate related libraries within the project's lib directory. But the jboss provided libraries caused conflicts so i have removed the content within the tag <module xmlns="urn:jboss:module:1.3" name="org.hibernate"> in module.xml file available in JBOSS_HOME\modules\system\layers\base\org\hibernate\main directory. Also i have removed the dependencies of hibernate libraries in jboss-deployment-struture.xml as,
<exclusions>
<module name="org.hibernate" slot="main"/>
</exclusions>
After these changes i can able overcome the conflict issues related to hibernate.Hope this will help.
Please note jboss-deployment-struture.xml change alone has not resolved my issue the change mentioned on module.xml file is mandatory.

Related

Websphere 8.5.5 - spring boot error: SpringServletContainerInitializer not a subtype

I have a spring boot application that works fine on Tomcat 8. When I try to deploy it on Websphere 8.5.5 with "Class loader order" set to "Classes loaded with local class loader first (parent last)" the application fails to start with the following exception:
... 73 more
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:242)
at java.util.ServiceLoader.access$300(ServiceLoader.java:192)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:380)
at java.util.ServiceLoader$1.next(ServiceLoader.java:456)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:537)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:171)
... 74 more
Just adding my experience with this problem, looking around on the various answers to similar problems I found out that the problem could be caused by some javax-servlet related jar in the classpath. After some trial and error I noticed that the spring-boot-starter-web dependency has an inherited spring-boot-starter-tomcat dependency. Excludung this jar from the application classpath when deploying on Websphere 8.5.5 solved the problem.

Issue in Jboss 7.2.2 migration

I am deploying a WAR file to JBoss EAP 7.2.2. During deployment, I am getting
"Caused by: java.lang.IllegalArgumentException: Unable to load generated mapper class com.amadeus.jcp.services.ttr.display.structured.builder.response.selma.mapper.offer.DisplayTripCartResponseOfferQuotationMapperSelmaGeneratedClass"
which is caused by "Caused by: java.lang.ClassNotFoundException: com.amadeus.jcp.services.ttr.display.structured.builder.response.selma.mapper.offer.DisplayTripCartResponseOfferQuotationMapperSelmaGeneratedClass"
It is a selma generated class and available in a jar inside WEB-INF/lib.
Same WAR file is deploying successfully in JBoss EAP 7.1.
As per class loader hierarchy, it should be identified but not happening.
Anybody have any idea of this issue, please help.
Verified standalone.xml and jboss-deployment-structure.xml. Using same version before and after migration except for name space version upgrade to subsystems.
Using Java 1.8.0_191

Memcached and Tomcat 8 Session Manager Issue

We were using Memcached for session management in our web application with Tomcat 7 and it worked liked charm. In order for it work, I added following jars to Tomcat's lib folder
spymemcached-2.8.12.jar
couchbase-client-1.1.4.jar
memcached-session-manager-tc7-1.6.5.jar
memcached-session-manager-1.6.5.jar
And made following change to Tomcat's server.xml
<Context path="customersupport" docBase="customerSupportOrderCentral#v2" sessionCookieName="CUSTOMERSUPPORT-JSESSIONID">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:oc-cs-elasticcache.w8eptf.cfg.usw1.cache.amazonaws.com:11211"
sticky="false" requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$" />
</Context>
Now we are in process of upgrading our JDK to 1.8 and Tomcat version to 8. I have been researching online for it and it turned out since tomcat 8 doesn't support getSessionCookieName, I have to update memcache jar files for tomcat 8. so I added new set of jar files at tomcat's lib folder as below.
spymemcached-2.11.1.jar
memcached-session-manager-tc8-1.8.1.jar
memcached-session-manager-1.8.1.jar
couchbase-client-1.4.0.jar
And Kept server.xml same but now Tomcat is throwing following error while starting up.
06-Jan-2016 07:03:48.934 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw error
java.lang.NoClassDefFoundError: org/apache/catalina/Lifecycle
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1012)
at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1178)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:766)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1344)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1451)
at org.apache.catalina.startup.Catalina.load(Catalina.java:551)
at org.apache.catalina.startup.Catalina.load(Catalina.java:599)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
If I dont change server.xml to include memcache manager, its working fine but with memcache session manager its throwing above error. I can really use some help here to resolve this issue.
Thanks
I had the same issue and got stuck for 2 days. The issue on my end was I had the below memcache specific jars in tomcat/lib and in another project specific classpath - tomcat/{project}/conf. The issue got resolved when I removed these jars from tomcat/{project}/conf
spymemcached-2.11.1.jar
memcached-session-manager-tc8-1.8.1.jar
memcached-session-manager-1.8.1.jar

java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener issue

I get this error
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5035)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5687)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1028)
at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1498)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1425)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1646)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:328)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1374)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1546)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1556)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1524)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextCleanupListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
... 16 more
I look in my deployed folder however and I see the jar that contains that file, what am I doing wrong?
https://github.com/davidahines/spacechip/tree/spring_security
The issue is that when I try to go to localhost:8080/spacechip I get "The resource is unavailable."
There is my configuration.
try change dependency of spring-web to 3.0.5.RELEASE in your pom, you are currently have 2 version on classpath
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
The jar may be in your deployed folder, but is the jar (or your deployed folder with a wildcard) in the CLASSPATH?
EnvironmentAware is located in the spring-context-3.1.1.RELEASE.jar, so you are missing that one.
Also recheck your Maven POM file so that you are not missing any other Spring library, like spring-web, spring-webmvc (you may have these since the DispatcherServlet class if found), spring-orm if you use an ORM like Hibernate, spring-jms if you use JMS, etc.

SLF4J: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized

I have the following maven dependency in my pom file:
<!-- depends on slf4j-api, log4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
When I deploy the project into tomcat, I am getting the error message:
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.ExceptionInInitializerError
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:288)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
at org.springframework.web.context.ContextCleanupListener.<clinit>(ContextCleanupListener.java:43)
... 16 more
When I look at the deployed war file, I see in the war file the following jars (among others):
slf4j-api-1.6.4.jar
slf4j-log4j12-1.6.4.jar
The strange thing is, that I don't see there any log4j.jar (even though it's a dependency of slf4j-log4j12-1.6.4.jar
Questions:
Why was log4j.jar not packed in the war file?
What does the error message mean and how to solve it?
I had this issue due to a bad jar file in the repository. Deleting the entire log4j directory in the Maven repository fixed it once I did Maven > Update Dependencies and it re-downloaded them.
The simple thing is, cause you didn't give it as dependency in your pom, cause slf4j is a logging facade which means you have to give the real implementation with it. The error message gives you a hint to the explanation of the cause of this error.
I got this error too and I actually had the log4j.jar in my war file.
But it turned out to be a classloader issue in my case: I had a jar in my shared/lib which tried to log with slf4j but that classloader did not have the log4j available.
It seems as if you need to downgrade your project to slf4j 1.4.2 to work with the log4j available in your tomcat. They are binary incompatible. You would also hang on to the provided afterwards, so you dont include them double.
The alternative is to get the other project to include the libraries themselves and remove from tomcat common. I know of no other exclusion mechanism on the tomcat.
For reference, and probably not helpful, I currently deploy on weblogic and it has a deployment specification that allows one to exclude server common classes and use bundled classes instead, such as the below snippet (with reference)

Resources