Hi,

Could you, please, send us the two XML deployment descriptor files
(standard and JOnAS specific) ?
This will probably help us to understand the problem.

Kind regards.
Hélène.

> Surendra wrote:
> 
> Hi,
> 
> 
> I want to execute a query in CMP(my requirement). I wrote following
> method
> 
> private DataSource dataSource = null;
> private Connection getConnection() throws EJBException, SQLException {
> 
>    if (dataSource == null) {
>       //Finds DataSource from JNDI
>       Context   initialContext = null;
>       try {
>         initialContext = new InitialContext();
>         dataSource =
> (DataSource)initialContext.lookup("java:comp/env/jdbc/StudentID");
>       } catch (Exception e) {
>         System.out.println("Cannot lookup dataSource " + e);
>         throw new javax.ejb.EJBException("Cannot lookup dataSource ");
>       }
>   }
>   return dataSource.getConnection();
> }
> 
> But while executing the method i am getting following error Can you
> please tell me what is the reson.
> 
> Error
> java.lang.ClassCastException: student.JOnASStuBeanHome
>         at student.StudentBean.getConnection(StudentBean.java:59)
>         at student.StudentBean.getStudent(StudentBean.java:79)
>         at student.StudentBean.ejbCreate(StudentBean.java:39)
>         at
> student.JOnASStuBeanBean.ejbCreate(JOnASStuBeanBean.java:60)
>         at student.JOnASStuBeanHome.create(JOnASStuBeanHome.java:113)
>         at
> student.JOnASStuBeanHome_Skel.send(JOnASStuBeanHome_Skel.java:40)
>         at
> org.objectweb.david.libs.protocols.giop.GIOPProtocol$ServerSession_Lo
> w.send(GIOPProtocol.java:621)
>         at
> org.objectweb.jonathan.libs.protocols.tcpip.TcpIpProtocol$Session.run
> (TcpIpProtocol.java:396)
>         at
> org.objectweb.jonathan.libs.resources.JScheduler$JJob.run(JScheduler.
> java:265)
>  System exc. => Rollback the transaction.
>  JEntityHome.removeEJBObject: pk = null
>  postinvoke: System Exception in a home method:javax.ejb.EJBException:
> Cannot lo
> okup dataSource
> 
> Regards
> Surendra

-- 
-=- Hélène JOANIN -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  mailto:[EMAIL PROTECTED]   http://www.evidian.com
  Phone: 33.4.76.29.73.53            Fax: 33.4.76.29.76.00
  Download our EJB Server JOnAS at http://www.objectweb.org
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to