ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lamey <cla...@localmatters.com>
Subject Re: iBatis - tomcat JNDI setup
Date Wed, 26 Mar 2008 21:23:48 GMT
Having the ResourceLink and the Resource in the context xml might be
screwing it up.  You're telling it to link to a global JNDI object, but it
doesn't exist at that level.

Also using a resource-ref in the web.xml and a Resource element in the
context.xml is redundant.

Read the Resource Definitions section of this page:

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

Declaring a Resource in the context xml allows you to drop in JNDI objects
for you webapp without having to muck with web.xml.

On 3/26/08 3:17 PM, "Tom Henricksen" <TomH@A-t-g.com> wrote:

> I am trying to setup Tomcat JNDI to work on our application with iBatis.
> 
> I get the following error:
> 
>  
> 
> java.lang.RuntimeException: Error occurred.  Cause:
> 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 an error configuring
> JndiDataSourceTransactionPool. Cause:
> javax.naming.NameNotFoundException: Name jdbc is not bound in this
> Context
> 
>       at
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConf
> igParser.java:89)
> 
>       at
> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapCli
> entBuilder.java:63)
> 
>       at
> com.advtechgrp.bop.medical.data.SqlMapsService.initSqlMaps(SqlMapsServic
> e.java:58)
> 
>       at
> com.advtechgrp.bop.medical.web.MedicalApplication.initialize(MedicalAppl
> ication.java:106)
> 
>       at
> com.advtechgrp.bop.medical.web.listener.FacesListener.contextInitialized
> (FacesListener.java:63)
> 
>       at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.j
> ava:3831)
> 
>       at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4323
> )
> 
>       at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.ja
> va:823)
> 
>  
> 
>  
> 
> SqlMapConfig.xml ibatis 2.30
> 
>       <transactionManager type="JDBC">
> 
>             <dataSource type="JNDI">
> 
>                   <property name="DataSource"
> value="java:comp/env/jdbc/medical"/>
> 
>             </dataSource>
> 
>       </transactionManager>
> 
>  
> 
> context.xml - tomcat 5.0.30
> 
> <?xml version='1.0' encoding='utf-8'?>
> 
> <Context debug="4"
> 
>       docBase="C:/Java/eclipse-europa/europa-workspace/bop-med/web"
> 
>       path="/bop-med" reloadable="true"
> 
>       workDir="work\Catalina\localhost\bop-med">
> 
>       
> 
>       <ResourceLink global="jdbc/medical" name="jdbc/medical"
> 
>             type="javax.sql.DataSource"/>
> 
>       
> 
>       <Resource name="jdbc/medical" auth="Container"
> 
>                 type="javax.sql.DataSource" username="user"
> 
>                 password="pass"
> 
>                 driverClassName="com.ibm.db2.jcc.DB2Driver"
> 
>                 url="jdbc:db2://srv:50000/medical"
> 
>                 maxActive="8" maxIdle="4"/>
> 
> </Context>
> 
>  
> 
>             In application web.xml
> 
>  
> 
>       <resource-ref>
> 
>             <description>
> 
>                   jdbc/medical
> 
>             </description>
> 
>             <res-ref-name>jdbc/medical</res-ref-name>
> 
>             <res-type>javax.sql.DataSource</res-type>
> 
>             <res-auth>Container</res-auth>
> 
>       </resource-ref>
> 
>  
> 
> Any suggestions?
> 
>  
> 
> Thanks in advance,
> 
>  
> 
> Tom Henricksen
> Consultant
> Advanced Technologies Group, Inc.
> 
> 1601 48th Street, Suite 220
> 
> West Des Moines, IA 50265
> 
> *  Office:     (515) 221-9344 Ext 138
> 
> *  Fax:         (515) 221-1266
> * Email:     tomh@a-t-g.com
> 
>  
> 


Mime
View raw message