ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Could not instantiate DataSourceFactory. Cause: java.lang.ClassCastException
Date Wed, 15 Mar 2006 16:26:39 GMT
I'm confused.  Are you saying:

1. It works if you package this into an EAR and the iBATIS jar files are in
the EAR
2. It does not work if package this into a standalone WAR and put the iBATIS
jar files in web-inf/lib

???

If the app cannot find jar files in web-inf/lib, it is not an iBATIS problem
- something else is seriously wrong with your WAR (likely) or application
server (unlikely).

Jeff Butler


On 3/15/06, Chema <chemagogia@gmail.com> wrote:
>
>
> Thanks for the answer, but that is not the problem.
>
> It's a problem about casting:
>
> Well, I have debugged the iBatis source and I have seen that the problem
> is in
>
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.java
>
> when cast
>
> DataSourceFactory dsFactory = (DataSourceFactory) Resources.instantiate
> (type);
>
> (  in   addNodelet "/sqlMapConfig/transactionManager/dataSource/end()" )
>
> The 'type' value is ' com.ibatis.sqlmap.engine.datasource.
> JndiDataSourceFactory' in my application
>
> Indeed, if I do
>
> com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory dsFactory = (
> com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory )
> Resources.instantiate(type);
>
> the ClassCastException happens again.
>
> Only with
>
> JndiDataSourceFactory dsFactory = new JndiDataSourceFactory()
>
> doesn't happen.
>
>
> I guess that the source error is in the way that the objects are
> instanciated by classloader in com.ibatis.common.resources.Resources.java, but I dont
know why.
>
> I tried to allocate ibatis JAR files into WEB-INF/lib, but WAR doesn't
> find classes.
>
> Ummmm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 2006/3/14, Jeff Butler <jeffgbutler@gmail.com >:
>
> > Try this:
> >
> > <transactionManager type="JDBC">
> >     <dataSource type="JNDI">
> >       <property name="DataSource"
> > value="java:comp/env/jdbc/datasource"/>
> >     </dataSource>
> >   </transactionManager>
> >
> > Jeff Butler
> >
> >
> >  On 3/14/06, Chema <chemagogia@gmail.com> wrote:
> > >
> > > Hello:
> > >
> > > Sorry if I send this message twice
> > >
> > > I'm using iBatis 2.
> > > I'm trying to deploy a WAR file into a SUNONE 7 AS instance but
> > > retrieve this exception:
> > >
> > > com.ibatis.common.exception .NestedRuntimeException: Error
> > > initializing iBatis SQLMap, Cause:
> > > com.ibatis.common.exception.NestedRuntimeException: Error occurred.
> > > Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
> > > Cause: com.ibatis.common.exception.NestedRuntimeException : Error
> > > parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause:
> > > com.ibatis.sqlmap.client.SqlMapException: Error initializing
> > > DataSource.  Could not instantiate DataSourceFactory.  Cause:
> > > java.lang.ClassCastException
> > > Caused by: java.lang.ClassCastException
> > >
> > >
> > > - I set up datasource configuration in the application server as
> > > "jdbc/datasource"
> > >
> > > - I defined this datasorce in web.xml
> > >
> > > <resource-ref>
> > >
> > > <res-ref-name>jdbc/datasource</res-ref-name>
> > >                 <res-type>javax.sql.DataSource </res-type>
> > >                 <res-auth>Container</res-auth>
> > >                 <res-sharing-scope>Shareable</res-sharing-scope>
> > > </resource-ref>
> > >
> > > - I defined this datasorce in sun-web.xml
> > >
> > > <resource-ref>
> > >                 <res-ref-name>jdbc/datasource</res-ref-name>
> > >                 <jndi-name>jdbc/datasource</jndi-name>
> > > </resource-ref>
> > >
> > >
> > > - I defined sqlMap client config file
> > >
> > >   <transactionManager type="JDBC">
> > >     <dataSource type="JNDI">
> > >       <property name="DataSource" value="jdbc/datasource"/>
> > >     </dataSource>
> > >   </transactionManager>
> > >
> > >
> > > I dont understand why java.lang.ClassCastException happens.
> > > Indeed, I get to initialize iBatis fine deploying a EAR file within
> > > these config files
> > >
> > > Where can stay the problem ?
> > >
> > > Thanks in advance
> > >
> > > Best regards
> > >
> >
> >
>
>

Mime
View raw message