Calling session bean method from servlet

Discussions

EJB programming & troubleshooting: Calling session bean method from servlet

  1. Calling session bean method from servlet (1 messages)

    I am facing a rather strange problem.
    I have a payments class(serializable) with 4 attributes(private with getter and setter methods), 1 String,2 ints and 1 float. In PayServlet, i am instantiating payments class and and adding the payments object to allPayments vector. Then i am making an enumeration out of this vector.
    Payment session bean (stateless) has a business method payBatch which accpets enumeartion as the only argument and return boolean.
    When i call payBatch method from PayServlet, at run time, it gives me a ClassCastException. I have tried it with vector but no use. I also tried with passing an array of Payments object but no help.
    If i pass individual Payments object, it works.
    But my requirement is such that i have to pass collection of payment objects and not individual objects.
    As far as i know EJB specs, there is nothing like this mentioned there.

    Can anybody give me a clue or possible solutions?

    Thanx in anticipation.

    Sumit.
  2. Hi Sumit,
    Just check whether the vector you are using is class scope and not method scope in your mail Bean class.

    Good Luck
    Jinu