You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Tom Henricksen <To...@A-t-g.com> on 2008/03/26 22:17:18 UTC

iBatis - tomcat JNDI setup

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

 


Re: Migrating away from Hibernate

Posted by Clinton Begin <cl...@gmail.com>.
Rather than trying to convert the hibernate mappings, you might instead just
try using Abator to generate new iBATIS mappings and then write tests around
your data access layer to see if you can synchronize the behavior between
the two.

Clinton

On Thu, Mar 27, 2008 at 3:29 AM, C. Bergström <cb...@netsyncro.com>
wrote:

> Hi list!
>
> My primary goal is to take a large applications with hundreds/thousands
> of classes that use hibernate annotations and migrate it over to Ibatis.
>
> My secondary goal would be to take a large application with hibernate
> mapping files and convert them over to Ibatis..
>
> I've looked on the FAQ and Wiki and of course didn't find what I'm
> looking for, but have some crazy/loose ideas I'd like to get feedback on
> and see if anyone else is interested.
>
> After using Elvyx to do performance profiling on an app using Hibernate
> I started to get the idea of how to automate this migration process.
> Even if the generated hibernate sql is horrible it should be possible
> with reflection to create a mapping file.  I realize this is a pretty
> far out idea, but I see it not only for this client, but others..
> ideas/suggestions/feedback?
>
> Thanks for the minute.
>
> ./Christopher
>
>

Migrating away from Hibernate

Posted by "C. Bergström" <cb...@netsyncro.com>.
Hi list!

My primary goal is to take a large applications with hundreds/thousands
of classes that use hibernate annotations and migrate it over to Ibatis.

My secondary goal would be to take a large application with hibernate
mapping files and convert them over to Ibatis..

I've looked on the FAQ and Wiki and of course didn't find what I'm
looking for, but have some crazy/loose ideas I'd like to get feedback on
and see if anyone else is interested.

After using Elvyx to do performance profiling on an app using Hibernate
I started to get the idea of how to automate this migration process.
Even if the generated hibernate sql is horrible it should be possible
with reflection to create a mapping file.  I realize this is a pretty
far out idea, but I see it not only for this client, but others..
ideas/suggestions/feedback?

Thanks for the minute.

./Christopher


RE: iBatis - tomcat JNDI setup

Posted by Tom Henricksen <To...@A-t-g.com>.
Similar error with servlet.  Must be a tomcat issue.  Thanks for your
help Chris.

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null'
	at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:780)
	at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:540)
	at
com.advtechgrp.web.servlet.TestConn.processRequest(TestConn.java:37)
	at com.advtechgrp.web.servlet.TestConn.doGet(TestConn.java:20)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:214)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
	at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:198)

-----Original Message-----
From: Tom Henricksen [mailto:TomH@A-t-g.com] 
Sent: Thursday, March 27, 2008 2:36 PM
To: user-java@ibatis.apache.org
Subject: RE: iBatis - tomcat JNDI setup

I will make a servlet and try that out.

Thanks,
Tom

-----Original Message-----
From: Christopher Lamey [mailto:clamey@localmatters.com] 
Sent: Thursday, March 27, 2008 2:16 PM
To: user-java@ibatis.apache.org
Subject: Re: iBatis - tomcat JNDI setup

Well, that looks good.

At this point, I might code up something outside of iBATIS to verify
that
the JDNI object is really there and working.  Something like this:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
    envCtx.lookup("jdbc/medical");

Connection conn = ds.getConnection();
System.out.println("DB Version : "
    + conn.getMetaData().getDatabaseMajorVersion());
conn.close();

That way you'll know if it's a Tomcat or iBATIS issue.

On 3/27/08 10:18 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:

