producing EntityManager throws __FIRST_PHASE__ is missing - java

Here's my error
ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}
ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "test.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}
and the caused by portion of the stack trace
Caused by: java.lang.Exception: "JBAS014807: Management resource '[(\"deployment\" => \"test.war\")]' not found"
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getActionResult(ServerDeploymentPlanResultFuture.java:134) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getResultFromNode(ServerDeploymentPlanResultFuture.java:123) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:85) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]
and relevant log output
2014-03-25 00:06:26,543 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}
2014-03-25 00:06:26,544 ERROR [org.jboss.as.server] (management-handler-thread - 3) JBAS015870: Deploy of deployment "test.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}
2014-03-25 00:06:26,551 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment test.war (runtime-name: test.war) in 7ms
2014-03-25 00:06:26,552 INFO [org.jboss.as.controller] (management-handler-thread - 3) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS (missing) dependents: [service jboss.persistenceunit."test.war#primary".__FIRST_PHASE__]
service jboss.persistenceunit."test.war#primary".__FIRST_PHASE__ (missing) dependents: [service jboss.deployment.unit."test.war".POST_MODULE]
2014-03-25 00:06:26,558 DEBUG [org.jboss.as.controller.management-operation] (management-handler-thread - 4) JBAS014616: Operation ("undeploy") failed - address: ([("deployment" => "test.war")]) - failure description: "JBAS014807: Management resource '[(\"deployment\" => \"test.war\")]' not found"
2014-03-25 00:06:26,586 DEBUG [org.jboss.as.controller.management-operation] (management-handler-thread - 2) Entered VERIFY stage; waiting for service container to settle
2014-03-25 00:06:26,595 INFO [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report
JBAS014776: Newly corrected services:
service jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS (no longer required)
service jboss.persistenceunit."test.war#primary".__FIRST_PHASE__ (no longer required)
Here's the contents of my Jar
ar = 64668e4f-f815-495a-a612-bc1c9c87b4cc.jar:
/com/
/com/lm/
/com/lm/infrastructure/
/com/lm/infrastructure/Regex.class
/com/lm/infrastructure/SystemServices.class
/com/lm/infrastructure/RegexTest.class
/com/lm/infrastructure/JacksonProducer.class
/com/lm/model/
/com/lm/model/Identifiable.class
/com/lm/model/Page.class
/com/lm/model/Entity.class
/com/lm/model/Buildable.class
/com/lm/model/Wirer.class
/com/lm/model/BaseIdentifierDTO.class
/com/lm/model/Factory.class
/com/lm/model/EntityBuilder.class
/com/lm/model/Director.class
/com/lm/model/Builder.class
/com/lm/model/Identifier.class
/com/lm/model/Repository.class
/com/lm/test/
/com/lm/test/TestBase.class
/com/lm/test/UnitTest.class
/com/lm/test/RESTCtrlTestBase.class
/com/lm/test/TestUtil.class
/com/lm/activity/
/com/lm/activity/persistence/
/com/lm/activity/persistence/inmemory/
/com/lm/activity/persistence/inmemory/ActivityInventoryMemUnitTest.class
/com/lm/activity/persistence/inmemory/ActivitiesMemUnitTest.class
/com/lm/activity/persistence/inmemory/ActivityInventoryMem.class
/com/lm/activity/persistence/inmemory/ActivitiesMem.class
/com/lm/activity/UnitTestBaseForActivity.class
/com/lm/activity/SimplyDescriptive.class
/com/lm/activity/Activity$Builder.class
/com/lm/activity/ActivityId.class
/com/lm/activity/ActivitiesRepo.class
/com/lm/activity/FactoryBuilderActivity.class
/com/lm/activity/ActivityInventory.class
/com/lm/activity/Activity$DTO.class
/com/lm/activity/Activity.class
/com/lm/activity/ActivityCompleted.class
/com/lm/activity/Activity_.class
/com/lm/activity/ActivityId$DTO.class
/com/lm/activity/ToDoUnitTest.class
/com/lm/activity/ActivityUnitTest.class
/com/lm/activity/TestBaseForActivity.class
/com/lm/activity/ActivityEvent.class
/com/lm/activity/BuilderActivityPermaURI.class
/com/lm/activity/Descriptive.class
/com/lm/activity/ToDo.class
/com/lm/activity/DomainEvent.class
/com/lm/activity/Individual.class
/META-INF/
/META-INF/logback.xml
/META-INF/test-ds.xml
/META-INF/beans.xml
/META-INF/persistence.xml
here's my 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="primary">
<jta-data-source>java:jboss/datasources/KitchensinkQuickstartTestDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
test-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is an unmanaged datasource. It should be used for proofs of concept
or testing only. It uses H2, an in memory database that ships with JBoss
AS. -->
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<!-- The datasource is bound into JNDI at this location. We reference
this in META-INF/test-persistence.xml -->
<datasource jndi-name="java:jboss/datasources/KitchensinkQuickstartTestDS"
pool-name="kitchensink-quickstart-test" enabled="true"
use-java-context="true">
<connection-url>jdbc:h2:mem:kitchensink-quickstart-test</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
</datasources>
SystemServices class
public class SystemServices {
#SuppressWarnings( "unused" )
#Produces
#PersistenceContext
private EntityManager em;
#Produces
public Logger prLogger( InjectionPoint ip ) {
return LoggerFactory.getLogger(
ip.getMember().getDeclaringClass().getName()
);
}
}
I don't have any entities yet that have any annotations, so I'd think that it should be able to produce the EntityManager without it causing problems.

The error says that jboss is missing your datasource. Which JBoss/Wildfly version are you using?
Please check first whether JBoss can work with your datasource using f.i. the web console (localhost:9090/console -> Profile -> Datasources).
You can also configure your datasource in standalone.xml but whether this is an appropriate approach or not depends on your setup but I would prefer the standalone.xml approach.
I thought the *-ds.xml datasource configuration file has to be deployed separately, not with the jar. Please have a look here for datasource configurations. I think this could cause your problem since JBoss parses the persistence.xml before deploying the datasource definition and failing at the Persistence manager initialization.

Related

wildfly / jboss-eap: How to name JMS resources to match EJB2 ejb-jar.xml

I currently migrate an EJB2 application to jboss-eap. The first phase tries to modify less source as possible.
The give ejb-jar.xml contains
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
[...]
<session >
[...]
<resource-ref >
<res-ref-name>jms/customQueueFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-env-ref >
<resource-env-ref-name>jms/customQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
</session>
I added following configuration to standalone-full.xml urn:jboss:domain:messaging-activemq:13.0:
<connection-factory name="customQueueFactory" entries="java:/jms/customQueueFactory" connectors="in-vm"/>
<jms-queue name="customQueue" entries="java:/jms/customQueue"/>
But when I start jboss the jms resources cannot get resolved:
02:26:30,651 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "app.ear")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.naming.context.java.jboss.resources.jms.customQueueFactory",
"jboss.naming.context.java.jboss.resources.jms.customQueue"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.naming.context.java.comp.app.app-mdb.Sender.env.jms.customQueueFactory is missing [jboss.naming.context.java.jboss.resources.jms.customQueueFactory]",
"jboss.naming.context.java.comp.app.app-mdb.Sender.env.jms.customQueue is missing [jboss.naming.context.java.jboss.resources.jms.customQueue]"
]
}
Default lookup prefix for jboss-eap 7.4 is java:jboss/resources. So in order to get this to work the exported names need to be adjusted accordingly:
<connection-factory name="customQueueFactory" entries="java:jboss/resources/jms/customQueueFactory" connectors="in-vm"/>
<jms-queue name="customQueue" entries="java:jboss/resources/jms/customQueue"/>

