5 Replies Latest reply on Aug 28, 2009 8:40 AM by Pedriane Pretto

    Error EJB3 - JBOSS 5.1.0GA

    Pedriane Pretto Newbie

      Hello friends!!!


      I'm having a problem I run a client class of a bean.
      The error occurs when the call is made to a class method (as code below)

      I'm using JPA + EJB3 + JBoss 5.1.0 GA

      Would anyone tell me what can this be?
      Please help me.
      Thanks.



      It's the method of the class client

      public void execute() throws Exception
      {
      ClienteEAO clienteEAO = (ClienteEAO) ServiceLocator.getInstance().lookup(ClienteEAO.class);
      Cliente cliente = new Cliente(1, 777,"Teste cliente 777");

      cliente = clienteEAO.addCliente(cliente); //Error Line

        • 1. Re: Error EJB3 - JBOSS 5.1.0GA
          Pedriane Pretto Newbie

          continues...
          Exception in thread "main" javax.ejb.EJBException: java.lang.RuntimeException: java.lang.InstantiationException: com.bpc.locadora.persistence.eao.ClienteEAOBean
          at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
          at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
          at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
          at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
          at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
          Caused by: java.lang.RuntimeException: java.lang.InstantiationException: com.bpc.locadora.persistence.eao.ClienteEAOBean
          at org.jboss.ejb3.EJBContainer.construct(EJBContainer.java:838)
          at org.jboss.ejb3.stateless.StatelessContainer.createBeanContext(StatelessContainer.java:120)
          at org.jboss.ejb3.pool.AbstractPool.createBeanContext(AbstractPool.java:105)
          at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:79)
          at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
          at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
          at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
          at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
          at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
          at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
          at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
          at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:211)
          at org.jboss.remoting.Client.invoke(Client.java:1724)
          at org.jboss.remoting.Client.invoke(Client.java:629)
          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
          at $Proxy3.invoke(Unknown Source)
          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
          at $Proxy2.addCliente(Unknown Source)
          at com.bpc.locadora.teste.AcessoBanco.execute(AcessoBanco.java:38)
          at com.bpc.locadora.teste.AcessoBanco.main(AcessoBanco.java:29)
          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
          at $Proxy3.invoke(Unknown Source)
          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
          at $Proxy2.addCliente(Unknown Source)
          at com.bpc.locadora.teste.AcessoBanco.execute(AcessoBanco.java:38)
          at com.bpc.locadora.teste.AcessoBanco.main(AcessoBanco.java:29)
          Caused by: java.lang.InstantiationException: com.bpc.locadora.persistence.eao.ClienteEAOBean
          at java.lang.Class.newInstance0(Unknown Source)
          at java.lang.Class.newInstance(Unknown Source)
          at org.jboss.ejb3.EJBContainer.construct(EJBContainer.java:834)
          at org.jboss.ejb3.stateless.StatelessContainer.createBeanContext(StatelessContainer.java:120)
          at org.jboss.ejb3.pool.AbstractPool.createBeanContext(AbstractPool.java:105)
          at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:79)
          at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
          at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
          at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
          at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
          at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
          at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
          at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)



          • 2. Re: Error EJB3 - JBOSS 5.1.0GA
            Wolfgang Knauf Master

            Hi,

            is "Cliente" either:
            -an abstract class
            -an interface
            -contains no parameterless constructor?

            Best regards

            Wolfgang

            • 3. Re: Error EJB3 - JBOSS 5.1.0GA
              Pedriane Pretto Newbie

              Hi Wolfgang,

              It's a simple class to test, which contains a method
              void that calls the execute method

              ---------------------------------------
              public class AcessoBanco {


              public static void main(String[] args) throws Exception {
              new AcessoBanco().execute();
              }


              public void execute() throws Exception
              {
              ClienteEAO clienteEAO = (ClienteEAO) ServiceLocator.getInstance().lookup(ClienteEAO.class);
              Cliente cliente = new Cliente(1, 777,"Teste cliente 777");

              cliente = clienteEAO.addCliente(cliente);


              System.out.println(cliente);

              }

              }


              Thank's
              Petryk

              • 4. Re: Error EJB3 - JBOSS 5.1.0GA
                Wolfgang Knauf Master

                So "Cliente" does not have a parameterless constructor? You have to add one, so that serialization works.

                Best regards

                Wolfgang

                • 5. Re: Error EJB3 - JBOSS 5.1.0GA
                  Pedriane Pretto Newbie

                  Hi Wolfgang,


                  This is my class Cliente.
                  There is one constructor with parameters and one constructor parameterless.
                  Do you see some thing wrong in my class?

                  Thanks for attention
                  Petryk

                  ----------------------------------

                  package com.bpc.locadora.persistence.entity;

                  import java.io.Serializable;
                  import java.util.ArrayList;
                  import java.util.Collection;
                  import java.util.List;
                  import java.util.Set;

                  import javax.persistence.CascadeType;
                  import javax.persistence.Column;
                  import javax.persistence.Entity;
                  import javax.persistence.FetchType;
                  import javax.persistence.GeneratedValue;
                  import javax.persistence.Id;
                  import javax.persistence.JoinColumn;
                  import javax.persistence.NamedQueries;
                  import javax.persistence.NamedQuery;
                  import javax.persistence.OneToMany;
                  import javax.persistence.Table;
                  import javax.persistence.Transient;


                  @Entity
                  @Table(name = "cliente")
                  public class Cliente implements Serializable{

                  /**
                  * Entidade Cliente
                  */

                  private static final long serialVersionUID = -2024174521422981726L;

                  @Id
                  @GeneratedValue
                  @Column(name = "idCliente")
                  private Integer idCliente;

                  @Column (name = "cpf")
                  private double cpf;

                  @Column(name = "nome")
                  private String nome;

                  public Cliente() {

                  }



                  public Cliente(Integer idCliente, double cpf, String nome) {
                  this.idCliente = idCliente;
                  this.cpf = cpf;
                  this.nome = nome;
                  }



                  public Cliente(double cpf, String nome) {
                  this.cpf = cpf;
                  this.nome = nome;
                  }

                  public Integer getIdCliente() {
                  return idCliente;
                  }

                  public void setIdCliente(Integer idCliente) {
                  this.idCliente = idCliente;
                  }

                  public double getCpf() {
                  return cpf;
                  }

                  public void setCpf(double cpf) {
                  this.cpf = cpf;
                  }

                  public String getNome() {
                  return nome;
                  }

                  public void setNome(String nome) {
                  this.nome = nome;
                  }


                  }