This discussion is archived
3 Replies Latest reply: Jun 25, 2012 11:04 PM by r035198x RSS

Class Cast Exception in EJB2.0

944271 Newbie
Currently Being Moderated
DEBUG com.pack.ApplSessListener 16 - vattributeAdded : errorencountered,java.lang.ClassCastException: java.lang.String cannot be cast to com.pack1.class1

.....................................

The task for which i getting this exception is..
We have stateful and stateless methods in one bean,So we moved stateful to other bean and likewise made an entry to web.xml and ejb-jar.xml...
-----------------------------------------------------------ejb-jar------------------------------------------------
<session>
          <description>Stateless Example</description>
          <ejb-name>Stlgl</ejb-name>
          <local-home>com.bidm.misc.ejb.session.ejbeans.StlglHome</local-home>
          <local>com.bidm.misc.ejb.session.ejbeans.Stlgl</local>
          <ejb-class>com.bidm.misc.ejb.session.ejbeans.StlglBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
     </session>
<session>
          <description>Stateful Example</description>
          <ejb-name>Stfgl</ejb-name>
          <local-home>com.bidm.misc.ejb.session.ejbeans.StfglHome</local-home>
          <local>com.bidm.misc.ejb.session.ejbeans.Stfgl</local>
          <ejb-class>com.bidm.misc.ejb.session.ejbeans.StfglBean</ejb-class>
          <session-type>Stateful</session-type>
          <transaction-type>Container</transaction-type>
     </session>

-----------------------------------------------------------ejb-jar- ends-----------------------------------------------

-----------------------------------------------------------Web.xml------------------------------------------------------


<ejb-local-ref>

<ejb-ref-name>Stlgl</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.bidm.misc.ejb.session.ejbeans.StlglHome</local-home>
<local>com.bidm.misc.ejb.session.ejbeans.Stlgl</local>

</ejb-local-ref>

<ejb-local-ref>

<ejb-ref-name>Stfgl</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.bidm.misc.ejb.session.ejbeans.StfglHome</local-home>
<local>com.bidm.misc.ejb.session.ejbeans.Stfgl</local>

</ejb-local-ref>-----------------------------------------------------------Web.xml ends------------------------------------------------------

The code is cracking when multiuser hit particular module in application,In that case i getting error..But For single user its running fine...Any suggestion pz

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points