6 Replies Latest reply on Jun 24, 2004 7:15 PM by dev2gosoft

    NoSuchMethodError while deploying a CMP Entity Bean in JBoss

    dev2gosoft Newbie

      Hi all,
      I am getting this exception when a CMP Entity Bean is being deployed in JBoss 3.2.4. Please note that I have a whole bunch of stateless Session Beans deployed successfully....it is happening with CMP Entity bean only

      RuntimeErrorException: java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;


      I have referred to forum topic : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3838974#3838974 and still could not figure out a fix even though they appear to be very similar problems.


      Environment:
      Windows XP SP2 (RC2)
      JDK: 1.4.2_04
      Eclipse: 2.1.3


      Here is my AccountBean Code:

      package com.company.ht.data.account;
      
      import javax.ejb.CreateException;
      import javax.ejb.EntityBean;
      
      
      /**
       *
       * @ejb.bean
       * name="Account"
       * local-jndi-name="AccountHomeLocal"
       * type="CMP"
       * cmp-version="2.x"
       * primkey-field="loginID"
       * view-type="local"
       *
       * @ejb.value-object
       *
       * @ejb.finder query="query string ..."
       * signature="com.togosoft.ht.data.account.Account findAccountByActivationID(java.lang.String aID)"
       *
       *
       * @ejb.transaction type="Required"
       *
       * @jboss.persistence datasource="java:/HealthTheaterDS"
       * datasource-mapping="MS SQLSERVER2000"
       * table-name="htCustomerAccount_tb"
       *
       *
       */
      public abstract class AccountBean implements EntityBean {
      
       /**
       * @ejb.interface-method
       * @ejb.persistence column-name="LoginID"
       * @ejb.pk-field
       * @return
       */
       public abstract String getLoginID();
       public abstract void setLoginID(String id);
      
      
       /**
       * @ejb.create-method
       *
       * @param account
       * @return
       * @throws CreateException
       */
       public String ejbCreate(AccountDTO account)throws CreateException{
       this.setLoginID(account.getLoginID());
       //TODO: implement ejbCreate further...
       return null;
      
       }
      
       /**
       * @return
       * @throws CreateException
       */
       public void ejbPostCreate(AccountDTO account)throws CreateException{
       }
      
      
      
       /**
       * @ejb.interface-method
       */
       public abstract AccountValue getAccountValue();
      
      }
      



      Am I missing something....???

      The full exception is as follows:

      
      10:03:24,828 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=AccountHomeLocal,service=EJB
      RuntimeErrorException: java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
      Cause: java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
       at org.jboss.mx.server.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:99)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:64)
       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.GeneratedMethodAccessor6.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 $Proxy51.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.GeneratedMethodAccessor54.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.GeneratedMethodAccessor6.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 $Proxy14.start(Unknown Source)
       at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:570)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
       at sun.reflect.GeneratedMethodAccessor18.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 $Proxy7.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:478)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
       at sun.reflect.GeneratedMethodAccessor4.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 $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:367)
       at sun.reflect.GeneratedMethodAccessor6.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 $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:251)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:592)
       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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:407)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:311)
       at org.jboss.Main.boot(Main.java:144)
       at org.jboss.Main$1.run(Main.java:389)
       at java.lang.Thread.run(Thread.java:534)
      Caused by: java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
       at org.jboss.proxy.compiler.ProxyImplementationFactory.createProxyMethod(ProxyImplementationFactory.java:319)
       at org.jboss.proxy.compiler.ProxyCompiler.getCode(ProxyCompiler.java:167)
       at org.jboss.proxy.compiler.Runtime.makeProxyType(Runtime.java:69)
       at org.jboss.proxy.compiler.ProxyCompiler.<init>(ProxyCompiler.java:76)
       at org.jboss.proxy.compiler.Proxies$Impl.newTarget(Proxies.java:603)
       at org.jboss.proxy.compiler.Proxies.newTarget(Proxies.java:78)
       at org.jboss.proxy.compiler.Proxy.newProxyInstance(Proxy.java:49)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateBeanClassInstanceCommand.<init>(JDBCCreateBeanClassInstanceCommand.java:56)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createCreateBeanClassInstanceCommand(JDBCCommandFactory.java:124)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:471)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:396)
       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.GeneratedMethodAccessor54.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)
       ... 111 more
      
      


      Is it do with multiple confilicting versions of xalan.jar or bcel.jar....or...???

      any help is deeply appreciated


        • 1. Re: NoSuchMethodError while deploying a CMP Entity Bean in J
          Carlos Ortega Newbie

          Hi,

          I have a similar error in another AppServer (SunOne). I think that it's a problem with ejb-jar.xml, there are something that is not deploying ejb correctly.

          Do you have local interfaces or remote interfaces?

          Regards

          • 2. Re: NoSuchMethodError while deploying a CMP Entity Bean in J
            dev2gosoft Newbie

            My deployment descriptors and interfaces are generated by XDoclet (tags specified in the listed AccountBean.java)

            /*AccountLocalHome.java listing
             * Generated by XDoclet - Do not edit!
             */
            package com.company.ht.data.account;
            
            /**
             * Local home interface for Account.
             *
             */
            public interface AccountLocalHome
             extends javax.ejb.EJBLocalHome
            {
             public static final String COMP_NAME="java:comp/env/ejb/AccountLocal";
             public static final String JNDI_NAME="AccountHomeLocal";
            
             public com.togosoft.ht.data.account.AccountLocal create(com.togosoft.ht.data.account.AccountDTO account)
             throws javax.ejb.CreateException;
            
             public com.togosoft.ht.data.account.AccountLocal findAccountByActivationID(java.lang.String aID)
             throws javax.ejb.FinderException;
            
             public com.togosoft.ht.data.account.AccountLocal findByPrimaryKey(java.lang.String pk)
             throws javax.ejb.FinderException;
            
            }
            


            /* AccountLocal.java listing
             * Generated by XDoclet - Do not edit!
             */
            package com.togosoft.ht.data.account;
            
            /**
             * Local interface for Account.
             */
            public interface AccountLocal
             extends javax.ejb.EJBLocalObject
            {
            
             public java.lang.String getLoginID( ) ;
            
             public com.togosoft.ht.data.account.AccountValue getAccountValue( ) ;
            
            }
            
            



            Deployment descriptor portion for entitybean ejb-jar.xml listing
            
             <entity >
             <description><![CDATA[]]></description>
            
             <ejb-name>Account</ejb-name>
            
             <local-home>com.company.ht.data.account.AccountLocalHome</local-home>
             <local>com.company.ht.data.account.AccountLocal</local>
            
             <ejb-class>com.company.ht.data.account.AccountBean</ejb-class>
             <persistence-type>Container</persistence-type>
             <prim-key-class>java.lang.String</prim-key-class>
             <reentrant>False</reentrant>
             <cmp-version>2.x</cmp-version>
             <abstract-schema-name>Account</abstract-schema-name>
             <cmp-field >
             <description><![CDATA[]]></description>
             <field-name>loginID</field-name>
             </cmp-field>
             <primkey-field>loginID</primkey-field>
            
             <query>
             <query-method>
             <method-name>findAccountByActivationID</method-name>
             <method-params>
             <method-param>java.lang.String</method-param>
             </method-params>
             </query-method>
             <ejb-ql><![CDATA[query string ...]]></ejb-ql>
             </query>
             <!-- Write a file named ejb-finders-AccountBean.xml if you want to define extra finders. -->
             </entity>
            


            jbosscmp-jdbc.xml listing
            
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">
            
            <jbosscmp-jdbc>
             <defaults>
             </defaults>
            
             <enterprise-beans>
            
             <!--
             To add beans that you have deployment descriptor info for, add
             a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
             that contains the <entity></entity> markup for those beans.
             -->
            
             <entity>
             <ejb-name>Account</ejb-name>
             <datasource>java:/HealthTheaterDS</datasource>
             <datasource-mapping>MS SQLSERVER2000</datasource-mapping>
            
             <cmp-field>
             <field-name>loginID</field-name>
             <column-name>LoginID</column-name>
            
             </cmp-field>
            
            <!-- jboss 3.2 features -->
            <!-- optimistic locking does not express the exclusions needed -->
             </entity>
            
             </enterprise-beans>
            
            </jbosscmp-jdbc>
            


            jboss.xml listing
            
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
            
            <jboss>
            
             <enterprise-beans>
            
             <!--
             To add beans that you have deployment descriptor info for, add
             a file to your XDoclet merge directory called jboss-beans.xml that contains
             the <session></session>, <entity></entity> and <message-driven></message-driven>
             markup for those beans.
             -->
            
             <entity>
             <ejb-name>Account</ejb-name>
             <local-jndi-name>AccountHomeLocal</local-jndi-name>
            
             <method-attributes>
             </method-attributes>
            
             </entity>
            
             <session>
             <ejb-name>ServerControllerService</ejb-name>
             <jndi-name>ServerControllerService</jndi-name>
            
             <method-attributes>
             </method-attributes>
             </session>
             <session>
             <ejb-name>EmailAgentService</ejb-name>
             <jndi-name>EmailAgentService</jndi-name>
            
             <method-attributes>
             </method-attributes>
             </session>
             <session>
             <ejb-name>AccountControllerService</ejb-name>
             <jndi-name>AccountControllerService</jndi-name>
            
             <method-attributes>
             </method-attributes>
             </session>
             <session>
             <ejb-name>ReportDataControllerService</ejb-name>
             <jndi-name>ReportDataControllerHomeRemote</jndi-name>
            
             <method-attributes>
             </method-attributes>
             </session>
            
             </enterprise-beans>
            
             <resource-managers>
             </resource-managers>
            
            </jboss>
            
            


            • 3. Re: NoSuchMethodError while deploying a CMP Entity Bean in J
              Alexey Loubyansky Master

              Because BCEL is used for entity proxy generation. Look for conflicting BCEL jar in the classpath.

              • 4. Re: NoSuchMethodError while deploying a CMP Entity Bean in J
                dev2gosoft Newbie

                Alexis,
                Thanks for taking time out of your response. I searched the computer for bcel.jar and the only two places I have found the jar file is

                <JBOSS3.2.4_HOME>/server/all/lib
                <JBOSS3.2.4_HOME>/server/default/lib

                I am running the "all" configuration.

                bcel.jar in the both the places is 505kb in size. (it is of 504kb in jboss3.2.3)

                I have multiple versions of xalan.jar in the jdk, jboss and each is of different size ranging 850kb to 2.75MB ....but none of them have references to bcel.jar ....

                Am i missing something...?

                Thanks again...I appreciate it very much.



                • 5. Re: NoSuchMethodError while deploying a CMP Entity Bean in J
                  Mark Miller Newbie

                  Have a look at the following topic, I think they had the same problem:
                  http://www.jboss.org/index.html?module=bb&op=viewtopic&t=50964

                  Hope this helps,
                  Mark

                  • 6. Re: NoSuchMethodError while deploying a CMP Entity Bean in J
                    dev2gosoft Newbie

                    Thanks for the prompt response. It is fixed now. Yours/ and Alexey's response lead me to inspect all the jar files in the JAVA_HOME/.../JRE/LIB/ENDORSED directory... . It was the xsltr.jar that had "bcel" stuff not the suspected xalan.jar. removed that jar file and I was able to proceed.


                    Thanks to both of you for taking time out to help.