[jboss-user] [EJB 3.0] - java.lang.RuntimeException: java.lang.ClassCastException: $P

ravendra.gupta do-not-reply at jboss.com
Thu Jul 2 06:22:06 EDT 2009


Hi all,
 I am using Jboss application server 4.2.3 GA.
my problem is, when I create a stateless session bean and deploy that works fine but if I change this bean  to stateful session bean by changing annotation, that give classCastException
  | package com.logica.heca.lpr.ruleengine;
  | 
  | import com.logica.heca.lpr.common.exception.FatalException;
  | import com.logica.heca.lpr.common.exception.RuleParserException;
  | import com.logica.heca.lpr.domain.contact.ContactVO;
  | import com.logica.heca.lpr.domain.ruleengine.RuleDefinitionVO;
  | import com.logica.heca.lpr.ruleengine.helper.RuleParser;
  | 
  | import javax.ejb.EJBException;
  | import javax.ejb.Stateful;
  | import java.io.Serializable;
  | 
  | /**
  |  * <p/>
  |  * Created by: kumarrg
  |  * Date: 17-Jun-2009
  |  * Time: 14:33:02
  |  * </br>
  |  * This software is a part of the LPR system, developed by Logica.
  |  */
  | @Stateful(name = "RuleEngine")
  | public class RuleEngineBean  implements RuleEngineLocal, RuleEngineRemote,  RuleEngine, Serializable {
  | 
  |    // private static final Logger logger= Logger.getLogger(RuleEngineBean.class);
  | 
  |     /**
  |      * @param contactVO to be validated against rules
  |      * @return ContactdVo populated with ruleId and Error Source object
  |      */
  |     public ContactVO processContact(ContactVO contactVO) {
  | //        try {
  | //            StatelessSession session = getRuleBase().newStatelessSession();
  | //            session.execute(contactVO);
  |             return contactVO;
  | //        } catch (Throwable ex) {
  | //            logger.fatal("Severe error while processing ContactVo rule", ex);
  | //            throw new FatalException("Fatal error while parsing rule");
  | //        }
  |     }
  | 
  | //    private RuleBase getRuleBase()throws RuleParserException {
  | //      // return new RuleBaseBuilder().getRuleBase();
  | //        return null;
  | //    }
  | 
  |     /**
  |      * parse rule  as per Drools rules 4 format
  |      * @param ruleDefinitionVO RuleDefinitionLite
  |      * @return RuleDefinitionErrorVO if any error found else null
  |      */
  |     public void parseRule(RuleDefinitionVO ruleDefinitionVO) throws RuleParserException{
  |         try {
  |             new RuleParser().parseRule(ruleDefinitionVO);
  |         } catch (Throwable ex) {
  |            // logger.fatal("Severe error while parsing rule",ex);
  |             throw new EJBException("Fatal error while parsing rule");
  |         }
  |     }
  | 
  |     /**
  |      *  clears Cache of RuleBase in Rule Engine
  |      */
  |     public void clearCache() {
  |         try {
  |             new RuleBaseBuilder().clearCache();
  |         } catch (Throwable ex) {
  |           //  logger.fatal("Severe Error while clearing RuleBase cache", ex);
  |             throw new EJBException("Fatal error while clearing RuleBase cache");
  |         }
  |     }
  | }
  | 
the exact error is
  | d-25]. The thread terminates
  | java.lang.ClassCastException: $Proxy61 cannot be cast to com.logica.heca.lpr.ruleengine.RuleEngineRemote
  |         at com.logica.heca.lpr.services.facade.RuleEngineFacade.process(RuleEngineFacade.java:31)
  |         at com.logica.heca.lpr.dataLoader.DataLoaderThread.run(DataLoaderThread.java:129)
  | 11:51:54,243 ERROR [STDERR] Exception in thread "DataLoaderThread-25"
  | 11:51:54,243 ERROR [STDERR] java.lang.RuntimeException: java.lang.ClassCastException: $Proxy61 cannot be cast to com.logica.h
  | eca.lpr.ruleengine.RuleEngineRemote
  | 11:51:54,243 ERROR [STDERR]     at com.logica.heca.lpr.dataLoader.DataLoaderThread.run(DataLoaderThread.java:187)
  | 
I am running client and server code on same server
help from any one would be highly  appreciable.

Thanks
-Ravi


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241421#4241421

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241421



More information about the jboss-user mailing list