5 Replies Latest reply on Sep 6, 2004 12:05 PM by Rogelio Triviño

    instantiation exception on CMP beans

    Rogelio Triviño Newbie

      Hi:
      I have this Local Home:

      public interface LocalCadenaHome extends javax.ejb.EJBLocalHome {
      public LocalCadena create ( java.lang.String primaryKey) throws javax.ejb.CreateException;
      public LocalCadena findByPrimaryKey (java.lang.String codigo) throws javax.ejb.FinderException;
      public java.util.Collection findAll () throws javax.ejb.FinderException;

      I get an instance to this local home correctly from a sesion bean:

      javax.naming.InitialContext cntxt = new javax.naming.InitialContext();
      home = (LocalCadenaHome) cntxt.lookup("local/Cadena");

      but when I try to use it this way:
      try {
      cadenas = home.findAll();
      } catch (javax.ejb.FinderException e) {
      cadenas = null; //al principio no hay ninguno
      }
      I got the FinderException, when I try to use it this way:
      LocalCadena beanCad = home.create(cad.getCodigo());
      I got the CreateException.
      The messages are:
      2004-09-02 12:54:52,554 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract com.mediaadbox.ejb.cadena.LocalCadena com.mediaadbox.ejb.cadena.LocalCadenaHome.create(java.lang.String) throws javax.ejb.CreateException, causedBy:
      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:308)
      at java.lang.Class.newInstance(Class.java:261)
      at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createBeanClassInstance(JAWSPersistenceManager.java:165)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createBeanClassInstance(CMPPersistenceManager.java:119)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createBeanClassInstance(CachedConnectionInterceptor.java:250)
      at org.jboss.ejb.EntityContainer.createBeanClassInstance(EntityContainer.java:226)
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:168)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:77)
      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:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
      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:483)
      at org.jboss.ejb.Container.invoke(Container.java:720)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:293)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy152.create(Unknown Source)
      at com.mediaadbox.ejb.cadena.CadenaManagerBean.insertCadena(CadenaManagerBean.java:94)

      and my ejb-jar.xml is like:
      com.mediaadbox.ejb.cadena.LocalCadena
      <ejb-class>com.mediaadbox.ejb.cadena.CadenaBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <abstract-schema-name>Cadena</abstract-schema-name>
      <cmp-version>2.x</cmp-version>
      <prim-key-class>java.lang.String</prim-key-class>
      True
      <cmp-field><field-name>codigo</field-name></cmp-field>
      :::::::::::: <cmp-field><field-name>usuarioCreador</field-name></cmp-field>
      <primkey-field>codigo</primkey-field>
      <jndi-name>local/Cadena</jndi-name>



      <ejb-name>CadenaManager</ejb-name>
      <local-home>com.mediaadbox.ejb.cadena.LocalCadenaManagerHome</local-home>
      com.mediaadbox.ejb.cadena.LocalCadenaManager
      <ejb-class>com.mediaadbox.ejb.cadena.CadenaManagerBean</ejb-class>
      <abstract-schema-name>CadenaManager</abstract-schema-name>
      <cmp-version>2.x</cmp-version>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>
      <ejb-ref-name>local/Cadena</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.mediaadbox.ejb.cadena.LocalCadenaHome</local-home>
      com.mediaadbox.ejb.cadena.LocalCadena
      <ejb-link>Cadena</ejb-link>
      </ejb-local-ref>


      I'm trying different ways of local/Cadena or Cadena but no way. I don't have any error in deploy.
      Thanks for your time.

        • 1. Re: instantiation exception on CMP beans
          Alexey Loubyansky Master

          Don't use JAWS for CMP2.x

          • 2. Re: instantiation exception on CMP beans
            Rogelio Triviño Newbie

            Hi:
            I already have this in my 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">
            <ejb-jar>

            isn't it enough?
            Thanks for your answer.

            • 3. Re: instantiation exception on CMP beans
              Rogelio Triviño Newbie

              Nothing like read (and know what to read). I've change in my jboss.xml the declarations:
              Standard CMP EntityBeans to Standard 2.0 CMP EntityBeans,
              and know I'm using the 2.0 cmp-jdbc system, but now I have another exception on CMP instantiation:
              2004-09-03 15:17:49,502 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract com.mediaadbox.ejb.cadena.LocalCadena com.mediaadbox.ejb.cadena.LocalCadenaHome.create(java.lang.String) throws javax.ejb.CreateException, causedBy:
              java.lang.IllegalStateException: createBeanClassInstanceCommand == null
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createBeanClassInstance(JDBCStoreManager.java:542)
              at org.jboss.ejb.plugins.CMPPersistenceManager.createBeanClassInstance(CMPPersistenceManager.java:119)
              at org.jboss.ejb.EntityContainer.createBeanClassInstance(EntityContainer.java:226)
              at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:168)
              at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:77)
              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:267)
              at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
              at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
              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:483)
              at org.jboss.ejb.Container.invoke(Container.java:720)
              at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:293)
              at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
              at $Proxy80.create(Unknown Source)
              at com.mediaadbox.ejb.cadena.CadenaManagerBean.insertCadena(CadenaManagerBean.java:94)

              • 4. Re: instantiation exception on CMP beans
                Alexey Loubyansky Master

                There should have been some DeploymentException.

                • 5. Re: instantiation exception on CMP beans
                  Rogelio Triviño Newbie

                  You are rigth. I'm working on it. If I still have problems after all changes I'll open a new thread. Thanks.