5 Replies Latest reply on Oct 4, 2002 3:05 AM by koonkay

    LocalBean create problems

    mandarm

      Hi,
      I have a simple example in which a statless session bean looks up a local entity bean and calls the creates method
      JBoss 3.0.0 + Tomcat 4.0.3 with Oracle 8.1.7 database.

      The tables get created correctly.

      I see that the jndi lookup works correctly. Then I get "TransactionRolledBack" and java.lang.Instantiation Exception.

      Here is the exception stack trace
      -----------------------------------------------
      2002-08-19 12:10:41,453 INFO [STDOUT] Before getHome dts/SystemInfo call
      2002-08-19 12:10:41,453 INFO [STDOUT] After getHome dts/SystemInfo call
      2002-08-19 12:10:41,453 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:
      java.rmi.ServerException: Could not instantiate bean; nested exception is:
      java.lang.InstantiationException
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:211)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:122)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:227)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy129.create(Unknown Source)
      at com.forestexpress.businessservice.dts.admin.AdminBean.addSystem(AdminBean.java:38)
      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.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:705)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
      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 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)
      Caused by: 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:296)
      at java.lang.Class.newInstance(Class.java:249)
      at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createBeanClassInstance(JAWSPersistenceManager.java:165)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createBeanClassInstance(CMPPersistenceManager.java:165)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createBeanClassInstance(CachedConnectionInterceptor.java:251)
      at org.jboss.ejb.EntityContainer.createBeanClassInstance(EntityContainer.java:294)
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:208)
      -----------------------------------------------

      Thanks in advance for your help.

      Regards
      Mandar

        • 1. Re: LocalBean create problems

          There is something wrong with your bean class constructor.
          Does it have a default constructor?

          Are you trying to use CMP2.0?

          Regards,
          Adrian

          • 2. Re: LocalBean create problems
            mandarm

            Hi,
            Yes, I am using CMP 2.0.

            The table has two columns SystemID and SystemName.

            I have written ejb-jar.xml and jbosscmp-jdbc.xml. I see one more issue and not sure if this is related. Even when the <create-table> setting is false, server tries to create the tables when I deploy the jar file.

            Here are the create methods
            ------------------------------------
            public String ejbCreate(String sysId, String sysName)
            throws CreateException {
            System.out.println("SystemInfoBean: ejbCreate method");
            setSystemId(sysId);
            setSystemName(sysName);

            return null;
            }

            public void ejbPostCreate(String sysId, String sysName)
            throws CreateException {
            }
            ---------------

            Thanks
            Mandar

            • 3. Re: LocalBean create problems

              The exception trace mentions JAWS which is ejb1.1

              Do you have the ejb2.0 dtd at the top of your
              ejb-jar.xml?

              Have you specified
              <cmp-version>2.x</cmp-version> for the entity?

              Regards,
              Adrian

              • 4. Re: LocalBean create problems
                mandarm

                Thanks all for your help.
                Actually there was a typo in ejb-jar.xml.
                I corrected it and now it works fine.

                Regards
                Mandar

                • 5. Re: LocalBean create problems
                  koonkay

                  i meet the same problem as u. could u tell me how to correct the ejb-jar.xml