2 Replies Latest reply on Aug 24, 2004 6:33 PM by annapurna

    CMP in jboss with informix

    annapurna Newbie

      Hi,

      I have worked quite a bit on BMP"s in jboss. CMP is new to me. I tried setting up all the necessary files. Jboss does throw any errors but does not return the correct results also. Can someone please review my files.

      When I try to call FindAllAccounts I am getting a empty collection. In jboss deployment I see
      InformixDS bound.Is there anything I am missing?

      This is from server.log in jboss

      15:07:34,524 INFO [MainDeployer] Starting deployment of package: file:/usr/local/jboss-3.0.8_tomcat-4.1.24/server/default/deploy/entitlements.jar
      15:07:34,741 INFO [EJBDeployer]
      Bean : agent
      Section: 10.6.2
      Warning: The entity bean class must be defined as public and abstract.

      15:07:34,790 INFO [EjbModule] Creating
      15:07:34,828 INFO [EjbModule] Deploying agent
      15:07:35,680 INFO [JDBCInitCommand] Table 'agent' already exists
      15:07:35,689 INFO [EjbModule] Created
      15:07:35,694 INFO [EjbModule] Starting
      15:07:35,716 INFO [EjbModule] Started
      15:07:35,721 INFO [MainDeployer] Deployed package: file:/usr/local/jboss-3.0.8_tomcat-4.1.24/server/default/deploy/entitlements.jar


      Does this mean informix is bound...

      Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/InformixDS'



      Any help is greatly appreciated.


      I have pasted a part of my code here...

      Deployment Descriptors...
      <jbosscmp-jdbc>

      java:/InformixDS
      <datasource-mapping>InformixDB</datasource-mapping>


      <enterprise-beans>

      <ejb-name>agent</ejb-name>
      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <table-name>agent</table-name>

      <cmp-field>
      <field-name>userId</field-name>
      <column-name>userid</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>password</field-name>
      <column-name>password</column-name>
      </cmp-field>
      ... and so on...
      </jbosscmp-jdbc>


      ejb-jar.xml
      <ejb-jar >

      <ejb-name>agent</ejb-name>
      com.pinksheets.entitlements.ejb.AgentHome
      com.pinksheets.entitlements.ejb.Agent
      <ejb-class>com.pinksheets.entitlements.ejb.AgentBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>agent</abstract-schema-name>
      <cmp-field > <field-name>userId</field-name></cmp-field>
      <cmp-field > <field-name>password</field-name></cmp-field>

      <query-method>
      <method-name>findAllAccounts</method-name>
      <method-params>
      </method-params>
      </query-method>
      <ejb-ql>[CDATA[SELECT * FROM agent]]</ejb-ql>

      ... and so on...


      What is this abstract-schema-name here? Should I also write findByPrimaryKey here in the query and what about insert/update statements?? Examples are not clear about this.

      jboss.xml


      <enterprise-beans>

      <ejb-name>agent</ejb-name>
      <jndi-name>xxx/Agent</jndi-name>
      <configuration-name>Standard CMP EntityBean</configuration-name>

      </enterprise-beans>


        • 1. Re: CMP in jboss with informix
          Anil Saldanha Master

          You are running a pretty old version of JBoss. The current version is 3.2.5 which uses CMP2.0

          Try upgrading to the current version. You are missing out on all the CMP bug fixes plus improvements in CMP2.0 by using JBoss 3.0.x

          • 2. Re: CMP in jboss with informix
            annapurna Newbie

            Thank you for the response. I downloaded the lastest jboss.

            I got the error

            EJB verification error

            warning: EJB must be specified public and abstract.

            So I changed my Bean class to abstract making all the set/get methods to abstract.

            It deployed correctly but now while testing when I call findAllAccounts() methods it gives a exception

            java.lang.InstantiationException
            at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
            at java.lang.Class.newInstance0(Class.java:306)
            at java.lang.Class.newInstance(Class.java:259)
            at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createBeanClassInstance(JAWSPersistenceManager.java:165)


            I think this is because of the abstract definition of the class. Can someone please shed some light on this. I am missing something important here.

            Thanks in advance,

            Anna.