3 Replies Latest reply on Apr 8, 2009 3:54 AM by jaikiran pai

    *** CONTEXTS MISSING DEPENDENCIES ** -- error -JPA(Hibernate

    Shivaji Byrapaneni Newbie


      Hi Floks,

      im quite new to Jboss and JPA
      am just tryying out for a sample JPA program using Hibernates implementation and am facing issue

      Here is my 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_1_0.xsd"
       version="1.0">
       <persistence-unit name="jpaTest" transaction-type="JTA">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>jdbc/__default</jta-data-source>
       <mapping-file>orm.xml</mapping-file>
       <class>jpa.entity.PlanType</class>
       <properties>
       <property name="hibernate.connection.driver_class" value=" oracle.jdbc.driver.OracleDriver" />
       <property name="hibernate.connection.username" value="scott" />
       <property name="hibernate.connection.password " value="tiger" />
       <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe" />
       <property name=" hibernate.connection.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
       <property name="hibernate.show_sql" value="true" />
       <property name="hibernate.hbm2ddl.auto" value="create-drop" />
       </properties>
      
       </persistence-unit>
      </persistence>
      
      


      but when i tried to deploy the jar file or the application containing this example im getting this error

      17:43:31,829 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=EJB3-J.jar,name=SLSBTest,service=EJB3) to KernelDeployment of: EJB3-J.jar
      17:43:32,047 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
      
      *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
      
      jboss.j2ee:jar=EJB3-J.jar,name=SLSBTest,service=EJB3
       -> <UNKNOWN jboss.j2ee:jar=EJB3-J.jar,name=SLSBTest,service=EJB3>{Described:** UNRESOLVED Demands 'persistence.unit:unitName=#jpaTest' **}
      
      persistence.unit:unitName=#jpaTest
       -> jboss.jca:name=jdbc/__default,service=DataSourceBinding{Create:** NOT FOUND Depends on 'jboss.jca:name=jdbc/__default,service=DataSourceBinding' **}
      
      
      *** CONTEXTS IN ERROR: Name -> Error
      
      jboss.jca:name=jdbc/__default,service=DataSourceBinding -> ** NOT FOUND Depends on 'jboss.jca:name=jdbc/__default,service=DataSourceBinding' **
      
      <UNKNOWN jboss.j2ee:jar=EJB3-J.jar,name=SLSBTest,service=EJB3> -> ** UNRESOLVED Demands 'persistence.unit:unitName=#jpaTest' **
      
      
      17:43:32,063 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
      


      please help me in resolving the issue

      if possible pls let me know how can i use the data source instead of the user name and pwd provided in this way..?


        • 1. Re: *** CONTEXTS MISSING DEPENDENCIES ** -- error -JPA(Hiber
          jaikiran pai Master

           

          <jta-data-source>jdbc/__default</jta-data-source>


          This looks wrong. Is there any datasource which deployed at that JNDI name?


          if possible pls let me know how can i use the data source instead of the user name and pwd provided in this way..?


          The EJB3 tutorials http://www.jboss.org/jbossejb3/docs/ has a chapter on Entities:

          http://www.jboss.org/file-access/default/members/jbossejb3/freezone/docs/tutorial/1.0.4/html/EJB3_Entities.html. You can download the source code of those tutorials too.


          • 2. Re: *** CONTEXTS MISSING DEPENDENCIES ** -- error -JPA(Hiber
            Shivaji Byrapaneni Newbie

            could any one pls tell me what the follwing line states in persistent.xml?

             <jta-data-source>java:/DefaultDS</jta-data-source>
            


            i had changed my persistenet.xml file as following
            <?xml version="1.0" encoding="UTF-8"?>
            <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_1_0.xsd"
             version="1.0">
             <persistence-unit name="tempdb">
             <jta-data-source>java:/DefaultDS</jta-data-source>
             <properties>
             <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
             </properties>
             </persistence-unit>
            </persistence>
            


            which helped in sorting out the issue stated above
            i can even see the object getting injected to entity manger

            but un luckyly i cant understand what the em.persist(Object) method is doing in my code. Its getting executed without any issues .

            i havent provided any data base details and any other information...
            As i havent provided any DB details nothing is getting inserted into any DB as expected.

            so i expect the potential reason for the methos getting executed without any issues will be with the 'DefaultDS' which i provided in my second most step..

            Could anybody please help me in understanding this...

            • 3. Re: *** CONTEXTS MISSING DEPENDENCIES ** -- error -JPA(Hiber
              jaikiran pai Master

              jta-data-source points to the JNDI name of a datasource. That datasource will have configurations related to the database (which include user name and password and database URL). In this example, you are using java:DefaultDS which is the default datasource shipped in JBoss. This datasource uses HSQLDB and is configured through hsqldb-ds.xml which is in %JBOSS_HOME%/server/< serverName>/deploy folder.