enviornment : application server - jboss 5.x, JPA : eclipse link
database : oracle11g
i configured a datastore with jndi as /TESTDS and want to access this jndi in persistence.xml but getting error.
i used syntax as
<jta-data-source>java:/TESTDS</jta-data-source>
in persitence.xml....is this correct?
My oracle-ds.xml as
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<xa-datasource>
<jndi-name>/TESTDS</jndi-name>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:oracle:thin:#a.b.c.d:1521/sid</xa-datasource-property>
<xa-datasource-property name="User">DBUSER</xa-datasource-property>
<xa-datasource-property name="Password">DBPASSWORD</xa-datasource-property>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle11g</type-mapping>
</metadata>
</xa-datasource>
and my persistence.xml
<?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="TestPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/TESTDS</jta-data-source>
<properties>
<property name="eclipselink.target-server" value="JBoss"/>
<property name="eclipselink.allow-zero-id" value="true"/>
</properties>
</persistence-unit>
</persistence>
But getting error while deploying jar at jboss 5.x server.. Your help is much appreciated..
Error Message while deployment
00:51:03,830 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext#1112048510{vfszip:/home/jboss/jboss-5.1.0.GA/server/default/deploy/test.jar/}
00:51:03,842 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext#1112048510{vfszip:/home/jboss/jboss-5.1.0.GA/server/default/deploy/test.jar/}
00:51:03,860 INFO [JBossASKernel] Created KernelDeployment for: test.jar
00:51:03,861 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3
00:51:03,861 INFO [JBossASKernel] with dependencies:
00:51:03,861 INFO [JBossASKernel] and demands:
00:51:03,861 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
00:51:03,862 INFO [JBossASKernel] persistence.unit:unitName=#TestPU
00:51:03,862 INFO [JBossASKernel] and supplies:
00:51:03,862 INFO [JBossASKernel] jndi:TestStatelessSessionBean/local-test.ejb3.session.TestStatelessSessionLocal
00:51:03,862 INFO [JBossASKernel] Class:test.ejb3.session.TestStatelessSessionLocal
00:51:03,863 INFO [JBossASKernel] jndi:TestStatelessSessionBean/local
00:51:03,863 INFO [JBossASKernel] jndi:TestStatelessSessionBean/remote
00:51:03,863 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3) to KernelDeployment of: test.jar
00:51:03,864 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData#3436ae59{name=jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
00:51:03,942 WARN [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#TestPU' **")
Deployment "jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
Deployment "persistence.unit:unitName=#TestPU" is missing the following dependencies:
Dependency "jboss.jca:name=TESTDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=TESTDS,service=DataSourceBinding' **")
DEPLOYMENTS IN ERROR:
Deployment "jboss.jca:name=TESTDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=TESTDS,service=DataSourceBinding' **
Deployment "<UNKNOWN jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#TestPU' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:369)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
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
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
I'm trying to migrate from WS 6.1 to JBoss EAP 6.1. I'm having a hard time trying to make the EJB 2.1 working in JBoss 6.1.
(Note : #GatewayEjbJndiName# is replaced at compile time by ant.)
This was the original ejb-jar.xml :
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>ServerGateway</display-name>
<enterprise-beans>
<session id="Session_gateway">
<display-name>GatewayEJBSB</display-name>
<ejb-name>#GatewayEjbJndiName#</ejb-name>
<home>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome</home>
<remote>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote</remote>
<ejb-class>ca.company.qc.project.server.gateway.ejb.GatewayEJBBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>#GatewayEjbJndiName#</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
This is (after many hours of research) what i came up for JBoss EAP 6.1 (ejb-jar.xml) :
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>ServerGateway</display-name>
<enterprise-beans>
<session id="Session_gateway">
<display-name>GatewayEJBSB</display-name>
<ejb-name>#GatewayEjbJndiName#</ejb-name>
<home>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome</home>
<remote>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote</remote>
<ejb-class>ca.company.qc.project.server.gateway.ejb.GatewayEJBBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/projectGatewayEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome</home>
<remote>ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote</remote>
</ejb-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>#GatewayEjbJndiName#</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
But every time is tried to start the JBoss server i have this error :
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named ProjectGatewayEJB in deployment unit subdeployment "GatewayEJBClientProject.jar" of deployment "Project.ear" are as follows:
java:global/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
java:app/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
java:module/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
java:jboss/exported/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemote
java:global/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome
java:app/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome
java:module/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome
java:jboss/exported/Project/GatewayEJBClientProject/ProjectGatewayEJB!ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome
10:54:41,858 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.subunit."Project.ear"."ProjectWebApp.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Project.ear"."ProjectWebApp.war".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "ProjectWebApp.war" of deployment "Project.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014543: No EJB found with interface of type 'ca.company.qc.project.server.gateway.ejb.GatewayEJBRemoteHome' and name 'ServerGateway.jar#GatewayEJB' for binding java:module/env/ProjectGatewayEJBBean
at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:97)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:229)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:120)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
... 5 more
There is NO annotation anywhere in the EJBBean/EJBRemote/EJBRemoteBusiness/EJBRemoteHome classes. Because it's not supported in EJB 2.1 (for what i know).
I run the server using the "standalone-full.xml" config file. I also tried standalone-ha.xml with no success.
I really don't know what to do next..
There is topic on the JBoss community forum, I hope it'll help you to resolve problems.
Check the automated pluggable rule-based migration tool JBoss Windup. It covers EJB 2.1 to EJB 3 migration to some extent.
If you find something that is not covered, the Windup team will be happy to accept requests for enhancements at http://issues.jboss.org/WINDUPRULE.
To your question:
EJB 3 is available with standalone.xml, no need for standalone-ha which stands for High Availability, i.e. clustered solutions. full means full profile, as opposed to web profile, which is specified in Java EE 6 specification. See Java EE 6 Web profile vs Java EE 6 Full Platform .
I suggest to migrate to EJB 3 since Java EE 7 is here for some time and support for EJB 2.x will be dropped by most app servers.
I use Jboss 7 , hibernate 4.1.5 FINAL and Spring 3.1.2 for my application
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: Virtuoso] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
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.spi.ServiceException: Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:150)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2277)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2273)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1742)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
... 9 more
Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider]
at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:192)
at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:114)
at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:54)
at org.hibernate.service.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:69)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176)
... 22 more
Caused by: java.lang.ClassCastException: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider
at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:189)
... 26 more
jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.hibernate"></module>
</exclusions>
</deployment>
</jboss-deployment-structure>
persistence.xml
<?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="Virtuoso" transaction-type="RESOURCE_LOCAL" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>java:jboss/datasources/MySqlDS</non-jta-data-source>
</persistence-unit>
</persistence>
i am not knowing where i am going wrong..My Persistent unit not getting started.
Since you're attempting to use Hibernate 4.x packaged in your application, you should instead be setting the jboss.as.jpa.providerModule property to application in your persistence.xml configuration file.
You're better off replacing the Hibernate 4.0 module in AS7, with a newer version though. That way, you dont need to package a JPA provider in your application.
ejb3 - persistence jar was present in my lib folder which was conflicting with mu hibernate jpa 2.0 jar . so i added scope provided in my pom.xml . after that class cast exception went away.