Hi,

If I understand well:
- your bean is an entity with container-managed persistence,
and the associated datasource is named 'jdbc_3',
- your entity bean access to this same datasource via a resource-ref.
We have got some equivalent tests, and they work fine.
So I don't known what the problem could be .....

Nevertheless, with container-managed persistence, a priori, the
programmer
does not have to develop the code for accessing the data in the
relational database;
because this code is included in the container itself (generated by the
platform tools).
So, what kind of access to the database have you develop in your entity
bean with CMP ?

Kind regards.
H�l�ne.

Surendra wrote:
> 
> Attached are the descriptor files that you asked for.
> 
> Regards
> Surendra
> ----- Original Message -----
> From: H�l�ne JOANIN <[EMAIL PROTECTED]>
> To: Surendra <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, April 18, 2001 4:27 PM
> Subject: Re: Database connection in CMP
> 
> > 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) {
> > >       file://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
> >
> 
>   ------------------------------------------------------------------------
>                         Name: jonas-ejb-jar.xml
>    jonas-ejb-jar.xml    Type: text/xml
>                     Encoding: 7bit
> 
>                   Name: ejb-jar.xml
>    ejb-jar.xml    Type: text/xml
>               Encoding: quoted-printable

-- 
-=- 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