java.lang.ClassCastException

Discussions

EJB programming & troubleshooting: java.lang.ClassCastException

  1. java.lang.ClassCastException (4 messages)

    hello
    i need some help in EJB

    DodAuthorisationHome dodAuthHome = (DodAuthorisationHome)PortableRemoteObject.narrow(context.lookup("DodAuthorisation"), DodAuthorisationHome.class);
    DodAuthorisation dodAuthorisation;

    now the first line shows the java.lang.ClassCastException
    why it occurs tell me plsssssssssssss

    Threaded Messages (4)

  2. java.lang.ClassCastException[ Go to top ]

    Hello Vikas,
                  Which app server you are using and can you post remote and home interface.

    cheers.
  3. java.lang.ClassCastException[ Go to top ]

    Hello sir
    i am using OC4J server
    and
    my home and remote interface are:--
    package model.CMP;
    import java.sql.Date;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    import java.sql.Timestamp;

    public interface DodAuthorisation extends EJBObject
    {
      String getAuthorisationNo() throws RemoteException;

      String getBrCode() throws RemoteException;

      void setBrCode(String brCode) throws RemoteException;

      String getInvoiceNo() throws RemoteException;

      void setInvoiceNo(String invoiceNo) throws RemoteException;

      Date getInvoiceDate() throws RemoteException;

      void setInvoiceDate(Date invoiceDate) throws RemoteException;

      double getInvoiceValue() throws RemoteException;

      void setInvoiceValue(double invoiceValue) throws RemoteException;

      double getRebookDays() throws RemoteException;

      void setRebookDays(double rebookDays) throws RemoteException;

      String getDelvBranch() throws RemoteException;

      void setDelvBranch(String delvBranch) throws RemoteException;

      String getPoNo() throws RemoteException;

      void setPoNo(String poNo) throws RemoteException;

      Date getPoDate() throws RemoteException;

      void setPoDate(Date poDate) throws RemoteException;

      String getCngrRefNo() throws RemoteException;

      void setCngrRefNo(String cngrRefNo) throws RemoteException;

      String getSafexRefNo() throws RemoteException;

      void setSafexRefNo(String safexRefNo) throws RemoteException;

      String getCnmtNo() throws RemoteException;

      void setCnmtNo(String cnmtNo) throws RemoteException;

      Date getAuthDate() throws RemoteException;

      void setAuthDate(Date authDate) throws RemoteException;

      double getAuthAmount() throws RemoteException;

      void setAuthAmount(double authAmount) throws RemoteException;

      char getFormCYn() throws RemoteException;

      void setFormCYn(char formCYn) throws RemoteException;

      double getDraftAmount() throws RemoteException;

      void setDraftAmount(double draftAmount) throws RemoteException;

      double getChequeAmount() throws RemoteException;

      void setChequeAmount(double chequeAmount) throws RemoteException;

      String getDraftFavourOf() throws RemoteException;

      void setDraftFavourOf(String draftFavourOf) throws RemoteException;

      String getChequeFavourOf() throws RemoteException;

      void setChequeFavourOf(String chequeFavourOf) throws RemoteException;

      String getDraftPayableAt() throws RemoteException;

      void setDraftPayableAt(String draftPayableAt) throws RemoteException;

      String getChequePayableAt() throws RemoteException;

      void setChequePayableAt(String chequePayableAt) throws RemoteException;

      char getCancel() throws RemoteException;

      void setCancel(char cancel) throws RemoteException;

      String getUserName() throws RemoteException;

      void setUserName(String userName) throws RemoteException;

      Date getEntDate() throws RemoteException;

      void setEntDate(Date entDate) throws RemoteException;

      String getModifyBy() throws RemoteException;

      void setModifyBy(String modifyBy) throws RemoteException;

      Date getModifyDate() throws RemoteException;

      void setModifyDate(Date modifyDate) throws RemoteException;
    }


    ***************************************

    package model.CMP;
    import javax.ejb.EJBHome;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import java.util.Collection;
    import java.sql.Date;

    public interface DodAuthorisationHome extends EJBHome
    {

      DodAuthorisation findByPrimaryKey(String primaryKey) throws RemoteException, FinderException;

      Collection findAll() throws RemoteException, FinderException;

      DodAuthorisation create(String dauthorisation_No, String dbr_code, String dinvoice_no, Date dinvoice_date, double dinvoice_value, double drebook_days,String ddelv_branch, String dpo_no, Date dpo_date, String dcngr_ref_no, String dsafex_ref_no, String dcnmt_no, Date dauth_date, double dauth_amount, char dform_c_yn, double ddraft_amount, double ddcheque_amount, String ddraft_favour_of, String dcheque_favour_of, String ddraft_payable_at, String dcheque_payable_at,char dcancel,String duser_name, Date dent_date, String dmodify_by, Date dmodify_date) throws RemoteException, CreateException;
    }
    ****************************************
  4. java.lang.ClassCastException[ Go to top ]

    Is your home interface bound in jndi using "DodAuthorisation", that'd be first thing I'd check in your ejb jar xml DD.
  5. Re: java.lang.ClassCastException[ Go to top ]

    If you deploy ejb and jsp/servelet on the same server(JBOSS4.0.3) You do not need to copy client.jar files to the jsp's lib folder. If you do it'll give class cast exception.