0

I am trying to deploy an ear in jboss EAP 6.3 but I am getting following error:

JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.naming.context.java.jdbc.mn572phOraDataSource (missing) dependents: [service jboss.naming.context.java.module.pharma.pharma.env.jdbc.mn572phOraDataSource] 
      service jboss.naming.context.java.jdbc.mn572phaOraDataSource (missing) dependents: [service jboss.naming.context.java.module.pharma.pharma.env.jdbc.mn572phaOraDataSource] 

15:01:38,171 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss EAP 6.3.0.GA (AS 7.4.0.Final-redhat-19) started (with errors) in 66301ms - Started 462 of 659 services (160 services failed or missing dependencies, 64 services are lazy, passive or on-demand)

My standlone.xml file has this entry:

<datasource jndi-name="java:/module/env/jdbc/mn572phOraDataSource" pool-name="mn572phOraDataSource" enabled="true" use-java-context="true">
                    <connection-url>jdbc:oracle:thin:@test:1521:mndb11g</connection-url>
                    <driver>oracle.jdbc.driver.OracleDriver</driver>
                    <security>
                        <user-name>test</user-name>
                        <password>test</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="oracle.jdbc.driver.OracleDriver" module="oracle.jdbc.driver.OracleDriver">
                        <datasource-class>oracle.jdbc.driver.OracleDriver</datasource-class>
                    </driver>
                </drivers>
            </datasources>

My jboss-web.xml inside .war file has following entry:

<resource-ref>
   <res-ref-name>jdbc/mn572phaOraDataSource</res-ref-name>
   <jndi-name>java:/jdbc/mn572phaOraDataSource</jndi-name>
</resource-ref>

Can anyone please explain what the error says and what the problem can be.

Swaraj Shekhar
  • 187
  • 1
  • 7
  • 28

1 Answers1

0

In general 'New missing/unsatisfied dependencies:' is about the contents of your ear file in relation to the resources within it and provided on the server. What it is telling you is that there are requests for injection of objects for which you have not supplied either:

  • the required classes; or
  • not configured resources in your server.

This could be caused by six things that I can think of.

  1. You have missed a jar from the ear file.
  2. You have classes in an enclosed jar file that do not have access to the jars that contain their dependencies.
  3. You have beans.xml missing from one of the included jar files.
  4. Your classes depend on a module that should be installed in the server but which has not been installed.
  5. You have missed the declaration of the dependency in item 4 from your joss*.xml files
  6. Your application requires a resource (such as a DataSource) and you have not defined one in your server.

The second point is quite complex and deals with the scope of class loaders In Java EE applications. Basically:

  1. classes in war files can access normal jar files in lib.
  2. EJB jars can access jar files in lib.
  3. jar files in lib may have trouble accessing the other two.

Update: Sorry for the delay in replying but I wanted to check this before I replied as this area is quite complex.

In this case the problem is a mismatch between the name you have provided in in the jboss-web.xml and the name you provided in standalone.xml.

JavaEE6 has several different namespaces for resources.

The default namespace for the jboss-web.xml is the module namespace which works as java:module///XXXXX. In your case your module is your war file (pharma) and unless you actually defined it in an ear file called pharma JBOSS automatically wraps it in an ear file called pharma. So you get java:module/pharma/pharma/XXXXXX.

The default namespace for standalone.xml is java:global so your actual DataSource is probably installed at java:global/module/env/jdbc/mn572phaOraDataSource

I have tried to run up a little webapp app with your provided configuration files in it and to provide a resource for the mapping I added a @Singleton @Startup bean that defined link to Datasource @Resource.

I managed to get something similar to your error messages although not completely

I think that there are 2 problems:

  • one is that some of your jndi names read mn572phOraDataSource and some read mn572phaOraDataSource your can see this in the error message because the 2 variants are include.
  • second is that the JNDI name java:/jdbc/mn572phaOraDataSource in jboss-web does not match java:/module/env/jdbc/mn572phOraDataSource in standalone.xml. I got it to work by changing the name in the standalone.xml to java:/jdbc/mn572phaOraDataSource.
redge
  • 1,182
  • 7
  • 6
  • Any idea what the below line exactly means. service jboss.naming.context.java.jdbc.mn572phOraDataSource (missing) dependents: [service jboss.naming.context.java.module.pharma.pharma.env.jdbc.mn572phOraDataSource] – Swaraj Shekhar Apr 14 '15 at 11:02
  • I already have: jdbc/mn572phaOraDataSource java:/jdbc/mn572phaOraDataSource Do I need to have something else instead? – Swaraj Shekhar Apr 14 '15 at 11:11
  • It says (missing) dependents: [service jboss.naming.context.java.module.pharma.pharma.env.jdbc.mn572phOraDataSource] but in my standalone.xml I already have jndi-name="java:/module/env/jdbc/mn572phOraDataSource". Am I missing anything here or doing anything wrong? – Swaraj Shekhar Apr 15 '15 at 05:09
  • Added a lookup tag in ref-res and that solved the issue. – Swaraj Shekhar Apr 16 '15 at 05:37