JBoss AS 7 not using WEB-INF hibernate lib and throwing "Unknown service requested [org.hibernate.boot.registry.classloading.spi.ClassLoaderService]" - spring

I'm migrating a Spring+Hibernate application from Weblogic 12c to JBoss AS 7, and I'm getting the following error:
20:07:47,395 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.persistenceunit."connecta-presenter-2.2.1.war#ConnectaPresenterPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."connecta-presenter-2.2.1.war#ConnectaPresenterPU": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_95]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_95]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_95]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ConnectaPresenterPU] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
Caused by: org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.boot.registry.classloading.spi.ClassLoaderService]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:126)
at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:49)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 9 more
The Unknown service requested [org.hibernate.boot.registry.classloading.spi.ClassLoaderService] message thrown by line 126 of org.hibernate.service.internal.AbstractServiceRegistryImpl is an exception thrown only in version 4.0.1 of Hibernate Core, which is the version that is in my JBoss AS 7 modules folder.
The thing is that my application uses Hibernate 4.3.10, and this specific line doesn't exist more in this version (I could see comparing the source code on Github).
The following documentation on JBoss AS 7 site states that when you migrate from Weblogic to JBoss:
https://docs.jboss.org/author/display/AS72/How+do+I+migrate+my+application+from+WebLogic+to+AS+7#HowdoImigratemyapplicationfromWebLogictoAS7-Migrateweblogic.xmlDescriptorFileConfigurations
So there's no such code as the following in jboss-web.xml file:
<prefer-application-packages>
<package-name>javassist.*</package-name>
</prefer-application-packages>
It says that JBoss always uses WEB-INF/classes and WEB-INF/lib before the internal modules.
Any idea of what's happening?

If you want to use your own specific version of Hibernate (or any other service/software for that matter), you can do that instead of depending on JBoss AS 7 modules.
Create a new folder structure, say org/myhibernate/main in your $JBOSS_HOME\modules\system\layers\base\ directory. Put the needed jar (say my.jar) in the main folder and create a module.xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.myhibernate">
<resources>
<!-- Modules -->
<resource-root path="my.jar" />
</resources>
<dependencies>
<module name="javax.api"/>
<module name="sun.jdk"/>
</dependencies>
</module>
Now create a jboss-deployment-structure.xml in your EAR/web folder in your workspace and include this dependency -
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<sub-deployment name="yourfile.war">
<dependencies>
<module name="org.myhibernate" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>

Related

JBoss WildFly 11, Hibernate ORM 5.2, OGM 5.3 and MongoDB - OgmIntegrator not found