> This is the sqlmaps config file.
> 
> <?xml version="1.0" ?>
> <!DOCTYPE sqlMapConfig
>   PUBLIC '-//iBATIS.com//DTD SQL Map Config 2.0//EN'
>   'http://www.ibatis.com/dtd/sql-map-config-2.dtd'>
> <sqlMapConfig>
> 
> <properties
> resource="com/advtechgrp/configuration/deployment.properties"/>
> 
> <settings cacheModelsEnabled="false" enhancementEnabled="false"
> lazyLoadingEnabled="false" maxRequests="32" maxSessions="10"
> maxTransactions="5" useStatementNamespaces="true"/>
> 
> 
> <typeAlias alias="DomainReference"
> type="com.advtechgrp.bop.medical.common.DomainReference"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.CharTypeHandler"
> javaType="java.lang.String"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.OffenderCodeTypeHandler"
> javaType="com.advtechgrp.bop.medical.offender.business.OffenderCode"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.SmallIntTypeHandler"
> javaType="java.lang.Short"/>
> 
> <transactionManager type="JDBC">
> <dataSource type="JNDI">
> <property name="DataSource"
> value="java:comp/env/jdbc/medical"/>
> </dataSource>
> </transactionManager>
> 
> <sqlMap
> resource="com/advtechgrp/bop/medical/data/CommonVsp.xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/offender/data/OffenderDef.xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/common/data/admcounter.xml"/>
> <sqlMap
>
resource="com/advtechgrp/bop/medical/activity/data/ActivityFrequencyVsp.
> xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/activity/data/ActivityVsp.xml"/>
> </sqlMapConfig>
> 
> -----Original Message-----
> From: Christopher Lamey [mailto:clamey@localmatters.com]
> Sent: Thursday, March 27, 2008 10:54 AM
> To: user-java@ibatis.apache.org
> Subject: Re: iBatis - tomcat JNDI setup
> 
> That looks to me like iBATIS is trying to create a connection pool
> rather
> than using the one in JNDI.
> 
> Can you send your whole SqlMapConfig.xml?
> 
> On 3/27/08 6:47 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:
> 
>> I tried what you suggested (removing the entry from web.xml and the
>> resource link from the context.xml) and I now get this error message
>> from my application.
>> 
>> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
> of
>> class '' for connect URL 'null'
>> at
>> 
>
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
>> .java:780)
>> at
>> 
>
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
>> va:540)
>> at
>> 
>
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTrans
>> action.java:48)
>> at
>> 
>
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(
>> JdbcTransaction.java:89)
>> at
>> 
>
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
>> ForList(GeneralStatement.java:123)
>> at
>> 
>
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
>> ExecutorDelegate.java:615)
>> 
>> Thanks,
>> Tom
>> 
>> 
>> -----Original Message-----
>> From: Tom Henricksen [mailto:TomH@A-t-g.com]
>> Sent: Wednesday, March 26, 2008 9:09 PM
>> To: user-java@ibatis.apache.org
>> Subject: RE: iBatis - tomcat JNDI setup
>> 
>> I tried following:
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
>> And it has both the context.xml and the entry in the web.xml.
>> I will try without the web.xml and see.
>> 
>> Thanks,
>> Tom
>> 
>> -----Original Message-----
>> From: Christopher Lamey [mailto:clamey@localmatters.com]
>> Sent: Wed 3/26/2008 4:23 PM
>> To: user-java@ibatis.apache.org
>> Subject: Re: iBatis - tomcat JNDI setup
>>  
>> 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" <To...@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
>>> 
>>>  
>>> 
>> 
>> 
> 


RE: iBatis - tomcat JNDI setup

Posted by Tom Henricksen <To...@A-t-g.com>.
I will make a servlet and try that out.

Thanks,
Tom

-----Original Message-----
From: Christopher Lamey [mailto:clamey@localmatters.com] 
Sent: Thursday, March 27, 2008 2:16 PM
To: user-java@ibatis.apache.org
Subject: Re: iBatis - tomcat JNDI setup

Well, that looks good.

At this point, I might code up something outside of iBATIS to verify
that
the JDNI object is really there and working.  Something like this:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
    envCtx.lookup("jdbc/medical");

Connection conn = ds.getConnection();
System.out.println("DB Version : "
    + conn.getMetaData().getDatabaseMajorVersion());
conn.close();

That way you'll know if it's a Tomcat or iBATIS issue.

On 3/27/08 10:18 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:

