0 Replies Latest reply on Oct 31, 2006 7:20 PM by Serge Emmanuel Pagop

    + the Change of slsb to sfsb makes problems +

    Serge Emmanuel Pagop Newbie

      I have an java ee application with a remote business interface:

      public interface RegisterRemote {
       public void createUser(User user);
       public User findUser(long id);
      }


      and a stateless session bean:

      @javax.ejb.Stateless
      @javax.ejb.Remote(RegisterRemote.class)
      public class RegisterBean implements RegisterRemote {
       @javax.persistence.PersistenceContext(unitName="carDatabase")
       private javax.persistence.EntityManager em;
      
       public void createUser(User user) {
       em.persist(user);
       }
      
       public User findUser(long id) {
       return em.find(User.class, id);
       }
      }


      and my client looks so:

      public class Client {
       static public void main(String[] args) {
       try {
       Context jndiContext = getInitialContext();
       Object ref = jndiContext.lookup("RegisterBean/remote");
       RegisterRemote dao = (RegisterRemote)
       PortableRemoteObject.narrow(ref, RegisterRemote.class);
      
       Customer customer_1 = new Customer();
       customer_1.setFirstName("Francis");
       customer_1.setLastName("Pouatcha");
       customer_1.setUsername("francis.pouatcha");
       customer_1.setPassword("franc123Poutacha");
       customer_1.setEmail("fancis.pouatcha@gmail.de");
       dao.createUser(customer_1);
      
       Customer customer_2 = (Customer) dao.findUser(1);
       System.out.println(customer_2.getFirstName());
       System.out.println(customer_2.getLastName());
       System.out.println(customer_2.getUsername());
       System.out.println(customer_2.getPassword());
       System.out.println(customer_2.getEmail());
      
       } catch ( NamingException ne ) {
       ne.printStackTrace();
       }
       }
       private static Context getInitialContext() throws NamingException {
       java.util.Properties properties = new java.util.Properties();
       properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
       return new javax.naming.InitialContext(properties);
       }
      }


      and then when I run this client for the first time this do all things fine. But when I change the annotion of the session bean to @javax.ejb.Stateful then I get this error:

      [java] Exception in thread "main" javax.ejb.EJBException: java.lang.IllegalArgumentException: Wrong target. class de.mathema.slsb.RegisterBean for public void de.mathema.slsb.RegisterBean.createUser(de.mathema.domain.User)
       [java] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
       [java] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       [java] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:227)
       [java] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       [java] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       [java] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
       [java] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
       [java] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
       [java] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
       [java] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
       [java] Caused by: java.lang.IllegalArgumentException: Wrong target. class de.mathema.slsb.RegisterBean for public void de.mathema.slsb.RegisterBean.createUser(de.mathema.domain.User)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.handleErrors(MethodInvocation.java:141)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:116)
       [java] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       [java] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       [java] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:227)
       [java] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       [java] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       [java] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
       [java] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
       [java] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
       [java] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
       [java] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
       [java] at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
       [java] at org.jboss.remoting.Client.invoke(Client.java:525)
       [java] at org.jboss.remoting.Client.invoke(Client.java:488)
       [java] at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:78)
       [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       [java] at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       [java] at $Proxy0.createUser(Unknown Source)
       [java] at de.mathema.clients.Client.main(Client.java:40)


      But when I restart the server and then run my client for the second time this work fine.

      Can somebody tells me what is here the problem, because I know that jboss as is a hot-deployment server that can inspect that something have been changed.

      Thanks.