3 Replies Latest reply on Dec 9, 2004 6:23 AM by Veeranjaneyulu Bonthu

    Problem while accessing the CMP(oracle)

    Veeranjaneyulu Bonthu Newbie

      I was deployed one CMP in JBOSS 3.2.5 it got deployed while accesing that BEAN it is throwing exception saying as 'null value was got for one attribute but it should not be'.

      actually i was developed a CMP for employee table which was there in ORACLE database

      my home interface is like as below






      package com.ness.training.ejb;

      import javax.ejb.EJBHome;
      import java.rmi.RemoteException;
      import javax.ejb.CreateException;
      import javax.ejb.FinderException;

      public interface EmployeeEntityHome extends EJBHome
      {

      public EmployeeEntity create(java.lang.Integer empID,String eName,String designation) throws CreateException,RemoteException;

      public EmployeeEntity findByPrimaryKey(Integer key) throws RemoteException,FinderException;

      public java.util.Collection findAll()throws RemoteException,FinderException;
      }




      my remote interface was like as below




      package com.ness.training.ejb;

      import javax.ejb.EJBObject;
      import java.rmi.RemoteException;

      public interface EmployeeEntity extends EJBObject
      {
      public Integer getEmpID() throws RemoteException;
      public String getEName() throws RemoteException;
      public String getDesignation() throws RemoteException;

      public void setEmpID(Integer ent) throws RemoteException;
      public void setEName(String eName) throws RemoteException;
      public void setDesignation(String designation) throws RemoteException;


      }






      My Bean class as like as below







      package com.ness.training.ejb;

      import javax.ejb.CreateException;
      import javax.ejb.EntityBean;
      import javax.ejb.EntityContext;
      public abstract class EmployeeEntityBean implements EntityBean
      {
      private transient EntityContext entContext;

      public Integer empID;
      public String eName;
      public String designation;

      public void setEntityContext(EntityContext context){
      System.out.println("now it was in setEntityContext method");
      entContext = context;
      }

      public void unsetEntityContext(){
      entContext = null;
      }
      public Integer ejbCreate(Integer empid , String ename , String design) throws CreateException{
      this.empID =empid;
      this.eName = "bvn";
      this.designation = "se";
      System.out.println("inside bean method"+empid);
      return this.empID;
      }

      public void ejbPostCreate(Integer empid,String ename , String design){
      System.out.println("in side ejb post create method "+empid);

      }

      public void ejbActivate(){

      }

      public void ejbPassivate(){
      }

      public void ejbRemove(){
      }

      public void ejbLoad(){
      }

      public void ejbStore(){
      }

      public abstract Integer getEmpID();

      public abstract String getEName();

      public abstract String getDesignation();


      public abstract void setEName(String ename);

      public abstract void setDesignation(String design);

      public abstract void setEmpID(Integer ent);

      }





      my ejb-jar.xml is like as below






      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <!-- Generated XML! -->

      <ejb-jar>
      <enterprise-beans>

      <ejb-name>FirstSessionBean</ejb-name>
      com.ness.training.ejb.FirstSessionHome
      com.ness.training.ejb.FirstSession
      <ejb-class>com.ness.training.ejb.FirstSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <!-- <resource-ref>
      <res-ref-name>OracleDS</res-ref-name>
      <res-type>java.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      Data source for oracle
      </resource-ref>-->


      <ejb-name>EmployeeCMP</ejb-name>
      com.ness.training.ejb.EmployeeEntityHome
      com.ness.training.ejb.EmployeeEntity
      <ejb-class>com.ness.training.ejb.EmployeeEntityBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-version>1.x</cmp-version>
      <abstract-schema-name>Employee</abstract-schema-name>
      <cmp-field><field-name>empID</field-name></cmp-field>
      <cmp-field><field-name>eName</field-name></cmp-field>
      <cmp-field><field-name>designation</field-name></cmp-field>
      <primkey-field>empID</primkey-field>

      </enterprise-beans>
      </ejb-jar>






      my jbosscmp-jdbc-oracle.xml is like as below








      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <!-- Generated XML! -->

      <ejb-jar>
      <enterprise-beans>

      <ejb-name>FirstSessionBean</ejb-name>
      com.ness.training.ejb.FirstSessionHome
      com.ness.training.ejb.FirstSession
      <ejb-class>com.ness.training.ejb.FirstSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <!-- <resource-ref>
      <res-ref-name>OracleDS</res-ref-name>
      <res-type>java.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      Data source for oracle
      </resource-ref>-->


      <ejb-name>EmployeeCMP</ejb-name>
      com.ness.training.ejb.EmployeeEntityHome
      com.ness.training.ejb.EmployeeEntity
      <ejb-class>com.ness.training.ejb.EmployeeEntityBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-version>1.x</cmp-version>
      <abstract-schema-name>Employee</abstract-schema-name>
      <cmp-field><field-name>empID</field-name></cmp-field>
      <cmp-field><field-name>eName</field-name></cmp-field>
      <cmp-field><field-name>designation</field-name></cmp-field>
      <primkey-field>empID</primkey-field>

      </enterprise-beans>
      </ejb-jar>











      client code for this entity bean is like as below










      com.ness.training.ejb.EmployeeEntityHome home = (com.ness.training.ejb.EmployeeEntityHome)ctx.lookup("EmployeeCMP");
      //Collection total = home.findAll();
      com.ness.training.ejb.EmployeeEntity bean = home.create( new Integer(2),"bvn","SE");






      information at console after starting the server



      20:36:26,908 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-3.2.5/server/default/deploy/ejbdeploy.ear
      20:36:27,221 INFO [EjbModule] Deploying EmployeeCMP
      20:36:27,768 INFO [EjbModule] Deploying FirstSessionBean
      20:36:30,002 INFO [EmployeeCMP] Table 'EMPLOYEE' already exists
      20:36:30,049 INFO [EJBDeployer] Deployed: file:/C:/jboss-3.2.5/server/default/tmp/deploy/tmp47781ejbdeploy.ear-contents/ejbtraining.jar
      20:36:30,143 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-3.2.5/server/default/deploy/ejbdeploy.ear
      20:36:30,143 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      Packages waiting for a deployer:
      org.jboss.deployment.DeploymentInfo@2445cf14 { url=file:/C:/jboss-3.2.5/server/default/deploy/jbosscmp-jdbc-oracle.xml }
      deployer: null
      status: null
      state: INIT_WAITING_DEPLOYER
      watch: file:/C:/jboss-3.2.5/server/default/deploy/jbosscmp-jdbc-oracle.xml
      lastDeployed: 1102518390143
      lastModified: 1102518390143
      mbeans:

      Incompletely deployed packages:
      org.jboss.deployment.DeploymentInfo@2445cf14 { url=file:/C:/jboss-3.2.5/server/default/deploy/jbosscmp-jdbc-oracle.xml }
      deployer: null
      status: null
      state: INIT_WAITING_DEPLOYER
      watch: file:/C:/jboss-3.2.5/server/default/deploy/jbosscmp-jdbc-oracle.xml
      lastDeployed: 1102518390143
      lastModified: 1102518390143
      mbeans:


      20:36:30,252 INFO [Server] JBoss (MX MicroKernel) [3.2.5 (build: CVSTag=JBoss_3_2_5 date=200406251954)] Started in 19s:843ms
      20:36:30,252 INFO [Tomcat5] Saw org.jboss.system.server.started notification, starting connectors
      20:36:30,330 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
      20:36:30,502 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8009
      20:36:30,518 INFO [JkMain] Jk running ID=0 time=0/94 config=null






      error coming at server side after running the client java class







      20:38:36,296 INFO [STDOUT] now it was in setEntityContext method
      20:38:36,311 INFO [STDOUT] inside bean method2
      20:38:36,358 ERROR [EmployeeCMP] Could not create entity
      java.sql.SQLException: ORA-01400: cannot insert NULL into ("SYSTEM"."EMPLOYEE"."EMPID")

      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
      at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:622)
      at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:180)
      at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:542)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1027)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2887)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2959)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.executeInsert(JDBCAbstractCreateCommand.java:328)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:286)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:137)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:562)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:203)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1061)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:204)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:478)
      at org.jboss.ejb.Container.invoke(Container.java:743)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)







      information in log file




      2004-12-08 20:38:36,296 INFO [STDOUT] now it was in setEntityContext method
      2004-12-08 20:38:36,311 INFO [STDOUT] inside bean method2
      2004-12-08 20:38:36,311 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.EmployeeCMP] Executing SQL: SELECT COUNT(*) FROM EMPLOYEE WHERE empid=?
      2004-12-08 20:38:36,343 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.EmployeeCMP] Executing SQL: INSERT INTO EMPLOYEE (empid, ename, designation) VALUES (?, ?, ?)
      2004-12-08 20:38:36,358 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.EmployeeCMP] Could not create entity
      java.sql.SQLException: ORA-01400: cannot insert NULL into ("SYSTEM"."EMPLOYEE"."EMPID")

      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
      at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:622)
      at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:180)
      at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:542)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1027)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2887)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2959)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.executeInsert(JDBCAbstractCreateCommand.java:328)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:286)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:137)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:562)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:203)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1061)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:204)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:478)
      at org.jboss.ejb.Container.invoke(Container.java:743)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)












      though i am sending a valid value(2) it is showing some null value was reached


      can any body help me about this

        • 1. Re: Problem while accessing the CMP(oracle)
          Joan Horta  Tosas Novice

          You've made a big error in your bean code... If using CMP beans, then you cannot use public variables to store the values of the properties... You must change your code to:

          package com.ness.training.ejb;
          
          import javax.ejb.CreateException;
          import javax.ejb.EntityBean;
          import javax.ejb.EntityContext;
          public abstract class EmployeeEntityBean implements EntityBean
          {
          private transient EntityContext entContext;
          
          public void setEntityContext(EntityContext context){
          System.out.println("now it was in setEntityContext method");
          entContext = context;
          }
          
          public void unsetEntityContext(){
          entContext = null;
          }
          public Integer ejbCreate(Integer empid , String ename , String design) throws CreateException{
          setEmpID(empid);
           setEName(ename);
           setDesignation(design);
           System.out.println("inside bean method"+empid);
           return null;
          }
          
          public void ejbPostCreate(Integer empid,String ename , String design){
          System.out.println("in side ejb post create method "+empid);
          
          }
          
          public void ejbActivate(){
          
          }
          
          public void ejbPassivate(){
          }
          
          public void ejbRemove(){
          }
          
          public void ejbLoad(){
          }
          
          public void ejbStore(){
          }
          
          public abstract Integer getEmpID();
          
          public abstract String getEName();
          
          public abstract String getDesignation();
          
          
          public abstract void setEName(String ename);
          
          public abstract void setDesignation(String design);
          
          public abstract void setEmpID(Integer ent);
          
          }
          

          I havent' looked at your descriptors, so maybe is still a problem there, but this is the biggest one ;).


          • 2. Re: Problem while accessing the CMP(oracle)
            Veeranjaneyulu Bonthu Newbie

            thank you for responding my query

            i was changed my bean class with wich was given by but now it is throwing exception while starting itself it cant deployed

            the error i am getting was





            10:24:12,977 ERROR [EntityContainer] Starting failed jboss.j2ee:jndiName=EmployeeCMP,service=EJB
            org.jboss.deployment.DeploymentException: No field named 'empID' found in entity class.com.ness.training.ejb.EmployeeEntityBean
             at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCCMPFieldMetaData.loadFieldType(JDBCCMPFieldMetaData.java:803)
             at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCCMPFieldMetaData.<init>(JDBCCMPFieldMetaData.java:161)
             at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:375)
             at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:140)
             at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:52)
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:705)
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:417)
             at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:365)
             at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:147)
             at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:337)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
             at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:324)
             at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
             at $Proxy17.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:367)
             at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:324)
             at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
             at $Proxy38.start(Unknown Source)
             at org.jboss.ejb.EjbModule.startService(EjbModule.java:367)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
             at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:324)
             at org.jboss.mx.server.ReflectedD




            my Deployment descriptor------ejb-jar.xml


            
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
            
            <!-- Generated XML! -->
            
            <ejb-jar>
             <enterprise-beans>
             <session>
             <ejb-name>FirstSessionBean</ejb-name>
             <home>com.ness.training.ejb.FirstSessionHome</home>
             <remote>com.ness.training.ejb.FirstSession</remote>
             <ejb-class>com.ness.training.ejb.FirstSessionBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <!-- <resource-ref>
             <res-ref-name>OracleDS</res-ref-name>
             <res-type>java.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
             <description>Data source for oracle</description>
             </resource-ref>-->
             </session>
             <entity>
             <ejb-name>EmployeeCMP</ejb-name>
             <home>com.ness.training.ejb.EmployeeEntityHome</home>
             <remote>com.ness.training.ejb.EmployeeEntity</remote>
             <ejb-class>com.ness.training.ejb.EmployeeEntityBean</ejb-class>
             <persistence-type>Container</persistence-type>
             <prim-key-class>java.lang.Integer</prim-key-class>
             <reentrant>False</reentrant>
             <cmp-version>1.x</cmp-version>
             <abstract-schema-name>Employee</abstract-schema-name>
             <cmp-field><field-name>empID</field-name></cmp-field>
             <cmp-field><field-name>eName</field-name></cmp-field>
             <cmp-field><field-name>designation</field-name></cmp-field>
             <primkey-field>empID</primkey-field>
             </entity>
             </enterprise-beans>
            </ejb-jar>
            




            jbosscmp-jdbc-oracle.xml





            
            <?xml version="1.0" encoding="UTF-8"?>
            
            <jbosscmp-jdbc>
            <defaults>
            <datasource>java:/OracleDS</datasource>
            <type-mapping>Oracle8</type-mapping>
            <create-table>true</create-table>
            <remove-table>false</remove-table>
            <read-only>false</read-only>
            <read-time-out>300000</read-time-out>
            <row-locking>false</row-locking>
            <pk-constraint>true</pk-constraint>
            <fk-constraint>false</fk-constraint>
            <prefered-relation-mapping>foreign-key</prefered-relation-mapping>
            <read-ahead>
            <strategy>on-load</strategy>
            <page-size>1000</page-size>
            <eager-load-group>*</eager-load-group>
            </read-ahead>
            <list-cache-max>1000</list-cache-max>
            </defaults>
            <enterprise-beans>
            <entity>
             <ejb-name>EmployeeCMP</ejb-name>
             <table-name>employee</table-name>
             <cmp-field>
             <field-name>empID</field-name>
             <column-name>empid</column-name>
             </cmp-field>
             <cmp-field>
             <field-name>eName</field-name>
             <column-name>ename</column-name>
             </cmp-field>
             <cmp-field>
             <field-name>designation</field-name>
             <column-name>designation</column-name>
             </cmp-field>
            </entity>
            </enterprise-beans>
            </jbosscmp-jdbc>


            • 3. Re: Problem while accessing the CMP(oracle)-----------Solved
              Veeranjaneyulu Bonthu Newbie

              it was solved


              i was just removed properties from bean class and i was defined get & set methods as abstract methods
              i have changed a bit in ejb-jar.xml that was

              i was changed cmp-version from 1.x to 2.x
              now it is working fine