> This is the sqlmaps config file.
> 
> <?xml version="1.0" ?>
> <!DOCTYPE sqlMapConfig
>   PUBLIC '-//iBATIS.com//DTD SQL Map Config 2.0//EN'
>   'http://www.ibatis.com/dtd/sql-map-config-2.dtd'>
> <sqlMapConfig>
> 
> <properties
> resource="com/advtechgrp/configuration/deployment.properties"/>
> 
> <settings cacheModelsEnabled="false" enhancementEnabled="false"
> lazyLoadingEnabled="false" maxRequests="32" maxSessions="10"
> maxTransactions="5" useStatementNamespaces="true"/>
> 
> 
> <typeAlias alias="DomainReference"
> type="com.advtechgrp.bop.medical.common.DomainReference"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.CharTypeHandler"
> javaType="java.lang.String"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.OffenderCodeTypeHandler"
> javaType="com.advtechgrp.bop.medical.offender.business.OffenderCode"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.SmallIntTypeHandler"
> javaType="java.lang.Short"/>
> 
> <transactionManager type="JDBC">
> <dataSource type="JNDI">
> <property name="DataSource"
> value="java:comp/env/jdbc/medical"/>
> </dataSource>
> </transactionManager>
> 
> <sqlMap
> resource="com/advtechgrp/bop/medical/data/CommonVsp.xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/offender/data/OffenderDef.xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/common/data/admcounter.xml"/>
> <sqlMap
>
resource="com/advtechgrp/bop/medical/activity/data/ActivityFrequencyVsp.
> xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/activity/data/ActivityVsp.xml"/>
> </sqlMapConfig>
> 
> -----Original Message-----
> From: Christopher Lamey [mailto:clamey@localmatters.com]
> Sent: Thursday, March 27, 2008 10:54 AM
> To: user-java@ibatis.apache.org
> Subject: Re: iBatis - tomcat JNDI setup
> 
> That looks to me like iBATIS is trying to create a connection pool
> rather
> than using the one in JNDI.
> 
> Can you send your whole SqlMapConfig.xml?
> 
> On 3/27/08 6:47 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:
> 
>> I tried what you suggested (removing the entry from web.xml and the
>> resource link from the context.xml) and I now get this error message
>> from my application.
>> 
>> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
> of
>> class '' for connect URL 'null'
>> at
>> 
>
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
>> .java:780)
>> at
>> 
>
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
>> va:540)
>> at
>> 
>
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTrans
>> action.java:48)
>> at
>> 
>
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(
>> JdbcTransaction.java:89)
>> at
>> 
>
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
>> ForList(GeneralStatement.java:123)
>> at
>> 
>
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
>> ExecutorDelegate.java:615)
>> 
>> Thanks,
>> Tom
>> 
>> 
>> -----Original Message-----
>> From: Tom Henricksen [mailto:TomH@A-t-g.com]
>> Sent: Wednesday, March 26, 2008 9:09 PM
>> To: user-java@ibatis.apache.org
>> Subject: RE: iBatis - tomcat JNDI setup
>> 
>> I tried following:
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
>> And it has both the context.xml and the entry in the web.xml.
>> I will try without the web.xml and see.
>> 
>> Thanks,
>> Tom
>> 
>> -----Original Message-----
>> From: Christopher Lamey [mailto:clamey@localmatters.com]
>> Sent: Wed 3/26/2008 4:23 PM
>> To: user-java@ibatis.apache.org
>> Subject: Re: iBatis - tomcat JNDI setup
>>  
>> 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" <To...@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
>>> 
>>>  
>>> 
>> 
>> 
> 


Re: iBatis - tomcat JNDI setup

Posted by Christopher Lamey <cl...@localmatters.com>.
Well, that looks good.

At this point, I might code up something outside of iBATIS to verify that
the JDNI object is really there and working.  Something like this:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
    envCtx.lookup("jdbc/medical");

Connection conn = ds.getConnection();
System.out.println("DB Version : "
    + conn.getMetaData().getDatabaseMajorVersion());
conn.close();

That way you'll know if it's a Tomcat or iBATIS issue.

On 3/27/08 10:18 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:

