ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gwyn Evans <gwyn.ev...@gmail.com>
Subject Re: JNDI - Weblogic - SqlMApConfig
Date Thu, 14 Jun 2007 09:23:01 GMT
On Thursday, June 14, 2007, 8:23:05 AM, davypulinckx <davypulinckx@telenet.be> wrote:

Something odd going on then - First thing to grasp is that this isn't
anything to do with iBATIS, simply a failure to locate a JNDI item, so
don't get focussed in the wrong place.

1) Are you sure the requested data source is actually there?

- Go to the 'Server' page in the Admin console and use the "View JNDI
tree" link and check that the jdbc top-level folder shows up, and that
it's got a entry below it of "DataSourceName"

- Doublecheck it - '...Name', not '...Test'

- Triplecheck the case - 'DatasourceName's not good enough!

2) Is the client code using the same JNDI area.
- Is it running in the appserver as a WAR or EAR, else you'll need to
somehow explicitly ensure you're using the AppServer JNDI tree.

3) Spring config - I'm rustier on that, so I'm not saying the one
you're using is wrong, but in my Spring applicationContext.xml, I'm
doing the following...  Maybe try that if you get down to here

    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value= "jdbc/MyAppDB"/>
    </bean>

    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="configLocation" value="classpath:sqlMapConfig.xml"/>
        <property name="dataSource" ref="dataSource"/>
    </bean>

    ...

Hope that helps!
/Gwyn
-

> It won’t work; i get in my stacktrace the following message.
> Would someone please help me?

> Caused by: com.ibatis.common.xml.NodeletException: Error parsing
> XML.  Cause: java.lang.RuntimeException: Error parsing
> XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause:
> com.ibatis.sqlmap.client.SqlMapException: There was a
> n error configuring JndiDataSourceDaoTransactionPool. Cause:
> javax.naming.NameNotFoundException: While trying to lookup
> 'jdbc.DataSourceName' didn't find subcontext 'jdbc' Resolved ;
> remaining name 'jdbc/DataSourceName'
>         at
> com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:52)
>         at
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:81)
>         ... 39 more
> Caused by: java.lang.RuntimeException: Error parsing XPath
> '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause:
> com.ibatis.sqlmap.client.SqlMapException: There was an error
> configuring JndiDataSourceDaoTransactionPool. Cause: javax.
> naming.NameNotFoundException: While trying to lookup
> 'jdbc.DataSourceName' didn't find subcontext 'jdbc' Resolved ; rema
> ining name 'jdbc/DataSourceName'




> Try,

> <dataSource type="JNDI"> 
>                  <property name="DataSource" value="jdbc/DataSourceTest"/>

> </dataSource>



> or whatever the JNDI name is for DataSourceTest in the JDBC Data Sources Admin Screen.



> Regards,
> MF




> Davy Pulinckx wrote: 
> Hi,

>  

> Cane anyone explain me how you configured weblogic and sqlmapconfig. 

> I use weblogic, I have a datasource and a connectionpool both are well configured and
works fine.

> Now, when I begin to write my sqlmapconfig of ibatis I get many problems with it.

> First of all I have developed these 2 sqlmapconfig below for testing, butt none of them
works.

> For example lets assume they call ( datasource = DataSourceTest and
> connectionpool = ConnectionPoolTest)

> How cane I get this to work, I have searched the online documents
> of ibatis and internet and I found examples butt they don’t work.

> If I use just a transactionManagerType = SIMPLE, all works fine,
> butt when I use one of these 2 JNDI below it wont work.

> Please someone help me.

>  

> Greets

> Davy

>  

>  

> <?xml version="1.0" encoding="UTF-8" ?>  

>  <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"

>  "http://www.ibatis.com/dtd/sql-map-config-2.dtd"> 

>  

> <sqlMapConfig> 

>     <transactionManager type="JDBC"> 

>         <dataSource type="JNDI"> 

>                                    <property name="DataSource" value="DataSourceTest"/>

>                         </dataSource>

>     </transactionManager>

>     <sqlMap resource="SqlMap.xml"/> 

>  </sqlMapConfig>

>  

>  

> <?xml version="1.0" encoding="UTF-8" ?>  

>  <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"

>  "http://www.ibatis.com/dtd/sql-map-config-2.dtd"> 

>  

> <sqlMapConfig> 

>     <transactionManager type="JDBC"> 

>         <dataSource type="JNDI"> 

>                                    <property name="DataSource"
> value="java:comp/env/jdbc/DataSourceTest"/>

>                         </dataSource>

>     </transactionManager>

>     <sqlMap resource="SqlMap.xml"/> 

>  </sqlMapConfig>

>  





/Gwyn


Mime
View raw message