ClassCastException in SqlSessionFactoryBuilder for myBatis 3.0.5

54 views
Skip to first unread message

Andrew Hart

unread,
Sep 14, 2015, 12:36:37 PM9/14/15
to mybatis-user
I apologize if this comes through twice.  I tried to post this query previously and can't seem to find anything to indicate I was successful, so trying again.

We have a web service.  The code for that web service, including the sqlMapConfig.xml file, has not changed in some times.

However, after an update, we are getting this error when the web service tries to handle a request:

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.ClassCastException: org.jnp.interfaces.NamingContext cannot be cast to javax.sql.DataSource
 at org
.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:85)
 at org
.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:69)
 at org
.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:30)
 
... 45 more
Caused by: java.lang.ClassCastException: org.jnp.interfaces.NamingContext cannot be cast to javax.sql.DataSource
 at org
.apache.ibatis.datasource.jndi.JndiDataSourceFactory.setProperties(JndiDataSourceFactory.java:38)
 at org
.apache.ibatis.builder.xml.XMLConfigBuilder.dataSourceElement(XMLConfigBuilder.java:218)
 at org
.apache.ibatis.builder.xml.XMLConfigBuilder.environmentsElement(XMLConfigBuilder.java:192)
 at org
.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:81)
 
... 47 more


I am thinking it is some problem with a jar, class loader.  Any suggestions on troubleshooting this?

Thanks.


Guy Rouillier

unread,
Sep 15, 2015, 6:00:08 PM9/15/15
to mybatis-user
You don't provide enough information for anyone to help.  Based solely on the stack trace, I'm guessing you are using a JNDI datasource.  Looks like you don't have the URL correct, you are resolving to the NamingContext rather than a datasource within that NamingContext.  Do a diff on the config file to see the before (working) and after (not working) datasource definitions.
 
--
Guy Rouillier
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Avast logo

This email has been checked for viruses by Avast antivirus software.
www.avast.com


Reply all
Reply to author
Forward
0 new messages