> This is the sqlmaps config file.
> 
> <?xml version="1.0" ?>
> <!DOCTYPE sqlMapConfig
>   PUBLIC '-//iBATIS.com//DTD SQL Map Config 2.0//EN'
>   'http://www.ibatis.com/dtd/sql-map-config-2.dtd'>
> <sqlMapConfig>
> 
> <properties
> resource="com/advtechgrp/configuration/deployment.properties"/>
> 
> <settings cacheModelsEnabled="false" enhancementEnabled="false"
> lazyLoadingEnabled="false" maxRequests="32" maxSessions="10"
> maxTransactions="5" useStatementNamespaces="true"/>
> 
> 
> <typeAlias alias="DomainReference"
> type="com.advtechgrp.bop.medical.common.DomainReference"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.CharTypeHandler"
> javaType="java.lang.String"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.OffenderCodeTypeHandler"
> javaType="com.advtechgrp.bop.medical.offender.business.OffenderCode"/>
> 
> <typeHandler
> callback="com.advtechgrp.bop.medical.common.SmallIntTypeHandler"
> javaType="java.lang.Short"/>
> 
> <transactionManager type="JDBC">
> <dataSource type="JNDI">
> <property name="DataSource"
> value="java:comp/env/jdbc/medical"/>
> </dataSource>
> </transactionManager>
> 
> <sqlMap
> resource="com/advtechgrp/bop/medical/data/CommonVsp.xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/offender/data/OffenderDef.xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/common/data/admcounter.xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/activity/data/ActivityFrequencyVsp.
> xml"/>
> <sqlMap
> resource="com/advtechgrp/bop/medical/activity/data/ActivityVsp.xml"/>
> </sqlMapConfig>
> 
> -----Original Message-----
> From: Christopher Lamey [mailto:clamey@localmatters.com]
> Sent: Thursday, March 27, 2008 10:54 AM
> To: user-java@ibatis.apache.org
> Subject: Re: iBatis - tomcat JNDI setup
> 
> That looks to me like iBATIS is trying to create a connection pool
> rather
> than using the one in JNDI.
> 
> Can you send your whole SqlMapConfig.xml?
> 
> On 3/27/08 6:47 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:
> 
>> I tried what you suggested (removing the entry from web.xml and the
>> resource link from the context.xml) and I now get this error message
>> from my application.
>> 
>> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
> of
>> class '' for connect URL 'null'
>> at
>> 
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
>> .java:780)
>> at
>> 
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
>> va:540)
>> at
>> 
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTrans
>> action.java:48)
>> at
>> 
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(
>> JdbcTransaction.java:89)
>> at
>> 
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
>> ForList(GeneralStatement.java:123)
>> at
>> 
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
>> ExecutorDelegate.java:615)
>> 
>> Thanks,
>> Tom
>> 
>> 
>> -----Original Message-----
>> From: Tom Henricksen [mailto:TomH@A-t-g.com]
>> Sent: Wednesday, March 26, 2008 9:09 PM
>> To: user-java@ibatis.apache.org
>> Subject: RE: iBatis - tomcat JNDI setup
>> 
>> I tried following:
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
>> And it has both the context.xml and the entry in the web.xml.
>> I will try without the web.xml and see.
>> 
>> Thanks,
>> Tom
>> 
>> -----Original Message-----
>> From: Christopher Lamey [mailto:clamey@localmatters.com]
>> Sent: Wed 3/26/2008 4:23 PM
>> To: user-java@ibatis.apache.org
>> Subject: Re: iBatis - tomcat JNDI setup
>>  
>> 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" <To...@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
>>> 
>>>  
>>> 
>> 
>> 
> 


RE: iBatis - tomcat JNDI setup

Posted by Tom Henricksen <To...@A-t-g.com>.
This is the sqlmaps config file.

<?xml version="1.0" ?>
<!DOCTYPE sqlMapConfig
  PUBLIC '-//iBATIS.com//DTD SQL Map Config 2.0//EN'
  'http://www.ibatis.com/dtd/sql-map-config-2.dtd'>
<sqlMapConfig>

	<properties
resource="com/advtechgrp/configuration/deployment.properties"/>

	<settings cacheModelsEnabled="false" enhancementEnabled="false"
lazyLoadingEnabled="false" maxRequests="32" maxSessions="10"
maxTransactions="5" useStatementNamespaces="true"/>


	<typeAlias alias="DomainReference"
type="com.advtechgrp.bop.medical.common.DomainReference"/>

	<typeHandler
callback="com.advtechgrp.bop.medical.common.CharTypeHandler"
javaType="java.lang.String"/>

	<typeHandler
callback="com.advtechgrp.bop.medical.common.OffenderCodeTypeHandler"
javaType="com.advtechgrp.bop.medical.offender.business.OffenderCode"/>

	<typeHandler
callback="com.advtechgrp.bop.medical.common.SmallIntTypeHandler"
javaType="java.lang.Short"/>

	<transactionManager type="JDBC">
		<dataSource type="JNDI">
			<property name="DataSource"
value="java:comp/env/jdbc/medical"/>
		</dataSource>
	</transactionManager>
	
	<sqlMap
resource="com/advtechgrp/bop/medical/data/CommonVsp.xml"/>
	<sqlMap
resource="com/advtechgrp/bop/medical/offender/data/OffenderDef.xml"/>
	<sqlMap
resource="com/advtechgrp/bop/medical/common/data/admcounter.xml"/>
	<sqlMap
resource="com/advtechgrp/bop/medical/activity/data/ActivityFrequencyVsp.
xml"/>
	<sqlMap
resource="com/advtechgrp/bop/medical/activity/data/ActivityVsp.xml"/>
</sqlMapConfig>

-----Original Message-----
From: Christopher Lamey [mailto:clamey@localmatters.com] 
Sent: Thursday, March 27, 2008 10:54 AM
To: user-java@ibatis.apache.org
Subject: Re: iBatis - tomcat JNDI setup

That looks to me like iBATIS is trying to create a connection pool
rather
than using the one in JNDI.

Can you send your whole SqlMapConfig.xml?

On 3/27/08 6:47 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:

> I tried what you suggested (removing the entry from web.xml and the
> resource link from the context.xml) and I now get this error message
> from my application.
> 
> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of
> class '' for connect URL 'null'
> at
>
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
> .java:780)
> at
>
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
> va:540)
> at
>
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTrans
> action.java:48)
> at
>
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(
> JdbcTransaction.java:89)
> at
>
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> ForList(GeneralStatement.java:123)
> at
>
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
> ExecutorDelegate.java:615)
> 
> Thanks,
> Tom
> 
> 
> -----Original Message-----
> From: Tom Henricksen [mailto:TomH@A-t-g.com]
> Sent: Wednesday, March 26, 2008 9:09 PM
> To: user-java@ibatis.apache.org
> Subject: RE: iBatis - tomcat JNDI setup
> 
> I tried following:
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
> And it has both the context.xml and the entry in the web.xml.
> I will try without the web.xml and see.
> 
> Thanks,
> Tom
> 
> -----Original Message-----
> From: Christopher Lamey [mailto:clamey@localmatters.com]
> Sent: Wed 3/26/2008 4:23 PM
> To: user-java@ibatis.apache.org
> Subject: Re: iBatis - tomcat JNDI setup
>  
> 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" <To...@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
>> 
>>  
>> 
> 
> 


Re: iBatis - tomcat JNDI setup

Posted by Christopher Lamey <cl...@localmatters.com>.
That looks to me like iBATIS is trying to create a connection pool rather
than using the one in JNDI.

Can you send your whole SqlMapConfig.xml?

On 3/27/08 6:47 AM, "Tom Henricksen" <To...@A-t-g.com> wrote:

> I tried what you suggested (removing the entry from web.xml and the
> resource link from the context.xml) and I now get this error message
> from my application.
> 
> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
> class '' for connect URL 'null'
> at
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
> .java:780)
> at
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
> va:540)
> at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTrans
> action.java:48)
> at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(
> JdbcTransaction.java:89)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> ForList(GeneralStatement.java:123)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
> ExecutorDelegate.java:615)
> 
> Thanks,
> Tom
> 
> 
> -----Original Message-----
> From: Tom Henricksen [mailto:TomH@A-t-g.com]
> Sent: Wednesday, March 26, 2008 9:09 PM
> To: user-java@ibatis.apache.org
> Subject: RE: iBatis - tomcat JNDI setup
> 
> I tried following:
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
> And it has both the context.xml and the entry in the web.xml.
> I will try without the web.xml and see.
> 
> Thanks,
> Tom
> 
> -----Original Message-----
> From: Christopher Lamey [mailto:clamey@localmatters.com]
> Sent: Wed 3/26/2008 4:23 PM
> To: user-java@ibatis.apache.org
> Subject: Re: iBatis - tomcat JNDI setup
>  
> 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" <To...@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
>> 
>>  
>> 
> 
> 


RE: iBatis - tomcat JNDI setup

Posted by Tom Henricksen <To...@A-t-g.com>.
I tried what you suggested (removing the entry from web.xml and the
resource link from the context.xml) and I now get this error message
from my application.

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null'
	at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:780)
	at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:540)
	at
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTrans
action.java:48)
	at
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(
JdbcTransaction.java:89)
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
ForList(GeneralStatement.java:123)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:615)

Thanks,
Tom


-----Original Message-----
From: Tom Henricksen [mailto:TomH@A-t-g.com] 
Sent: Wednesday, March 26, 2008 9:09 PM
To: user-java@ibatis.apache.org
Subject: RE: iBatis - tomcat JNDI setup

I tried following:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
And it has both the context.xml and the entry in the web.xml.
I will try without the web.xml and see.

Thanks,
Tom

-----Original Message-----
From: Christopher Lamey [mailto:clamey@localmatters.com]
Sent: Wed 3/26/2008 4:23 PM
To: user-java@ibatis.apache.org
Subject: Re: iBatis - tomcat JNDI setup
 
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" <To...@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
> 
>  
> 



RE: iBatis - tomcat JNDI setup

Posted by Tom Henricksen <To...@A-t-g.com>.
I tried following:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
And it has both the context.xml and the entry in the web.xml.
I will try without the web.xml and see.

Thanks,
Tom

-----Original Message-----
From: Christopher Lamey [mailto:clamey@localmatters.com]
Sent: Wed 3/26/2008 4:23 PM
To: user-java@ibatis.apache.org
Subject: Re: iBatis - tomcat JNDI setup
 
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" <To...@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
> 
>  
> 



Re: iBatis - tomcat JNDI setup

Posted by Christopher Lamey <cl...@localmatters.com>.
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" <To...@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
> 
>  
>