Progressing slowly through trying to get Hibernate ORM 5.2 working with OGM 5.3 so I can use JPA with MongoDB.
To remove the JNDI look-up error, referenced in the OGM FAQs:
When using Hibernate OGM on top of WildFly, I’m getting a
JndiException. What’s wrong? In case you’re are seeing a JndiException
saying "Unable to lookup JNDI name [---PlaceHolderDSForOGM---]", your
application likely cannot access the application server module(s) of
Hibernate OGM.
To change this, add the following line to the META-INF/MANIFEST.MF
file of your archive (adapt it to match your chosen datastore):
Dependencies: org.hibernate:ogm services, org.hibernate.ogm.mongodb
services Alternatively, you can configure this via the descriptor
jboss-deployment-structure.xml. See the reference guide to learn more.
I created: jboss-deployment-structure.xml
containing:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate.ogm" slot="5.3" services="export" />
<module name="org.hibernate.ogm.mongodb" slot="5.3" services="export" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Now when I try to deploy my EAR through the WildFly 11 console I get:
17:58:42,921 ERROR [org.jboss.msc.service.fail] (ServerService Thread
Pool -- 65) MSC000001: Failed to start service
jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit".FIRST_PHASE:
org.jboss.msc.service.StartException in service
jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit".FIRST_PHASE:
java.util.ServiceConfigurationError:
org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:128)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:104)
at
org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:640)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1.run(PhaseOnePersistenceUnitServiceImpl.java:137)
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.ogm.service.impl.OgmIntegrator not found 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:372)
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:459)
at
org.hibernate.integrator.internal.IntegratorServiceImpl.(IntegratorServiceImpl.java:40)
at
org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:224)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:406)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:196)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:164)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
at
org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.(TwoPhaseBootstrapImpl.java:39)
at
org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.getBootstrap(HibernatePersistenceProviderAdaptor.java:199)
at
org.wildfly.jpa.hibernateogm5.HibernateOGMPersistenceProviderAdaptor.getBootstrap(HibernateOGMPersistenceProviderAdaptor.java:87)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.createContainerEntityManagerFactoryBuilder(PhaseOnePersistenceUnitServiceImpl.java:254)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access$900(PhaseOnePersistenceUnitServiceImpl.java:59)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:125)
... 7 more
17:58:42,926 ERROR [org.jboss.as.controller.management-operation]
(External Management Request Threads -- 1) WFLYCTL0013: Operation
("add") failed - address: ([("deployment" => "NOTiFYwell.ear")]) -
failure description: {"WFLYCTL0080: Failed services" =>
{"jboss.persistenceunit.\"NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit\".FIRST_PHASE"
=> "java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found"}} 17:58:42,927
ERROR [org.jboss.as.server] (External Management Request Threads -- 1)
WFLYSRV0021: Deploy of deployment "NOTiFYwell.ear" was rolled back
with the following failure message: {"WFLYCTL0080: Failed services"
=> {"jboss.persistenceunit.\"NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit\".FIRST_PHASE"
=> "java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found"}} 17:58:42,939
INFO [org.jboss.as.server.deployment] (MSC service thread 1-7)
WFLYSRV0208: Stopped subdeployment (runtime-name: NOTiFYwellJAR.jar)
in 10ms 17:58:42,942 INFO [org.jboss.as.server.deployment] (MSC
service thread 1-8) WFLYSRV0208: Stopped subdeployment (runtime-name:
NOTiFYwellWAR.war) in 13ms 17:58:42,952 INFO
[org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028:
Stopped deployment NOTiFYwell.ear (runtime-name: NOTiFYwell.ear) in
25ms
The error:
Provider org.hibernate.ogm.service.impl.OgmIntegrator not found
Refers to class OgmIntegrator found in:
org/hibernate/ogm/service/impl/OgmIntegrator.class under /usr/local/Cellar/wildfly-as/11.0.0.Final/libexec/modules/system/layers/base/org/hibernate/ogm/5.3/hibernate-ogm-core-5.3.0.Final.jar
Any ideas why this isn't being loaded? TIA
I think I figure out the problem, you need to use this:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate.ogm" slot="5.3" services="export" />
<module name="org.hibernate.ogm.mongodb" slot="5.3" services="export" />
</dependencies>
</deployment>
</jboss-deployment-structure>
This exception
org.jboss.modules.ModuleNotFoundException: org.hibernate:5.3
means that you are using org.hibernate:5.3 instead of org.hibernate.ogm:5.3
The error might be in the jboss-deployment descriptor or in the MANIFEST.MF. Just make sure you are only using one or the other.
UPDATE: There was an error in the Hibernate website FAQ session, I updated it. Thanks for the feedback.
Finally got the EAR deployed.
It only deploys the EAR if I include a MANIFEST.MF in EAR's META-INF:
Manifest-Version: 1.0
Dependencies: org.hibernate.ogm:5.3 services, org.hibernate.ogm.mongodb:5.3 services
and remove 'jboss-deployment-structure.xml'.
If I try and use a 'jboss-deployment-structure.xml' (empty MANIFEST):
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate.ogm" slot="5.3" services="export" />
<module name="org.hibernate.ogm.mongodb" slot="5.3" services="export" />
</dependencies>
</deployment>
</jboss-deployment-structure>
It fails to deploy with the error I've had before:
17:31:53,892 ERROR [org.jboss.msc.service.fail] (ServerService Thread
Pool -- 30) MSC000001: Failed to start service
jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit".FIRST_PHASE:
org.jboss.msc.service.StartException in service
jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit".FIRST_PHASE:
java.util.ServiceConfigurationError:
org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:128)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:104)
at
org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:640)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1.run(PhaseOnePersistenceUnitServiceImpl.java:137)
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.ogm.service.impl.OgmIntegrator not found 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:372)
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:459)
at
org.hibernate.integrator.internal.IntegratorServiceImpl.(IntegratorServiceImpl.java:40)
at
org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:224)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:406)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:196)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:164)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
at
org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.(TwoPhaseBootstrapImpl.java:39)
at
org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.getBootstrap(HibernatePersistenceProviderAdaptor.java:199)
at
org.wildfly.jpa.hibernateogm5.HibernateOGMPersistenceProviderAdaptor.getBootstrap(HibernateOGMPersistenceProviderAdaptor.java:87)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.createContainerEntityManagerFactoryBuilder(PhaseOnePersistenceUnitServiceImpl.java:254)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access$900(PhaseOnePersistenceUnitServiceImpl.java:59)
at
org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:125)
... 7 more
17:31:53,908 ERROR [org.jboss.as.controller.management-operation]
(External Management Request Threads -- 3) WFLYCTL0013: Operation
("add") failed - address: ([("deployment" => "NOTiFYwell.ear")]) -
failure description: {"WFLYCTL0080: Failed services" =>
{"jboss.persistenceunit.\"NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit\".FIRST_PHASE"
=> "java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found"}} 17:31:53,909
ERROR [org.jboss.as.server] (External Management Request Threads -- 3)
WFLYSRV0021: Deploy of deployment "NOTiFYwell.ear" was rolled back
with the following failure message: {"WFLYCTL0080: Failed services"
=> {"jboss.persistenceunit.\"NOTiFYwell.ear/NOTiFYwellJAR.jar#NOTiFYwellMongoDBPersistenceUnit\".FIRST_PHASE"
=> "java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.ogm.service.impl.OgmIntegrator not found"}}
Mapped an enity to my MongoDB table and was able to return a 'List' of Entities.
Had to ensure Collection's id type was mapped as:
#Id
#Type(type = "objectid")
private String id;

