2 Replies Latest reply on May 13, 2002 6:15 PM by Frank Adcock

    BMP entity Bean can't insert data to oracle 8i ,but other CM

    jmail_tw Newbie

      please help me.
      i am use jboss2.4.4 with tomcat3.2.3.
      is my jboss.xml configure error or
      ejb-jar.xml have error.
      ######################################################
      this is my ejb-jar.xml file:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/dtd/ejb-jar_1_1.d$

      <ejb-jar>
      Sun Example Account
      <display-name>SunBMP</display-name>
      <enterprise-beans>


      Sun Example Account
      <display-name>SunBMPBean</display-name>
      <ejb-name>SunBeanBMP</ejb-name>
      sunejb.AccountHome
      sunejb.Account
      <ejb-class>sunejb.AccountEJB</ejb-class>
      <persistence-type>Bean</persistence-type>

      <transaction-type>Bean</transaction-type>

      <prim-key-class>java.lang.String</prim-key-class>
      False

      <!--
      <resource-ref>
      <res-ref-name>bmpexam</res-ref-name>
      <resource-name>java:/DefaultDS</resource-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Application</res-auth>
      </resource-ref>
      -->


      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>SunBeanBMP</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>NotSupported</trans-attribute>
      </container-transaction>
      </assembly-descriptor>

      </ejb-jar>

      #######################################################
      this is my jboss.xml:

      <?xml version="1.0" encoding="UTF-8"?>


      false
      <container-configurations />
      <!-- <resource-managers />-->

      <resource-managers>

      <!-- <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">-->
      <resource-name>java:/DefaultDS</resource-name>
      <resource-jndi-name>java:/DefaultDS</resource-jndi-name>
      <!-- </resource-manager>-->

      </resource-managers>

      <enterprise-beans>

      <ejb-name>SunBeanBMP</ejb-name>
      <jndi-name>SunBeanBMP</jndi-name>

      <configuration-name></configuration-name>


      </enterprise-beans>

      #######################################################
      this is some part on jboss.jcml file:

      ......
      ......


      <mbean ...>
      ....

      jdbc:oracle:thin:@localhost:1521:o817
      scott
      10
      tiger
      0


      .......
      .......


      #######################################################
      this is error on console:
      [INFO,Default] balance = 68.25
      [INFO,Default] balance = 32.55
      [ERROR,Default] Caught an exception.javax.ejb.ObjectNotFoundException: No rows found.

      ######################################################
      if i select at database always is empty rows at that table.
      please help me.and tell me how to fix this problem.

        • 1. Re: BMP entity Bean can't insert data to oracle 8i ,but othe
          jmail_tw Newbie


          when i change ejb-jar.xml trans-attribute value=requested then get follow error.
          now it can insert data to database.but get some error.
          How do i fix this error.

          #############################################

          [ERROR,SunBeanBMP] TRANSACTION ROLLBACK EXCEPTION:
          javax.transaction.TransactionRolledbackException: ejbCreate: ORA-00001: unique constraint (SCOTT.PK_ACCOUNT) violated
          ; nested exception is:
          javax.ejb.EJBException: ejbCreate: ORA-00001: unique constraint (SCOTT.PK_ACCOUNT) violated

          javax.ejb.EJBException: ejbCreate: ORA-00001: unique constraint (SCOTT.PK_ACCOUNT) violated

          at sunejb.AccountEJB.ejbCreate(AccountEJB.java:61)
          at java.lang.reflect.Method.invoke(Native Method)
          at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:137)
          at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:632)
          at java.lang.reflect.Method.invoke(Native Method)
          at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:859)
          at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:234)
          at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:147)
          at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:97)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:142)
          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
          at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
          at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:103)
          at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:421)
          at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:456)
          at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:237)
          at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
          at $Proxy12.create(Unknown Source)
          at sunejb.SunBMPServlet.doPost(SunBMPServlet.java:65)
          at sunejb.SunBMPServlet.doGet(SunBMPServlet.java:125)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
          at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
          at org.apache.tomcat.core.Handler.service(Handler.java:287)
          at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
          at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
          at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
          at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
          at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
          at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
          at java.lang.Thread.run(Thread.java:484)
          [ERROR,Default] Caught an exception.javax.transaction.TransactionRolledbackException: ejbCreate: ORA-00001: unique constraint (SCOTT.PK_ACCOUNT) violated
          ; nested exception is:
          javax.ejb.EJBException: ejbCreate: ORA-00001: unique constraint (SCOTT.PK_ACCOUNT) violated

          #########################################################


          • 2. Re: BMP entity Bean can't insert data to oracle 8i ,but othe
            Frank Adcock Newbie

            You have two choices - you can insert data with a different primary key value, or you can catch the DuplicateKeyException and handle it appropriately depending on your business requirement.