Kurt, what does both your setter and getter code and method signatures
look like on CasesJdbcDAO when you're getting this error?

'javax.servlet.jsp.el.ELException: Attempt to coerce a value of type
"JDBCDataSource" to type "javax.sql.DataSource"' indicates an attempt
to inject a JDBCDataSource into a value binding expecting a
javax.sql.DataSource.

Something's not adding up here.

On 12/5/05, Kurt Edegger <[EMAIL PROTECTED]> wrote:
> Hi Mike,
>
> thank you for your help, but I don't think that your answer is correct.
> We are talking about two different classes. The first one is
> CasesJdbcDAO with the setter taking an JDBCDataSource Object and the
> second on is the JDBCDataSource class having a getDs() method to return
> the actual javax.sql.DataSource object. To clearify: The JDBCDataSource
> object is injected to CasesJdbcDAO using the setter in CasesJdbcDAO
> which takes the correct type of JDBCDataSource.
> I don't think this is an issue of a misscasted type since it works if
> the field in CasesJdbcDAO (marked as [1] in my former postings) isn't
> named 'dataSource'. In that case the JSF implementation seems to
> interpret the name as a type and causing the exception. In the case it
> isn't named 'dataSource' (e.g. 'ds' in my example) the injection is done
> without any problems.
>
> I'm appreciating your help and thoughts.
>
> Kurt
>
>
>
> on 12/5/2005 8:54 AM Mike Kienenberger stated:
> > Your setter and getter return different types.
> >
> >  public DataSource getDs()
> >
> > needs to be
> >
> >  public JDBCDataSource getDs() {
> >
> > On 12/2/05, Kurt Edegger <[EMAIL PROTECTED]> wrote:
> >
> >>Hi Mike,
> >>
> >>thank you for your response.
> >>
> >>on 12/2/2005 7:30 AM Mike Kienenberger stated:
> >> > Can you post the setter method for ds in CasesJdbcDAO?
> >>
> >>Here are the crucial parts of CasesJdbcDAO:
> >>/* the field definition [1]*/
> >>private JDBCDataSource ds;
> >>
> >>/* the setter*/
> >>public void setDs(JDBCDataSource dataSource) {
> >>   this.ds = dataSource;
> >>   this.setDataSource(this.ds.getDs());
> >>}
> >>
> >> > Also can you post the class definition line for JDBCDataSource?
> >>The JDBCDataSource class is very simple and just holds an
> >>javax.sql.DataSource object. Here are the interesting parts:
> >>
> >>/*the class definition */
> >>public class JDBCDataSource{
> >>
> >>     /*the javax.sql.DataSource*/
> >>     private DataSource ds;
> >>     private String jndiLookup;
> >>...
> >>
> >>     public DataSource getDs() {
> >>         doLookup();
> >>         return ds;
> >>     }
> >>
> >>}
> >>
> >>
> >>The issue again: If I change the name of the field in CasesJdbcDAO at
> >>position [1] to dataSource, and adjust the injection in faces-config.xml
> >>accordingly the application crashes with the stated exception.
> >>
> >>Any ideas?
> >>
> >>     Kurt
> >>
>
>

Reply via email to