3 Replies Latest reply on Dec 19, 2002 10:58 PM by adrian.brock

    jboss missing Database

    mille

      Hello. Related architecture that concerns my problem is:

      EJB 1.1 spec
      BAS 4.5.1 and JBOSS 3.0/2.4
      Oracle 8.1.6 database
      For data retrieval I'm using pure JDBC
      For data inserting I'm using EJBs (over session beans).

      My problem is following:
      I have developed jar file which contains a number of entity and session beans (EJB 1.1 spec). It was developed originally for BAS4.5.1 application server. There is client application that uses that bundle, and everything WORKS fine. Now, I want to redeploy my archive to JBoss 3.0, and to try to access to beans from my client application. I had some troubles so I switched to JBoss2.4. I succeed to run application without any change in my client code and everything seem very good (don't forget that I used JDBC for reading). Then I tried to insert some new data to DB (now EJBs are involved). And there was no errors, everything seemed fine, but when I exit the application and check at DB, new data wasn't inserted!? And when I restarted client, and tried to write same data again, application was behaved like new data is already there!? It seems like I'm not reaching my DB from EJBs? But data is stored somewhere? I tried to search forum for something like that, and found few questions with that problem, but no useful answers. Please, if you can help me... I suppose that it is matter of configuration of JBOSS or deployment descriptor...

      also, link to tutorial 'Deploying on JBoss3.0 using Ant' on http://www.roseindia.net/jboss/buildingwebapplicationwithant.shtml is dead? Does anybody has that tutorial downloaded or know some mirror?

        • 1. Re: jboss missing Database

          What jndi-names are you using.
          i.e. oracle-service.xml, your code, jboss.xml

          By default it uses java:/DefaultDS which is
          hypersonic unless you changed it.

          Use the jmx console (version dependent)
          http://localhost:8082/ or http://localhost:8080/jmx-console
          click on the hypersonic service and then
          startdatabasemanager, you will probably see your
          data?

          Regards,
          Adrian

          • 2. Re: jboss missing Database
            mille

            Hello Adrian! Sorry, but by your hint I just realized that things are not simple as I thought... I was thinking that it is possible to specify all what is needed in deployment descriptors (ejb-jar.xml and ejb-inprise.xml). I DIDN'T KNOW AT ALL about existence of that administrator web view of JBoss, and probably I have to study it first. Is there any free tutorial about using it, and configuring JBOSS? If there is some shorter way to make JBOSS use some other DB than hypersonic (for example Oracle 8.1.6) could you explain it? I didn't understand you question about JNDI names. I just reference ejb-s by simply name, like:
            ...
            Context ctx = new InitialContext();
            Object ref = ctx.lookup("Bean1");
            Bean1Home = (Bean1Home) PortableRemoteObject.narrow(ref, Bean1Home.class);
            ...

            and it works for B.A.S. 4.5.1 as I said before.

            Related part of ejb-jar.xml is:

            ...

            <ejb-name>Bean1</ejb-name>
            ejbmodul.Bean1Home
            ejbmodul.Bean1
            <ejb-class>ejbmodul.Bean1Bean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            False
            <cmp-field>
            <field-name>id</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>name</field-name>
            </cmp-field>
            ...
            <primkey-field>id</primkey-field>
            <resource-ref>
            <res-ref-name>jdbc/DataSource</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>



            Related part of ejb-inprise.xml is:
            ...
            <inprise-specific>
            <enterprise-beans>
            ...

            <ejb-name>Bean1</ejb-name>
            <bean-home-name>Bean1</bean-home-name>
            <resource-ref>
            <res-ref-name>jdbc/DataSource</res-ref-name>
            <jndi-name>DataSource</jndi-name>
            </resource-ref>
            <cmp-info>
            <database-map>
            BEAN1
            </database-map>

            <method-signature>findAll()</method-signature>
            <where-clause />
            <load-state>True</load-state>

            </cmp-info>

            ...
            </enterprise-beans>
            <datasource-definitions>

            <jndi-name>DataSource</jndi-name>
            jdbc:oracle:thin:@_url:_port:_SIDname
            _user
            _password
            <isolation-level>TRANSACTION_SERIALIZABLE</isolation-level>
            <driver-class-name>oracle.jdbc.driver.OracleDriver</driver-class-name>

            </datasource-definitions>
            </inprise-specific>

            Is that inprise-specific tag means that ejb-inprise.xml is specific for Borland Application server? What should be JBoss substitution for that?

            regards,
            Vlada

            • 3. Re: jboss missing Database

              Do you have the quickstart guide?
              Click on documentation on the left.

              In jboss it is done in two steps.
              1) Configure the oracle service
              add the driver to server/default/lib and
              put oracle-service.xml in server/default/deploy
              change oracle-service.xml to give your url, user/password

              2) Configure the resource-refs and resource-managers
              in jboss.xml

              An alternative would be to remove hypersonic and
              bind oracle as DefaultDS

              Regards,
              Adrian