In IntelliJ Idea I created a project with JPA 2.1 and hibernate 4.3.10 final. After I created a datasource (Test connection : Success) I generated persistence mapping from database. Project compiles without error. When I tried to test in JPA Console with a simple Select * query, it returns following exception:
[2015-05-21 16:01:27] javax.persistence.PersistenceException: Unable to locate persistence units
[2015-05-21 16:01:27] java.lang.RuntimeException: javax.persistence.PersistenceException: Invalid persistence.xml.
Error parsing XML [line : -1, column : -1] : cvc-elt.1: Cannot find the declaration of element 'persistence'.
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.validate(PersistenceXmlParser.java:377)
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.loadUrl(PersistenceXmlParser.java:310)
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.parsePersistenceXml(PersistenceXmlParser.java:114)
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.doResolve(PersistenceXmlParser.java:104)
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.locatePersistenceUnits(PersistenceXmlParser.java:86)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:97)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:88)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:69)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at com.intellij.jpa.remote.impl.JpaFacadeImpl.createEntityManagerFactory(JpaFacadeImpl.java:16)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$2/4400315.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
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)
Here is the persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="NewPersistenceUnit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>model.DepartmentEntity</class>
<class>model.UserEntity</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/svgroup"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
Can someone tell me how to fix this error? I was searching and reading for about 10 hours without success
EDIT
If I try to deploy the app on wildfly without creating entities from database it will deploy the app. However, if I try to deploy the app after the entities are created i get the following error:
2015-05-21 18:13:01,697 INFO [org.hibernate.Version] (ServerService Thread Pool -- 15) HHH000412: Hibernate Core {4.3.7.Final}
2015-05-21 18:13:01,704 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 15) HHH000206: hibernate.properties not found
2015-05-21 18:13:01,711 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 15) HHH000021: Bytecode provider name : javassist
2015-05-21 18:13:02,183 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."SVGZad4_ejb_exploded.rar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."SVGZad4_ejb_exploded.rar".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "SVGZad4_ejb_exploded.rar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration
at org.jboss.as.connector.deployers.ra.processors.ParsedRaDeploymentProcessor.process(ParsedRaDeploymentProcessor.java:237)
at org.jboss.as.connector.deployers.ra.processors.ParsedRaDeploymentProcessor.deploy(ParsedRaDeploymentProcessor.java:130)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 5 more
Caused by: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration
at org.jboss.jca.common.metadata.ra.common.ResourceAdapter1516Impl.validate(ResourceAdapter1516Impl.java:352)
at org.jboss.jca.common.metadata.ra.common.ConnectorAbstractmpl.validate(ConnectorAbstractmpl.java:334)
at org.jboss.as.connector.deployers.ra.processors.ParsedRaDeploymentProcessor.process(ParsedRaDeploymentProcessor.java:206)
... 7 more
2015-05-21 18:13:02,207 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "SVGZad4_ejb_exploded.rar")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"SVGZad4_ejb_exploded.rar\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"SVGZad4_ejb_exploded.rar\".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment \"SVGZad4_ejb_exploded.rar\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration
Caused by: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration"}}
2015-05-21 18:13:02,216 ERROR [org.jboss.as.server] (management-handler-thread - 3) JBAS015870: Deploy of deployment "SVGZad4_ejb_exploded.rar" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"SVGZad4_ejb_exploded.rar\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"SVGZad4_ejb_exploded.rar\".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment \"SVGZad4_ejb_exploded.rar\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration
Caused by: org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration"}}
2015-05-21 18:13:02,301 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-1) HV000001: Hibernate Validator 5.1.3.Final
2015-05-21 18:13:02,626 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 15) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'SVGZad4_ejb_exploded.rar#NewPersistenceUnit'
2015-05-21 18:13:02,637 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment SVGZad4_ejb_exploded.rar (runtime-name: SVGZad4_ejb_exploded.rar) in 422ms
2015-05-21 18:13:02,640 INFO [org.jboss.as.controller] (management-handler-thread - 3) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."SVGZad4_ejb_exploded.rar".INSTALL
I think your Jars (JPA / Hibernate) are probably older.
What Jars are you using?
Usually when you download something like Hibernate, they allow you to download sample projects which have the example of such persistence.xml and other files.
Update
Maybe the app isn't picking up the expected persistence.xml file?
Try to add some obviously incorrect, invalid text in your persistence.xml file. This way, the exception will printed out with the complete name of the persitence.xml that is being looked at.
I think you have to change your persistence.xml
The following line
<property name = "hbm2ddl.auto" value = "update" />
must probably be changed to
<property name = "hibernate.hbm2ddl.auto" value = "update" />
Then I suppose you do not have any password in your database
<property name = "hibernate.connection.password" value = "?" />
Otherwise, I see nothing strange.
Related
I am having problems while starting a Java EE 7 project on Wildfly-23.0.1 server.
Below follow piece of start log:
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.jdbc.demoDB"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.\"com.bambino.demo.HelloServlet\".source is missing [jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.jdbc.demoDB]"]
}
22:44:09,005 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment "demo-1.0-SNAPSHOT.war" was rolled back with the following failure message:
{
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.jdbc.demoDB"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.\"com.bambino.demo.HelloServlet\".source is missing [jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.jdbc.demoDB]"]
}
22:44:09,009 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0019: Stopped Driver service with driver-name = demo-1.0-SNAPSHOT.war_com.mysql.cj.jdbc.Driver_8_0
22:44:09,010 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 78) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'demo-1.0-SNAPSHOT.war#generalPU'
22:44:09,012 INFO [org.hibernate.orm.beans] (ServerService Thread Pool -- 78) HHH10005004: Stopping BeanContainer : org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl#5677c4c9
22:44:09,015 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 78) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'demo-1.0-SNAPSHOT.war#generalPU'
22:44:09,039 INFO [org.infinispan.manager.DefaultCacheManager] (ServerService Thread Pool -- 26) Stopping cache manager null on null
22:44:09,045 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0028: Stopped deployment demo-1.0-SNAPSHOT.war (runtime-name: demo-1.0-SNAPSHOT.war) in 39ms
[2021-04-21 10:44:09,084] Artifact demo:war: Error during artifact deployment. See server log for details.
[2021-04-21 10:44:09,084] Artifact demo:war: java.lang.Exception: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.jdbc.demoDB"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.\"com.bambino.demo.HelloServlet\".source is missing [jboss.naming.context.java.module.\"demo-1.0-SNAPSHOT\".\"demo-1.0-SNAPSHOT\".env.jdbc.demoDB]"]}
persistance.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
version="2.2">
<persistence-unit name="generalPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/demoDB</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.cache.share.default" value="false"/>
<property name="eclipselink.jdbc.sequence-connection-pool" value="true" />
</properties>
</persistence-unit>
</persistence>
can anyone help me to solve this problem ?
Thank you and sorry in advance!
I am working on upgrading our wildfly version from 8 to 21.
Back in the days of 8, wildfly shipped with hibernate for the default persistence engine, it appears that now it ships with Jakarta. So, I am going through the process of attempting to get the persistence working and am running into the below-listed errors.
I have a clean download of wildly 21.0.2.Final, I have modified the standalone.xml to include my data sources which I believe are being loaded correctly because these lines that end up in the log.
10:48:46,578 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0001: Bound data source [java:jboss/datasources/unitTestDS]
10:48:46,578 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0001: Bound data source [java:jboss/datasources/localLiveDS]
persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="ertDatasource">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/localLiveDS</jta-data-source>
<properties>
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
<property name="hibernate.enable_lazy_load_no_trans" value="true"/>
</properties>
</persistence-unit>
</persistence>
test-persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ertDatasource">
<jta-data-source>java:jboss/datasources/unitTestDS</jta-data-source>
<properties>
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
<property name="hibernate.enable_lazy_load_no_trans" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect"/>
</properties>
</persistence-unit>
</persistence>
Here are the errors and warnings that I get when running the ./stabdalone.sh command
10:48:41,634 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-4) WFLYDM0111: Keystore /Applications/Wildfly/wildfly-21.0.2.Final-Clean/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
10:48:46,749 WARN [org.jboss.modules.define] (MSC service thread 1-5) Failed to define class org.hibernate.ejb.HibernatePersistence in Module "deployment.<project name>-api.war" from Service Module Loader: java.lang.IncompatibleClassChangeError: Failed to link org/hibernate/ejb/HibernatePersistence (Module "deployment.<project name>-api.war" from Service Module Loader): class org.hibernate.ejb.HibernatePersistence has interface org.hibernate.ejb.AvailableSettings as super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.lang.ClassLoader.defineClass(ClassLoader.java:839)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:424)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:555)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
at org.jboss.modules.Module.loadModuleClass(Module.java:731)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:73)
at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:49)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
10:48:46,751 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.unit."<project name>-api.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."<project name>-api.war".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "<project name>-api.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IncompatibleClassChangeError: Failed to link org/hibernate/ejb/HibernatePersistence (Module "deployment.<project name>-api.war" from Service Module Loader): class org.hibernate.ejb.HibernatePersistence has interface org.hibernate.ejb.AvailableSettings as super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.lang.ClassLoader.defineClass(ClassLoader.java:839)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:424)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:555)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
at org.jboss.modules.Module.loadModuleClass(Module.java:731)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:73)
at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:49)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
... 8 more
10:48:46,815 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "<project name>-api.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"<project name>-api.war\".FIRST_MODULE_USE" => "WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"<project name>-api.war\"
Caused by: java.lang.IncompatibleClassChangeError: Failed to link org/hibernate/ejb/HibernatePersistence (Module \"deployment.<project name>-api.war\" from Service Module Loader): class org.hibernate.ejb.HibernatePersistence has interface org.hibernate.ejb.AvailableSettings as super class"}}
10:48:46,861 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 21.0.2.Final (WildFly Core 13.0.3.Final) started (with errors) in 22664ms - Started 336 of 599 services (1 services failed or missing dependencies, 373 services are lazy, passive or on-demand)
In the wildfly-root/modules/system/layers/base/javax/persistence/api/main folder I have the module.xml and the jakarta.persistence-api-2.2.3.jar
module.xml content
<?xml version="1.0" encoding="UTF-8"?>
<module name="javax.persistence.api" xmlns="urn:jboss:module:1.7">
<dependencies>
<!-- PersistenceUnitInfo needs javax.sql.DataSource -->
<module name="javax.api" export="true"/>
</dependencies>
<resources>
<resource-root path="jakarta.persistence-api-2.2.3.jar"/>
</resources>
</module>
I have added the Jakarta persistence dependency
<!-- https://mvnrepository.com/artifact/jakarta.persistence/jakarta.persistence-api -->
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>2.2.3</version>
</dependency>
I also have this, not sure if I need it though.
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.4.Final</version>
</dependency>
Wondering what dumb thing I am missing?
EDIT:
I have added this to the dependencyManagement section:
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-jakartaee8-with-tools</artifactId>
<scope>import</scope>
<type>pom</type>
<version>21.0.2.Final</version>
</dependency>
And I now get this new error:
14:20:07,862 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 82) MSC000001: Failed to start service jboss.persistenceunit."eventhub-api.war#ertDatasource": org.jboss.msc.service.StartException in service jboss.persistenceunit."eventhub-api.war#ertDatasource": java.lang.AbstractMethodError
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:198)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:128)
at java.security.AccessController.doPrivileged(Native Method)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:659)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:213)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:513)
Caused by: java.lang.AbstractMethodError
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:276)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1250)
at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:170)
... 10 more
14:20:07,865 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"eventhub-api.war#ertDatasource\"" => "java.lang.AbstractMethodError
Caused by: java.lang.AbstractMethodError"}}
WildFLy is throwing exception when deployment your application. Also You shouldn't link which is an API that is provided by WildFly except if you remove JPA support from WildFly. Also WildFly is compatible with jakartaEE 8 so you shouldn't link your deployment to some API provided by WildFLy.
For JakartaEE 9 you should use WildFly preview
I'm developing a maven based JSF+JPA+EJB 3.2 Project using Eclipse and Wildfly 11.
While starting the App Server am getting the following error :
20:37:27,664 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0003: Processing weld deployment erpmini.war
20:37:28,116 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-4) HV000001: Hibernate Validator 5.3.5.Final
20:37:28,552 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-4) WFLYEJB0473: JNDI bindings for session bean named 'UserManagementServiceSlsb' in deployment unit 'deployment "erpmini.war"' are as follows:
java:global/erpmini/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService
java:app/erpmini/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService
java:module/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService
java:jboss/exported/erpmini/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService
java:global/erpmini/UserManagementServiceSlsb
java:app/erpmini/UserManagementServiceSlsb
java:module/UserManagementServiceSlsb
20:37:29,879 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."erpmini.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."erpmini.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "erpmini.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
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: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class com.itsys.erp.server.commonservices.usermgmt.slsbadapter.UserManagementServiceSlsb for component UserManagementServiceSlsb has errors:
WFLYJPA0033: Can't find a persistence unit named null in deployment "erpmini.war"
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:157)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:186)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:143)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 5 more
20:37:30,098 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.8.Final
20:37:31,825 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 63) WFLYCLINF0002: Started client-mappings cache from ejb container
20:37:32,131 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "erpmini.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"erpmini.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"erpmini.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class com.itsys.erp.server.commonservices.usermgmt.slsbadapter.UserManagementServiceSlsb for component UserManagementServiceSlsb has errors:
WFLYJPA0033: Can't find a persistence unit named null in deployment \"erpmini.war\""},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"erpmini.war\".beanmanager"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"erpmini.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"erpmini.war\".beanmanager]",
"jboss.deployment.unit.\"erpmini.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"erpmini.war\".beanmanager]"
]
}
I'm injecting the EntityManager in stateless bean:
#Stateless
public class UserManagementServiceSlsb implements UserManagementService {
/** The Entity Manager */
#PersistenceContext(name = "TELCOAppPU")
private EntityManager entityManager;
private UserManagementService userMgmtService;
....
}
Why the Container is not able to find persistence.xml file? persistence.xml is present in META-INF directory. Any help would be appreciated.
Thanks.
UPDATE :
here is Project dir structure , persistence.xml is present in META-INF directory.
Project dir structure
persistence.xml contains Entity classes and MySql database connection details.
<persistence-unit name="TELCOAppPU">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.itsys.erp.server.dal.entities.City</class>
<class>com.itsys.erp.server.dal.entities.Machine</class>
<class>com.itsys.erp.server.dal.entities.Product</class>
<class>com.itsys.erp.server.dal.entities.ProductType</class>
<class>com.itsys.erp.server.dal.entities.ProductionLog</class>
...
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/erpdb" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="root" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
Solved it by adding resources folder (as source folder) to the path src/main/resources and moving the META-INF folder to resources folder, which in turn tells maven to put all files under resources directory to target/classes and in WEB-INF/classes in the WAR.
Try placing your persistance.xml file inside WEB-INF (src/main/webapp/WEB-INF) directory, Since in case of a war, that is where you are supposed to place your persisntence.xml file.
The error:
2016-04-12 12:32:04,399 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 62) HHH000230: Schema export complete
2016-04-12 12:32:04,753 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./BanqueEEWeb.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./BanqueEEWeb.UndertowDeploymentInfoService: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener from [Module "deployment.BanqueEE.ear.BanqueEEWeb.war:main" from Service Module Loader]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:870)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:242)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_66]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_66]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_66]
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener from [Module "deployment.BanqueEE.ear.BanqueEEWeb.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.addListener(UndertowDeploymentInfoService.java:1145)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:734)
... 6 more
2016-04-12 12:32:05,109 INFO [org.jboss.weld.Bootstrap] (weld-worker-4) WELD-000119: Not generating any bean definitions from org.apache.struts2.tiles.StrutsTilesListener because of underlying class loading error: Type org.apache.struts2.tiles.StrutsTilesListener from [Module "deployment.BanqueEE.ear.BanqueEEWeb.war:main" from Service Module Loader] not found. If this is unexpected, enable DEBUG logging to see the full error.
2016-04-12 12:32:07,323 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "BanqueEE.ear")]) - failure description: {"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host./BanqueEEWeb.UndertowDeploymentInfoService" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./BanqueEEWeb.UndertowDeploymentInfoService: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener from [Module \"deployment.BanqueEE.ear.BanqueEEWeb.war:main\" from Service Module Loader]
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener from [Module \"deployment.BanqueEE.ear.BanqueEEWeb.war:main\" from Service Module Loader]"}}
2016-04-12 12:32:07,408 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) JBAS018559: Deployed "BanqueEE.ear" (runtime-name : "BanqueEE.ear")
2016-04-12 12:32:07,410 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./BanqueEEWeb.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./BanqueEEWeb.UndertowDeploymentInfoService: java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener from [Module "deployment.BanqueEE.ear.BanqueEEWeb.war:main" from Service Module Loader]
How to debug this error in Struts 2?
You have missed a library struts2-tiles-plugin-x.x.x.x.jar and probably their dependencies.
What you need is to add these libraries to the Deployment Assembly. It will help you to archive ear project and include dependencies that have equivalent manifest settings in their classpath.
If you want to know what is a Deployment Assembly you can read this article Eclipse : Java EE Module Dependencies is replaced by Web Deployment Assembly.
“Web Deployment Assembly“, which provide more powerful and flexible ways to configure the project packaging structure.
There's also a page that describes the process of linking external resources with the ear application: Web Application Development: Configuring Projects with External Resources.
Do you have some javaee api jar in your war ? Maybe a servlet.jar ? Please remove it, and check after that.
I have been trying to get these beans to deploy properly to JBoss AS 7 and continually getting errors. The last problem was the actual data source was not being bound and thanks to some help from some of you I was able to make the right changes and get it bind. However, the beans are still not starting. The log shows that it tries to start every bean but then gives this error:
09:31:51,832 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015871: Deploy of deployment "dodsr.ear" was rolled back with no failure message
Which tells me nothing. I've looked up the error and have found no answer.
I see this as it tries to start it:
09:31:48,792 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "dodsr.ear"
and this:
09:31:48,909 INFO [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "dodsr.jar"
But, immediately following the last one I see this:
09:31:48,910 INFO [org.jboss.as.pojo] (MSC service thread 1-3) JBAS017000: Found legacy bean/pojo namespace: urn:jboss:bean-deployer:2.0 - might be missing some xml features (potential exceptions).
09:31:48,908 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-15) MSC00001: Failed to start service jboss.deployment.unit."ejb3-container-jboss-beans.xml".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ejb3-container-jboss-beans.xml".PARSE: Failed to process phase PARSE of deployment "ejb3-container-jboss-beans.xml"
Does this error have anything to do with my problem?
This is only one example of the problems I've found:
09:31:49,196 INFO [org.jboss.as.jpa] (MSC service thread 1-12) JBAS011401: Read persistence.xml for DoDSRMGR
09:31:49,214 WARN [org.jboss.modules] (MSC service thread 1-9) Failed to define class org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory in Module "deployment.jboss-local-jdbc.rar:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/jboss/resource/adapter/jdbc/local/LocalManagedConnectionFactory (Module "deployment.jboss-local-jdbc.rar:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:517)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_55]
at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_55]
at org.jboss.jca.validator.ValidateClass.<init>(ValidateClass.java:88) [ironjacamar-validator-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:1582) [ironjacamar-deployers-common-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:1034) [ironjacamar-deployers-common-1.0.9.Final.jar:1.0.9.Final]
at org.jboss.as.connector.metadata.deployment.ResourceAdapterDeploymentService$AS7RaDeployer.doDeploy(ResourceAdapterDeploymentService.java:173)
at org.jboss.as.connector.metadata.deployment.ResourceAdapterDeploymentService.start(ResourceAdapterDeploymentService.java:100)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55]
Caused by: java.lang.NoClassDefFoundError: org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnectionFactory
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_55]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_55]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_55]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
... 20 more
Caused by: java.lang.ClassNotFoundException:
From the stack trace you posted, it seems this dependency is missing:
jboss-common-jdbc-wrapper.jar
Can you check if there a version of this jar on your classpath?