jboss error: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V

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>

Adding a module in WildFly 8.2.0 Final release

I am new in JBoss and I try to add a jdbc driver for derby as a module in WidlFly 8.2.0.
What I did:
I added the org/apache/derby/main folder in the JBOSS_HOME/modules/system/layers/base directory
In this new folder, I added derbyclient.jar (from jdk 1.8.0_40, it contains the driver) and a new module.xml file.
The module.xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.apache.derby">
<resources>
<resource-root path="derbyclient.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Then, I updated the standalone.xml file as follows:
addition of this tag (in <extensions>): <extension module="org.apache.derby"/>
Declaration of my datasource and of the driver:
<datasource jndi-name="java:/DerbyDS" pool-name="DerbyDS" enabled="true" use-ccm="false">
<connection-url>jdbc:derby:MyDB;create=true</connection-url>
<driver>org.apache.derby</driver>
<security>
<user-name>demo</user-name>
<password>demo</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="org.apache.derby" module="org.apache.derby">
<xa-datasource-class>org.apache.derby.jdbc.ClientXADataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
I am getting the following error when I start WildFly:
`16:19:49,856 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "DerbyDS")
]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.data-source.java:/DerbyDS is missing [jboss.jdbc-driver.org_apache_derby]",
"jboss.driver-demander.java:/DerbyDS is missing [jboss.jdbc-driver.org_apache_derby]"
]}
16:19:49,866 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "DerbyDS")
]) - failure description: {
"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.data-source.java:/DerbyDS is missing [jboss.jdbc-driver.org_apache_derby]",
"jboss.driver-demander.java:/DerbyDS is missing [jboss.jdbc-driver.org_apache_derby]"
],
"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
"Services that were unable to start:" => [
"jboss.data-source.reference-factory.DerbyDS",
"jboss.naming.context.java.DerbyDS"
],
"Services that may be the cause:" => ["jboss.jdbc-driver.org_apache_derby"]
}
}
16:19:49,897 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "MyApp.ear" (runtime-name : "MyApp.ear")
16:19:49,897 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "MyApp2.ear" (runtime-name : "MyApp2.ear")
16:19:49,907 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.org_apache_derby (missing) dependents: [service jboss.driver-demander.java:/DerbyDS, service jboss.data-source.java:/DerbyDS]`
Do you know what I did wrong?
Thanks in advance
I finally solved the issue by:
adding derbyclient.jar in the standalone directory (where my applications are deployed)
modifying the datasource declaration in the standalone.xml to make it reference the jar name :
<datasource jndi-name="java:/DerbyDS" pool-name="DerbyDS"enabled="true" use-ccm="false"> <connection-url>jdbc:derby:MyDB;create=true</connection-url> <driver>derbyclient.jar</driver>...
(I deleted the <drivers> tag, I don't use it anymore.)
So, I don't have errors anymore when I start WildFly. The derby driver is not declared as a module, but it will be shared among my different applications, so that's ok.
Your URL jdbc:derby://:MyDB looks invalid.

How to configure Wildfly 8 to use Infinispan for caching entities

I am trying to create a local infinispan cache and I know it requires to make change in config.xml of wildfly. I tried doing that and when I try to access that cache it shows cache not available. I don't know what I am doing wrong, can anybody help me on this.
Changes in config.xml are
<subsystem xmlns="urn:jboss:domain:infinispan:2.0">
<cache-container name="web" aliases="standard-session-cache" default-cache="local-web" module="org.wildfly.clustering.web.infinispan">
</cache-container>
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
</cache-container>
//This is my local cache
<cache-container name="myCache" default-cache="cachedb">
<local-cache name="cachedb"/>
</cache-container>
</subsystem>
Here is the code to access the cache
#Stateless
public class SimpleCache {
#Resource(lookup="java:jboss/infinispan/container/myCache")
private CacheContainer container;
private org.infinispan.Cache<String, String> cache;
#PostConstruct
public void initCache() {
this.cache = container.getCache();
}
public String get(String key) {
return this.cache.get(key);
}
public void put(String key, String value) {
this.cache.put(key, value);
}
}
Error:
java:global/InfinispanTest/SimpleCache!SimpleCache
java:app/InfinispanTest/SimpleCache!SimpleCache
java:module/SimpleCache!SimpleCache
java:global/InfinispanTest/SimpleCache
java:app/InfinispanTest/SimpleCache
java:module/SimpleCache
17:05:09,721 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "InfinispanTest.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCacheMissing[jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCache]"]}
17:05:09,769 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment InfinispanTest.war in 45ms
17:05:09,770 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.infinispan.container.myCache (missing) dependents: [service jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.container]
17:05:09,772 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCacheMissing[jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCache]"]}}}
Have you put infinispan dependencies in your project?
Put in your META_INF/MANIFEST.MF:
dependencies: org.infinispan export

Showing missing dependencies while deploying an application in JBoss AS 7

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

Categories