Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR New missing/unsatisfied dependencies: (Cannot configure datasource)

I have a web app using JSF(Primefaces), JPA(Hibernate) and EJBs and have trouble to configure the data source on JBoss . I am getting the following error:

2012/10/31 07:20:17,948 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)

2012/10/31 07:20:18,836 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "ROOT.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"ROOT.war#test\"jboss.naming.context.java.jboss.datasources.MysqlDSMissing[jboss.persistenceunit.\"ROOT.war#test\"jboss.naming.context.java.jboss.datasources.MysqlDS]"]}

2012/10/31 07:20:19,252 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment ROOT.war in 413ms

2012/10/31 07:20:19,255 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

JBAS014775:    New missing/unsatisfied dependencies:

      service jboss.naming.context.java.jboss.datasources.MysqlDS (missing) dependents: [service jboss.persistenceunit."ROOT.war#test"]

2012/10/31 07:20:19,334 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.persistenceunit.\"ROOT.war#test\"jboss.naming.context.java.jboss.datasources.MysqlDSMissing[jboss.persistenceunit.\"ROOT.war#test\"jboss.naming.context.java.jboss.datasources.MysqlDS]"]}}}

Below you can see my persistence.xml, stanadlone.xml and pom.xml. Am I missing some dependency in the pom.xml?

Persistence.xml

   <provider>org.hibernate.ejb.HibernatePersistence</provider> 

<jta-data-source>java:jboss/datasources/MysqlDS</jta-data-source> 

<properties>

  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>    

  <property name="hibernate.show_sql" value="true"/>

  <property name="hibernate.max_fetch_depth" value="3"/>

  <property name="hibernate.hbm2ddl.auto" value="update" />

</properties>

Standalone.xml

<datasources>
            <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
                <connection-url>jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1</connection-url>
                <driver>h2</driver>
            <security>
                    <user-name>sa</user-name>
                    <password>sa</password>
                </security>
            </datasource>
            <datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS">
                <connection-url>jdbc:mysql://127.5.54.1:3306/researchprojects</connection-url>
                <driver>mysql</driver>
                <security>
                  <user-name>admin</user-name>
                  <password>*******</password>
                </security>
                <validation>
                  <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                </validation>
            </datasource>
            <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true">
                <connection-url>jdbc:postgresql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
                <driver>postgresql</driver>
                <security>
                  <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name>
                  <password>${env.OPENSHIFT_DB_PASSWORD}</password>
                </security>
                <validation>
                  <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                </validation>
            </datasource>
            <drivers>
                <driver name="h2" module="com.h2database.h2">
                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                </driver>
                <driver name="mysql" module="com.mysql.jdbc">
                    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                </driver>
                <driver name="postgresql" module="org.postgresql.jdbc">
                    <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
                </driver>
            </drivers>
        </datasources> 

Pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>openshifttest</groupId>
  <artifactId>openshifttest</artifactId>
  <packaging>war</packaging>
  <version>1.0</version>
  <name>openshifttest</name>

 <repositories>
  <repository>
        <id>scala</id>
        <name>Scala Tools</name>
        <url>http://scala-tools.org/repo-releases/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
  <repository>  
    <id>prime-repo</id>  
    <name>PrimeFaces Maven Repository</name>  
    <url>http://repository.primefaces.org</url>  
    <layout>default</layout>  
    </repository>
</repositories>   

    <pluginRepositories>
        <pluginRepository>
            <id>scala</id>
            <name>Scala Tools</name>
            <url>http://scala-tools.org/repo-releases/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-6.0</artifactId>
      <version>1.0.0.Final</version>
      <type>pom</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>2.7.2</version>
    </dependency>
    <dependency>  
        <groupId>org.primefaces</groupId>  
        <artifactId>primefaces</artifactId>  
        <version>3.4.1</version>  
    </dependency>
  </dependencies>

  <profiles>
    <profile>
     <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
     <!-- Use this profile for any OpenShift specific customization your app will need. -->
     <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
     <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
     <id>openshift</id>
     <build>
        <finalName>openshifttest</finalName>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
              <outputDirectory>deployments</outputDirectory>
              <warName>ROOT</warName>
            </configuration>
          </plugin>
          <plugin>
                <groupId>org.scala-tools</groupId>
               <artifactId>maven-scala-plugin</artifactId>

                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                        <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>

                    <execution>
                        <id>test-compile</id>
                        <goals>
                        <goal>testCompile</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>

                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

Could someone tell me what am I doing wrong ?

like image 641
panipsilos Avatar asked Nov 23 '25 07:11

panipsilos


1 Answers

did you enable mysql datasource? as by default it is disabled.

part of configuration

<datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS">

has flag ${mysql.enabled} that is system property that enables the data source in case it is mysql is enabled.

take a look at the guide http://jaitechwriteups.blogspot.com/2011/08/deploy-java-ee-application-on-openshift.html

and search for "Using the MySQL database available in OpenShift Express" chapter

that shows you what part of configuration you are missing.

like image 120
Tomaz Cerar Avatar answered Nov 24 '25 23:11

Tomaz Cerar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!