JBoss (WildFly) Standalone XML Configuration For Mysql

Answered

Hi,

I changed wildfly's standalone.xml configuration and add a module folder for mysql. My database has a schema called it2526.

But server cannot connect to database; first two line of the error message is this:


22:00:22,351 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 74) MSC000001: Failed to start service jboss.persistenceunit."ECommerce_v2_war_exploded.war#NewPersistenceUnit": org.jboss.msc.service.StartException in service jboss.persistenceunit."ECommerce_v2_war_exploded.war#NewPersistenceUnit": javax.persistence.PersistenceException: [PersistenceUnit: NewPersistenceUnit] Unable to build Hibernate SessionFactory

 

My project

standalone.xml

Configurations are between line 151 and 165. 

I also add mysql-connector-java-8.0.15.jar file to wildfly-16.0.0.Final⁩ ▸ ⁨modules⁩ ▸ ⁨system⁩ ▸ ⁨layers⁩ ▸ ⁨base⁩ ▸ ⁨com⁩ ▸ ⁨mysql⁩ ▸ ⁨main⁩ folder and its module.xml

These configurations are working on Eclips projects BTW but I would like to work on IntelliJ.

Thank you,

 

0
4 comments

IDE uses the standalone.xml file from the JBoss installation.

Do you have JBoss logs with full error/exception? Right now it is not clear what the root cause of the error might be.

Compare and make sure the artifact structure you deploy in Eclipse is the same in in IntelliJ IDEA.

Make sure to check with the version from https://www.jetbrains.com/idea/download

0

Thank you for your reply Andrey Dernov 

This is the Error Log

0

Jboss can not connect to database due to incorrect user/password:

Caused by: java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
	... 38 more

22:00:21,564 WARN  [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (ServerService Thread Pool -- 74) HHH000342: Could not obtain connection to query metadata : javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/IT526DS

Make sure you use the same configuration in Eclipse as you do in IntelliJ IDEA. Note that IDE only starts the Wildfly server with the configuration provided. The log shows that the standalone.xml from the /Library/WildFly/wildfly-16.0.0.Final/standalone/configuration/ directory is used. So if it fails it means that the configuratio is not correct. Double check you set it all right, consult the Wildfly documenation: http://docs.wildfly.org/16/Admin_Guide.html#DataSource

0

Thank you for your response Andrey.

I found the solution here https://stackoverflow.com/questions/22749570/wildfly-configuration-with-datasource

Thank you,

0

Please sign in to leave a comment.