I'm running an Java EE application on Wildfly 15.0.1. I'm trying to use JPA without creating datasource on wildfly, because I want all the dependencies to be packed in application source code. I am using Maven to build the WAR.
I am using PostgreSQL and it's up and running on http://localhost:5432 I create db called testing for this project.
So, I added this dependency to my pom.xml:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
</dependency>
My persistence.xml is in src/main/resources/META-INF/persistence.xml:
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="pu1">
<!-- classes -->
<class>myapp.model.Address</class>
<class>myapp.model.Transaction</class>
<properties>
<!-- database connection -->
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/testing" />
<property name="javax.persistence.jdbc.user" value="postgres" />
<property name="javax.persistence.jdbc.password" value="postgres" />
<!-- hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create"/>
</properties>
</persistence-unit>
I have #Entity annotation on both my Address and Transaction classes. But, nothing happens. Here's the log snippet:
22:58:05,759 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 103) HHH000204: Processing PersistenceUnitInfo [
name: pu1
...]
22:58:05,760 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) WFLYWELD0003: Processing weld deployment myapp.backend-1.0.war
22:58:05,791 WARN [org.jboss.as.jaxrs] (MSC service thread 1-3) WFLYRS0018: Explicit usage of Jackson annotation in a JAX-RS deployment; the system will disable JSON-B processing for the current deployment. Consider setting the 'resteasy.preferJacksonOverJsonB' property to 'false' to restore JSON-B.
22:58:05,796 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0005: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 42.2)
22:58:05,810 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: Started Driver service with driver-name = myapp.backend-1.0.war_org.postgresql.Driver_42_2
22:58:05,816 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 103) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'myapp.backend-1.0.war#pu1'
22:58:05,817 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 103) HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL94Dialect
22:58:05,820 INFO [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 103) HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType#6543510a
22:58:05,822 INFO [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 103) Envers integration enabled? : true
22:58:05,858 INFO [org.hibernate.tool.schema.internal.SchemaCreatorImpl] (ServerService Thread Pool -- 103) HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl#4cc01a34'
22:58:05,858 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool -- 103) HHH000397: Using ASTQueryTranslatorFactory
JPA specification:
8.2.1.2 transaction-type
The transaction-type attribute is used to specify whether the entity
managers provided by the entity manager factory for the persistence
unit must be JTA entity managers or resource-local entity managers.
The value of this element is JTA or RESOURCE_LOCAL. A transaction-type
of JTA assumes that a JTA data source will be provided—either as
specified by the jta-data-source element or provided by the container.
In general, in Java EE environments, a transaction-type of
RESOURCE_LOCAL assumes that a non-JTA datasource will be provided. In
a Java EE environment, if this element is not specified, the default
is JTA. In a Java SE environment, if this element is not specified,
the default is RESOURCE_LOCAL.
JTA is default transaction type in EE application server. To use it you need a datasource configured in WildFly. Then add it to persistence.xml:
<persistence-unit name="pu1" transaction-type="JTA">
<!-- classes -->
<class>myapp.model.Address</class>
<class>myapp.model.Transaction</class>
<properties>
<jta-data-source>jdbc/jndi_name_of_datasource</jta-data-source>
<!-- hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create"/>
</properties>
</persistence-unit>
Related
I'm trying to create a simple hello world java web application that is using JPA through hibernate and using JBoss 6.4.0 as application Server. The application has been created through maven. Furthermore I'm using Intellij as an IDE. However when I run the application Server I receive the following error:
16:09:04,772 INFO [org.hibernate.Version] (ServerService Thread Pool -- 25) HHH000412: Hibernate Core {5.3.7.Final}
16:09:04,774 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 25) HHH000206: hibernate.properties not found
16:09:04,970 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 25) HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
16:09:05,141 WARN [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001002: Using Hibernate built-in connection pool (not for production use!)
16:09:05,145 INFO [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/testdb]
16:09:05,146 INFO [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001001: Connection properties: {user=smattes, password=****}
16:09:05,147 INFO [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001003: Autocommit mode: false
16:09:05,150 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 25) MSC000001: Failed to start service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: org.jboss.msc.service.StartException in service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_191]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_191]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:276)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:260)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:401)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:112)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:75)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:100)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:179)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:119)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:904)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:935)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
... 4 more
16:09:05,164 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014612: Operation ("deploy") failed - address: ([("deployment" => "javahelloworld")]) - failure description: {"JBAS014671: Failed services" => {"jboss.persistenceunit.javahelloworld#NewPersistenceUnit" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V"}}
16:09:05,179 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "javahelloworld.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.persistenceunit.javahelloworld#NewPersistenceUnit" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V"}}
16:09:05,211 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment javahelloworld (runtime-name: javahelloworld.war) in 42ms
16:09:05,213 INFO [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report
The persistence.xml file is the following:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
<persistence-unit name="NewPersistenceUnit">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>jpa.AuthorsEntity</class>
<class>jpa.UserEntity</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/testdb"/>
<property name="hibernate.connection.driver_class" value="com.mysql.cj.jdbc.Driver"/>
<property name="hibernate.connection.username" value="myusername"/>
<property name="hibernate.connection.password" value="mypassword"/>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.DB2400Dialect"/>
</properties>
</persistence-unit>
</persistence>
and the jpa.AuthorsEntity and jpa.UserEntity are two java Entity classes that correspond to the tables authors and user correspondingly.
Any help would be appreciated.
Such errors are typically caused by having different versions of a library on the compile time and runtime classpath.
Application servers - such as JBoss - typically provide their own versions of the Hibernate libraries at runtime. This version is then most likely incompatible with the compile time version specified in your POM.
JBoss AS 6.4 only supports JPA spec 2. You can then either roll-back the compile time Hibernate version in your POM to be compatible with the runtime dependency supplied by JBoss or, if you really need JPA 2.1 features, tell JBoss you are bundling the Hibernate libraries with your app.
For the former approach, this document indicates EAP 6.4 supports Hibarnate 4.2.18.Final
https://access.redhat.com/articles/112673#EAP_6
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.18.Final</version>
<!-- Don't bundle in the WAR as provided by the server -->
<scope>provided</scope>
</dependency>
Check there are no hibernate libs in the deployed war (as a result of transitive dependencies for example).
For the latter approach see here:
https://issues.jboss.org/browse/WFCORE-209?_sscc=t
for future readers, recently i had this issues, i had in the project the hibernate version 5.1 with glassfish 4.1 and it is generated this issues, for resolved i agregated in the WEB-INF folder the file glassfish-web.xml
as i showing to continuation
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="false"/>
</glassfish-web-app>
I'm working on a project with EJB, Hibernate and JBoss, I got a problem on JBoss startup. JBoss found my datasource but stops here:
15:42:14,035 INFO [EntityBinder] Bind entity br.com.sankhya.teste.model.entities.ContatoCliente on table CONTATO_CLIENTE 15:42:14,201 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider 15:42:14,209 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
I put timeout to 1000 seconds and even with this JBoss doesn't start. This is the full log and my code:
15:42:13,277 INFO [A] Bound to JNDI name: queue/A
15:42:13,278 INFO [B] Bound to JNDI name: queue/B
15:42:13,279 INFO [C] Bound to JNDI name: queue/C
15:42:13,279 INFO [D] Bound to JNDI name: queue/D
15:42:13,280 INFO [ex] Bound to JNDI name: queue/ex
15:42:13,293 INFO [testTopic] Bound to JNDI name: topic/testTopic
15:42:13,294 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
15:42:13,295 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
15:42:13,297 INFO [testQueue] Bound to JNDI name: queue/testQueue
15:42:13,328 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
15:42:13,354 INFO [DLQ] Bound to JNDI name: queue/DLQ
15:42:13,432 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
15:42:13,467 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=TesteDS' to JNDI name 'java:TesteDS'
15:42:13,667 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.entity.PersistenceUnitDeployment
15:42:13,671 INFO [JmxKernelAbstraction] installing MBean: persistence.units:jar=ClientesModel.jar,unitName=clientes with dependencies:
15:42:13,671 INFO [JmxKernelAbstraction] jboss.jca:name=TesteDS,service=DataSourceBinding
15:42:13,672 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.units:jar=ClientesModel.jar,unitName=clientes
15:42:13,695 INFO [Version] Hibernate EntityManager 3.2.1.GA
15:42:13,712 INFO [Version] Hibernate Annotations 3.2.1.GA
15:42:13,720 INFO [Environment] Hibernate 3.2.4.sp1
15:42:13,725 INFO [Environment] hibernate.properties not found
15:42:13,726 INFO [Environment] Bytecode provider name : javassist
15:42:13,731 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
15:42:13,855 INFO [Ejb3Configuration] found EJB3 Entity bean: br.com.sankhya.teste.model.entities.Cliente
15:42:13,855 INFO [Ejb3Configuration] found EJB3 Entity bean: br.com.sankhya.teste.model.entities.ContatoCliente
15:42:13,855 INFO [Ejb3Configuration] found EJB3 #Embeddable: br.com.sankhya.teste.model.entities.ContatoClientePK
15:42:13,877 INFO [Configuration] Reading mappings from resource : META-INF/orm.xml
15:42:13,879 INFO [Ejb3Configuration] [PersistenceUnit: clientes] no META-INF/orm.xml found
15:42:13,934 INFO [AnnotationBinder] Binding entity from annotated class: br.com.sankhya.teste.model.entities.Cliente
15:42:13,988 INFO [EntityBinder] Bind entity br.com.sankhya.teste.model.entities.Cliente on table Cliente
15:42:14,035 INFO [AnnotationBinder] Binding entity from annotated class: br.com.sankhya.teste.model.entities.ContatoCliente
15:42:14,035 INFO [EntityBinder] Bind entity br.com.sankhya.teste.model.entities.ContatoCliente on table CONTATO_CLIENTE
15:42:14,201 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
15:42:14,209 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
persistence unit
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="clientes" transaction-type="JTA">
<jta-data-source>java:TesteDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
</persistence>
datasource
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>TesteDS</jndi-name>
<connection-url>jdbc:mysql://localhost:8080/prog_test_db</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>sissis</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>
<exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
<valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
</local-tx-datasource>
</datasources>
Could you help me ? thanks
I'm in phase of experimentation with infinispan server and I have a problem in set-up a infinispan cluster on my local machine.
Configuration files:
I change configuration file cluster.xml by changing part of jgroup stack with udp stack and jdbc_ping discovery.
<subsystem xmlns="urn:infinispan:server:jgroups:7.0" default-stack="${jboss.default.jgroups.stack:udp-jdbc}">
<stack name="udp-jdbc">
<transport type="UDP" socket-binding="jgroups-udp">
<property name="ip_mcast">false</property>
</transport>
<protocol type="JDBC_PING">
<property name="connection_url">jdbc:mysql://localhost/jgroups</property>
<property name="connection_username">root</property>
<property name="connection_password">root</property>
<property name="connection_driver">com.mysql.jdbc.Driver</property>
</protocol>
<protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
<protocol type="FD_ALL"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="UFC"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
<protocol type="RSVP"/>
</stack>
I put mysql driver in folder standalone/deployments, run the server and here is what I have as output
20:13:15,389 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "mysql-connector-java-5.1.34-bin.jar" (runtime-name: "mysql-connector-java-5.1.34-bin.jar")
20:13:15,461 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.jgroups.channel.clustered: org.jboss.msc.service.StartException in service jboss.jgroups.channel.clustered: java.lang.IllegalArgumentException: JDBC Driver required for JDBC_PING protocol could not be loaded: 'com.mysql.jdbc.Driver'
at org.jboss.as.clustering.jgroups.subsystem.ChannelService.start(ChannelService.java:74)
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:1142) [rt.jar:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
Caused by: java.lang.IllegalArgumentException: JDBC Driver required for JDBC_PING protocol could not be loaded: 'com.mysql.jdbc.Driver'
at org.jgroups.protocols.JDBC_PING.loadDriver(JDBC_PING.java:267)
at org.jgroups.protocols.JDBC_PING.init(JDBC_PING.java:93)
at org.jgroups.stack.ProtocolStack.initProtocolStack(ProtocolStack.java:860)
at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:481)
at org.jgroups.JChannel.init(JChannel.java:848)
at org.jgroups.JChannel.<init>(JChannel.java:159)
at org.jboss.as.clustering.jgroups.JChannelFactory.createChannel(JChannelFactory.java:87)
at org.jboss.as.clustering.jgroups.subsystem.ChannelService.start(ChannelService.java:69)
... 5 more
20:13:15,559 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
20:13:15,561 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
20:13:15,563 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010417: Started Driver service with driver-name = mysql-connector-java-5.1.34-bin.jar_com.mysql.jdbc.Driver_5_1
20:13:15,564 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) JBAS010417: Started Driver service with driver-name = mysql-connector-java-5.1.34-bin.jar_com.mysql.fabric.jdbc.FabricMySQLDriver_5_1
20:13:15,597 INFO [org.jboss.as.server] (ServerService Thread Pool -- 18) JBAS018559: Deployed "mysql-connector-java-5.1.34-bin.jar" (runtime-name : "mysql-connector-java-5.1.34-bin.jar")
20:13:15,599 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.jgroups.channel.clustered: org.jboss.msc.service.StartException in service jboss.jgroups.channel.clustered: java.lang.IllegalArgumentException: JDBC Driver required for JDBC_PING protocol could not be loaded: 'com.mysql.jdbc.Driver'
As you can see from the jboss log, the subsystem infinispan:server:jgroups failed to start because the JDBC driver isn't loaded (required by JDBC_PING), but after that step infinispan server successfully deployed mysql jdbc driver. This same error occupy in conditions where I work with datasource.
Is there any way to tell the infinispan:server:jgroups subsystem to be started before driver loading or before jndi naming creation ?
Or any workaround that will help
Thanks in advance
For direct JDBC use, you need to allow JGroups module to load your JDBC driver module. To do that, install JDBC driver jar as a module, then open modules/system/layers/base/org/jgroups/main/module.xml, add your JDBC driver module under the dependencies section.
For datasource lookup with EAGER caches, I think it's currently not possible to ensure that the datasource is available before JGroups tries to use it. The services boot order is controlled by programmatic dependencies but there is no way to declare the dependencies through config files so JGroups doesn't wait for the datasource.
I'v deployed a web application (jms-api.war) in JBoss, and I want to get a JMS connection factory via JNDI from it, Is it possible without any configuration (like this)? I tried to use JNDI without any configuration:
my connection factory in standalone.xml:
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
</jms-connection-factories>
And in my application i have this spring bean to access connection factory (It's working in my tests with embedded hornetq):
<bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="/ConnectionFactory" />
<property name="resourceRef" value="true"/>
</bean>
In jboss startup i get this error, how can i solve it?:
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.resources.jms.ConnectionFactory (missing) dependents: [service jboss.naming.context.java.module.jms-api.jms-api.env.jms.ConnectionFactory]
Jboss log (hornetq start part):
11:00:32,689 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221000: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/journal,bindingsDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/bindings,largeMessagesDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/large-message,pagingDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/paging)
11:00:32,691 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221006: Waiting to obtain live lock
11:00:32,723 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221013: Using NIO Journal
11:00:32,840 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221034: Waiting to obtain live lock
11:00:32,841 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221035: Live Server Obtained live lock
11:00:33,041 INFO [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on 127.0.0.1:9999
11:00:33,777 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221020: Started Netty Acceptor version 3.6.6.Final-redhat-1-fd3c6b7 0.0.0.0:5445 for CORE protocol
11:00:33,779 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221007: Server is now live
11:00:33,780 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221001: HornetQ Server version 2.3.12.Final (2.3.12, 123) [c0d4ec44-d8d5-11e3-afd6-5372513ac770]
11:00:33,786 INFO [org.hornetq.jms.server] (ServerService Thread Pool -- 50) HQ121005: Invalid "host" value "0.0.0.0" detected for "netty" connector. Switching to "Mojtaba-PC". If this new address is incorrect please manually configure the connector to use the proper one.
11:00:33,811 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 50) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
11:00:33,812 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 50) JBAS011601: Bound messaging object to jndi name java:/RemoteConnectionFactory
11:00:33,815 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 52) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
11:00:33,816 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 51) HQ221003: trying to deploy queue jms.queue.testQueue
11:00:34,115 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 51) JBAS011601: Bound messaging object to jndi name java:/queue/testQueue
11:00:34,116 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 51) JBAS011601: Bound messaging object to jndi name java:jboss/exported/queues/testQueue
11:00:34,195 INFO [org.jboss.as.server] (ServerService Thread Pool -- 27) JBAS018559: Deployed "jms-api.war" (runtime-name : "jms-api.war")
11:00:34,199 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.resources.jms.ConnectionFactory (missing) dependents: [service jboss.naming.context.java.module.jms-api.jms-api.env.jms.ConnectionFactory]
(jboss eap 6.2.0, hornetq 2.3.12.Final)
Though I have not yet worked with v6.2 but you can try this. The error was unable to find your connection factory via JNDI tree. So, add below in your already listed entry:
<entries>
<entry name="java:/ConnectionFactory"/>
<!-- Add this -->
<entry name="java:jboss/exported/ConnectionFactory"/>
</entries>
And change connector ref from in-vm to netty
The easiest solution is to change your bean configuration:
<bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:/ConnectionFactory" />
<property name="resourceRef" value="false"/>
</bean>
If resourceRef is true, then Spring will attempt to look up "java:comp/env/ConnectionFactory", (or perhaps even "java:comp/env//ConnectionFactory"), because that is what correct resource references look like to all JavaEE containers (not just JBoss).
If you want to use resource references, you must declare them in your web.xml file and map them in a jboss-web.xml file.
You would typically do this when you're trying to write code that must be portable between different JavaEE server implementations. They all have their own variation of jboss-web.xml to map between the constant resource reference name and the physical resource name in the server.
I defined this connection-factory on my messaging subsystem:
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/ConnectionFactory"/>
</entries>
</connection-factory>
and in my webapp spring bean configuration (the jndiName should be started with java:/):
<bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:/jboss/exported/jms/ConnectionFactory" />
<property name="lookupOnStartup" value="false"/>
<property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
</bean>
And no changes or configs in web.xml (e.g. no need for resource-ref in web.xml)!
Getting following exception while deploying the ear file whose structure as follow :
Ear comprise of ejb module(EJB + JPA) and war module
//stack trace
11:47:09,207 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2)
JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version
9.0)
11:47:09,290 INFO [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering
web context: /saleshout
11:47:09,964 INFO [org.jboss.as.server] (HttpManagementService-threads - 6)
JBAS015870: Deploy of deployment "SaleShoutEar-0.0.1-SNAPSHOT.ear" was rolled back
with failure message {"JBAS014771: Services with missing/unavailable dependencies"
=> ["jboss.persistenceunit.\"SaleShoutEar-0.0.1-SNAPSHOT.ear/nsqejb-0.0.1-
SNAPSHOT.jar#persistence\"jboss.naming.context.java.jboss.
SMSCampaignDataSourceMissing[jboss.persistenceunit.\"SaleShoutEar-0.0.1-
SNAPSHOT.ear/nsqejb-0.0.1-
SNAPSHOT.jar#persistence\"jboss.naming.context.java.jboss.SMSCampaignDataSource]"]}
11:47:10,010 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1)
JBAS015877: Stopped deployment nsqejb-0.0.1-SNAPSHOT.jar in 45ms
11:47:10,039 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3)
JBAS015877: Stopped deployment saleshout-0.0.1-SNAPSHOT.war in 74ms
11:47:10,091 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3)
JBAS015877: Stopped deployment SaleShoutEar-0.0.1-SNAPSHOT.ear in 126ms
11:47:10,102 INFO [org.jboss.as.controller] (HttpManagementService-threads - 6)
JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.SMSCampaignDataSource (missing) dependents:
[service jboss.persistenceunit."SaleShoutEar-0.0.1-SNAPSHOT.ear/nsqejb-0.0.1-
SNAPSHOT.jar#persistence"]
To integrate ejb with JPA i follow this link http://theopentutorials.com/examples/java-ee/ejb3/how-to-create-ejb3-jpa-project-in-eclipse-jboss-as-7-1/
I have configured the datasource but still getting persistence.xml related exception.
I am new to JBoss.can anyone tell me why i am getting this exception.
//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="persistence" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/SMSCampaignDataSource</jta-data-source>
<class>...</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"></property>
<property name="show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>
Thanks.
You have to define the datasource in the standalone.xml and if you have already defined then please see whether your added datasource is saved or not.The stack trace clearly indicate that the problem is with datasource as persistence.xml is fine.I have face the same situation but in my case the changes that i have made in the standalone.xml was not getting saved as the JBoss directory was having the root privilege.So i edited and added the datasource in the standalone.xml with root privilege and the problem resolved of missing dependencies.
If your's is the different case then this link might help you : Services with missing/unavailable dependencies