6 Replies Latest reply on Sep 2, 2013 12:27 AM by Surendra Ind

    Getting the exception while using stateful session bean in jboss-as-7.1.1.Final

    Surendra Ind Newbie

      I am using  EJB2.x.I can successfully lookup for the StatefulSessionBean but i am afraid statefulsessionbean causes for the exception.

       

      I added  jboss-as-naming-7.1.1.Final.jar to my classspath for removing the exception  java.lang.RuntimeException: ClassNotFoundException marshaling EJB parameters.


      RemoteInterface

      =============

      public interface EJBController extends EJBObject, java.io.Serializable{

       

                 public Collection handleEvent(BizEvent ese) throws RemoteException, MySedanEventException;

                public StateMachine getStateMachine() throws RemoteException;

                public void setAttribute(String key, Object value) throws RemoteException;

       

      }

       

       

      StateFulSessionBean

      =================

      public class EJBControllerBean implements SessionBean, java.io.Serializable {

       

                private StateMachine sm;

                private SessionContext sc;

       

                public EJBControllerBean() {}

       

                public void ejbCreate() {

                               sm = new StateMachine(this);

                               System.out.println("\n EJBControllerBean=======SteteMachine created \n");

                }

       

        public StateMachine getStateMachine() {

                               System.out.println("state machine in state machine class"+sm);

                               return sm;

                }

       

      }

       

       

      HomeInterface

      ==================

      public interface EJBControllerHome extends EJBHome {

          public EJBController create()

              throws RemoteException, CreateException;

      }

       

       

      my HandlerClass

      ===============

       

                                    System.out.println("Getting new EJBController");

                                    try {

                             EJBController  ejbController= EJBUtil.getEJBControllerHome().create();

                               ejbController.getStateMachine();     //getting exception here                      

                                    }

                                    catch (CreateException ce) {

                                                   throw new GeneralFailureException(ce.getMessage());

                                    }

                                    catch (RemoteException re) {

                                                   throw new GeneralFailureException(re.getMessage());

                                    }

                                    catch (javax.naming.NamingException ne) {

                                                    throw new GeneralFailureException(ne.getMessage());

                                    }

                                    catch (Exception e) {

                                              e.printStackTrace();}

      }

       

      jboss-ejb-client.properties

      =================

       

      #endpoint.name=client-endpoint

      remote.connections=default

      remote.connection.default.host=localhost

      remote.connection.default.port = 4447

      jboss.naming.client.ejb.context=true

      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

       

       

       

      EJBUtils

      ===========

      public static EJBControllerHome getEJBControllerHome() throws NamingException {

           InitialContext ic = new InitialContext();

           return (EJBControllerHome) ic.lookup("ejb:savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome?stateful");

                }

       

       

      server.log

      ======================

       

      30:52,108 INFO  [stdout] (http--0.0.0.0-80-1) Getting new EJBController

      30:52,113 WARN  [org.jboss.ejb.client.naming] (http--0.0.0.0-80-1) Ignoring 'stateful' option on lookup of home interface com.mysedan.application.limonet.control.ejb.EJBControllerHome

      30:52,121 INFO  [org.jboss.ejb.client] (http--0.0.0.0-80-1) JBoss EJB Client version 1.0.5.Final

      30:52,125 INFO  [stdout] (http--0.0.0.0-80-1)

      30:52,129 INFO  [stdout] (http--0.0.0.0-80-1) Proxy for remote EJB EJBHomeLocator{appName='savoya', moduleName='savoya.jar', distinctName='', beanName='ControllerEJB', view='interface com.mysedan.a

      ication.limonet.control.ejb.EJBControllerHome'}

      30:52,139 WARN  [org.jboss.ejb.client.naming] (http--0.0.0.0-80-1) Ignoring 'stateful' option on lookup of home interface com.mysedan.application.limonet.control.ejb.EJBControllerHome

      30:52,158 INFO  [stdout] (http--0.0.0.0-80-1)

      30:52,159 INFO  [stdout] (http--0.0.0.0-80-1)  EJBControllerBean=======SteteMachine created

      30:52,160 INFO  [stdout] (http--0.0.0.0-80-1)

      30:52,187 INFO  [stdout] (http--0.0.0.0-80-1) state machine in state machine classcom.mysedan.application.limonet.control.ejb.StateMachine@1199ae5

      30:52,200 ERROR [stderr] (http--0.0.0.0-80-1) java.lang.IllegalArgumentException: Can not set final org.jboss.as.naming.ManagedReference field org.jboss.as.ejb3.component.stateful.SerializedStatefu

      ssionComponent.instance to org.jboss.as.naming.ValueManagedReferenceFactory$ValueManagedReference

      30:52,203 ERROR [stderr] (http--0.0.0.0-80-1)        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)

      30:52,206 ERROR [stderr] (http--0.0.0.0-80-1)        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)

      30:52,210 ERROR [stderr] (http--0.0.0.0-80-1)        at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:83)

      30:52,213 ERROR [stderr] (http--0.0.0.0-80-1)        at java.lang.reflect.Field.set(Field.java:741)

      30:52,221 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.storeFields(SerializingCloner.java:368)

      30:52,224 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:313)

      30:52,229 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:254)

      30:52,231 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:231)

      30:52,239 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      30:52,244 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:348)

      30:52,246 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309)

      30:52,254 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:286)

      30:52,261 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:254)

      30:52,262 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      30:52,265 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:348)

      30:52,273 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309)

      30:52,278 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:254)

      30:52,280 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      30:52,290 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:348)

      30:52,293 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309)

      30:52,296 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:254)

      30:52,303 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      30:52,307 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:225)

      30:52,310 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:216)

      30:52,314 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:188)

      30:52,321 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)

      30:52,324 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)

      30:52,328 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      30:52,331 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)

      30:52,339 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      30:52,342 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

      30:52,345 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

      30:52,353 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

      30:52,356 ERROR [stderr] (http--0.0.0.0-80-1)        at com.sun.proxy.$Proxy14.getStateMachine(Unknown Source)

      30:52,359 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.getEJBController(ModelManager.java:1623)

      30:52,363 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.<init>(ModelManager.java:287)

      30:52,370 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doProcess(MainServlet.java:804)

      30:52,373 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doGet(MainServlet.java:52)

      30:52,377 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

      30:52,380 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      30:52,387 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      30:52,391 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      30:52,394 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      30:52,397 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      30:52,404 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      30:52,407 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      30:52,413 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      30:52,414 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      30:52,422 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      30:52,425 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      30:52,429 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      30:52,431 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      30:52,441 ERROR [stderr] (http--0.0.0.0-80-1)        at java.lang.Thread.run(Thread.java:724)