How to deploy a JDBC Driver to Wildfly that can be used by WebApp

We are currently migrating from Tomcat to Wildfly 10 server. We like to take advantages of a Java EE Server. Currently we have some issues with the DataSource. We have deployed the JDBC Driver on Wildfly and set up the DataSource.
That works mainly good, but we like to use DatabaseQueryNotification (Oracle) for database-side events.
Now the problem I run into:
When I package the Driver with my war (additionally), I get an ClassCastException because of mismatch of T4Connection and OracleConnection. Therefore I removed the JDBC-Driver from my War (maven -> scope: provided). But now my Application failed on Deployment, because of NoClassDefFound (see Stacktrace bellow).
How can I make sure that the JDBC Driver can be found by the application?
Java Snippet:
public class DBListener implements IDBListener, Runnable, DatabaseChangeListener, IPropertyListener, Serializable {
#Resource(lookup = "java:/PlsDS")
private DataSource dataSource;
...
public void connectToDB(){
Connection tmpCon = dataSource.getConnection();
connection = (OracleConnection) tmpCon.getMetaData().getConnection();
...
}
}
Stacktrace:
14:32:59,869 WARN [org.jboss.modules] (MSC service thread 1-7) Failed to define class de.istec.pls.client.db.listener.DBListener in Module "deployment.client.pls-sc-1.0.0-SNAPSHOT.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link de/istec/pls/client/db/listener/DBListener (Module "deployment.client.pls-sc-1.0.0-SNAPSHOT.war:main" from Service Module Loader): oracle/jdbc/dcn/DatabaseChangeListener
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:606)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
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)
14:32:59,871 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."client.pls-sc-1.0.0-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."client.pls-sc-1.0.0-SNAPSHOT.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "client.pls-sc-1.0.0-SNAPSHOT.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
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)
Caused by: java.lang.NoClassDefFoundError: Failed to link de/istec/pls/client/db/listener/DBListener (Module "deployment.client.pls-sc-1.0.0-SNAPSHOT.war:main" from Service Module Loader): oracle/jdbc/dcn/DatabaseChangeListener
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:606)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
I have solved the Problem:
I had to deploy the JDBC-Driver as a Module (see:
http://hpehl.info/jdbc-driver-setup.html)
I have to Export the needed oracle.jdbc.dcn* files, from module
Insert the Dependency in the Manifest.MF file. (can be done by Maven, see below)
module.xml
<module xmlns="urn:jboss:module:1.1" name="com.oracle">
<resources>
<resource-root path="ojdbc7-12.1.0.2.jar"/>
</resources>
<dependencies>
<system export="true">
<paths>
<path name="oracle/jdbc/OracleStatement"/>
<path name="oracle/jdbc/dcn/DatabaseChangeEvent"/>
<path name="oracle/jdbc/dcn/DatabaseChangeListener"/>
<path name="oracle/jdbc/dcn/DatabaseChangeRegistration"/>
<path name="oracle/jdbc/dcn/QueryChangeDescription"/>
<path name="oracle/jdbc/dcn/RowChangeDescription"/>
</paths>
</system>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
pom.xml
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifestEntries>
<Dependencies>com.oracle</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
You should get an instance of a datasource through JNDI or inject through CDI.

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

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.

Cannot deploy ear on WildFly 8 due to failures when processing its structure

I'm having the following error on Wildfly when trying to deploy an EAR that currently works on Glassfish 4:
09:04:08,976 ERROR [org.jboss.as.controller.management-operation]
(DeploymentScanner-threads - 1) JBAS014613: Operation ("full-replace-deployment")
failed - address: ([]) - failure description: {"JBAS014671: Failed services" =>
{"jboss.deployment.unit.\"planoa.ear\".STRUCTURE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit.\"planoa.ear\".STRUCTURE: JBAS018733: Failed to process phase
STRUCTURE of deployment \"planoa.ear\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011037: Unable to process modules in application.xml for EAR
[\"/home/psoto/Programs/wildfly-8.1.0.Final/standalone/deployments/planoa.ear\"],
module file planoa-update-ejb.jar not found"}}
09:04:09,071 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565:
Replaced deployment "planoa.ear" with deployment "planoa.ear"
09:04:09,072 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1)
JBAS014774: Service status report
JBAS014777: Services which failed to start:
service jboss.deployment.unit."planoa.ear".STRUCTURE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."planoa.ear".STRUCTURE: JBAS018733: Failed to process phase
STRUCTURE of deployment "planoa.ear"
service jboss.deployment.unit."planoa.ear".STRUCTURE
This is the content of my application.xml (generated with maven ear plugin):
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
<display-name>planoa-ear</display-name>
<module>
<ejb>planoa-update-ejb.jar</ejb>
</module>
<module>
<ejb>planoa-core-ejb.jar</ejb>
</module>
<module>
<web>
<web-uri>planoa-web.war</web-uri>
<context-root>/</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
This is the output of jar -tf myearfile.ear:
META-INF/
META-INF/MANIFEST.MF
lib/
lib/planoa-messages.jar/
lib/planoa-messages.jar/META-INF/
lib/planoa-messages.jar/META-INF/maven/
lib/planoa-messages.jar/META-INF/maven/com.gi.planoa/
lib/planoa-messages.jar/META-INF/maven/com.gi.planoa/planoa-messages/
lib/planoa-pu.jar/
lib/planoa-pu.jar/com/
lib/planoa-pu.jar/com/gi/
lib/planoa-pu.jar/com/gi/planoa/
lib/planoa-pu.jar/com/gi/planoa/pu/
lib/planoa-pu.jar/com/gi/planoa/pu/eclipselink/
lib/planoa-pu.jar/com/gi/planoa/pu/eclipselink/logger/
lib/planoa-pu.jar/META-INF/
lib/planoa-pu.jar/META-INF/maven/
lib/planoa-pu.jar/META-INF/maven/com.gi.planoa/
lib/planoa-pu.jar/META-INF/maven/com.gi.planoa/planoa-pu/
lib/planoa-log.jar/
lib/planoa-log.jar/META-INF/
lib/planoa-log.jar/META-INF/maven/
lib/planoa-log.jar/META-INF/maven/com.gi.planoa/
lib/planoa-log.jar/META-INF/maven/com.gi.planoa/planoa-log/
planoa-web.war
META-INF/application.xml
META-INF/jboss-app.xml
META-INF/glassfish-application.xml
META-INF/jboss-deployment-structure.xml
planoa-core-ejb.jar
planoa-update-ejb.jar
lib/commons-codec-1.5.jar
lib/gson-2.2.4.jar
lib/gi-commons-ejb-jee7-3.0.37.jar
lib/gi-commons-logback-3.0.37.jar
lib/gi-commons-jsf2-3.0.37.jar
lib/poi-3.10-FINAL.jar
lib/planoa-core-service.jar
lib/commons-lang3-3.1.jar
lib/gi-commons-utils-3.0.37.jar
lib/gi-commons-jaxws-3.0.37.jar
lib/planoa-messages.jar/WebMessageResources.properties
lib/planoa-messages.jar/META-INF/MANIFEST.MF
lib/planoa-messages.jar/META-INF/maven/com.gi.planoa/planoa-messages/pom.properties
lib/planoa-messages.jar/META-INF/maven/com.gi.planoa/planoa-messages/pom.xml
lib/planoa-messages.jar/ValidationMessages.properties
lib/providers-io-geonames-1.0.03-20141008.234431-86.jar
lib/joda-time-2.4.jar
lib/planoa-pu.jar/com/gi/planoa/pu/eclipselink/logger/PlanoASqlSessionLog.class
lib/planoa-pu.jar/com/gi/planoa/pu/eclipselink/logger/PlanoASqlSessionCustomizer.class
lib/planoa-pu.jar/META-INF/MANIFEST.MF
lib/planoa-pu.jar/META-INF/persistence.xml
lib/planoa-pu.jar/META-INF/maven/com.gi.planoa/planoa-pu/pom.properties
lib/planoa-pu.jar/META-INF/maven/com.gi.planoa/planoa-pu/pom.xml
lib/slf4j-api-1.7.7.jar
lib/logback-core-1.1.2.jar
lib/commons-logging-1.1.3.jar
lib/primefaces-5.0.6.jar
lib/planoa-log.jar/logback_desarrollo.xml
lib/planoa-log.jar/META-INF/MANIFEST.MF
lib/planoa-log.jar/META-INF/maven/com.gi.planoa/planoa-log/pom.properties
lib/planoa-log.jar/META-INF/maven/com.gi.planoa/planoa-log/pom.xml
lib/planoa-log.jar/logback.xml
lib/gi-commons-beanvalidation-3.0.37.jar
lib/commons-lang-2.6.jar
lib/gi-commons-validation-3.0.37.jar
lib/logback-classic-1.1.2.jar
lib/planoa-core-model.jar
lib/primefaces-extensions-2.1.0.jar
META-INF/maven/
META-INF/maven/com.gi.planoa/
META-INF/maven/com.gi.planoa/planoa-ear/
META-INF/maven/com.gi.planoa/planoa-ear/pom.xml
META-INF/maven/com.gi.planoa/planoa-ear/pom.properties
The error says that planoa-update-ejb.jar was not found, but as you can see, its inside the ear.
Moreover, if I pick the generated ear, and deploy it through the web interface it works perfectly. So I think its a problem with netbeans wildfly plugin.
After hours of searching I think I found what the issue is.
Its important to understand that the EE 7 plugins for Netbeans seem to deploy the EARs and WARs as exploded artifacts (This makes development fast). The reason why the packaged EAR will work and the exploded ear doesn't is in fact exactly what its telling you (it cannot find the module(s)).
You have to look your application server's deployment directory.
NOTE: running jar -tf on you packaged EAR will give you misleading information, because that's NOT what's deployed when using an IDE to deploy
The root cause of this issue is in the way you build your project. I know in Maven some of us like the do away with version information by doing something like this:
<build>
<!-- This is replicated to your packing mechanisms (May cause problems in Exploded deployments) -->
<finalName>${project.artifactId}</finalName>
</build>

two ejb jar files with same name in different EAR projects conflict with each other on jboss 7.1

I'm migrating projects from Jboss 5.1 to jboss 7.1
I have two EARs, which run on the same Jboss. They contain ejb project inside and both ejb jar files are called services.jar due to finalname tag in EJB_PROJECT/pom.xml
<build>
<finalName>services</finalName>
.....
</build>
On Jboss 5.1 it worked fine, but now i get error :
18:07:16,858 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.subunit."my1.ear"."services.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."my1.ear"."services.jar".INSTALL: Failed to process phase INSTALL of subdeployment "services.jar" of deployment "my1.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_45]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018027: Failed to add JBoss Web deployment service
at org.jboss.as.web.deployment.WarDeploymentProcessor.processDeployment(WarDeploymentProcessor.java:320)
at org.jboss.as.web.deployment.WarDeploymentProcessor.deploy(WarDeploymentProcessor.java:114)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.web.deployment.default-host./services.realm is already registered
at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.as.web.deployment.WarDeploymentProcessor.processDeployment(WarDeploymentProcessor.java:269)
... 7 more
Is there a way to make this work without changing finalname tag's value? If I change it, then url to my application changes and i don't want that.
Try having this in your META-INF/ejb-jar.xml of your EJB:
<?xml version="1.0" encoding="UTF-8"?>
<javaee:ejb-jar version="3.1"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
<javaee:module-name>some-name-you-want-for-your-ejb</javaee:module-name>
</javaee:ejb-jar>
As per EJB specification, that should override the file name for JNDI. This is clarified for example in EJB FAQ:
<module-name> defaults to the unqualified name of the ejb-jar file or
.war file in which the EJB component is defined, minus the file
extension. The <module-name> can be explicitly specified using the
<module-name> element of the ejb-jar.xml (for ejb-jars) or web.xml(for
EJB components defined in .wars).

Resources