tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guofeng Zhang <guof...@radvision.com>
Subject RE: Using tomcat7-maven-plugin- 2.0-beta-1: java.lang.RuntimeException: Name jdbc is not bound in this Context
Date Fri, 09 Mar 2012 10:55:47 GMT
I created an issue following the link you given, but I do no find where to attach the sample
to reproduce it. I attached in this mail. You need to change the username and password for
database connection in server.xml.

Using <contextFile> (i remove the resource from server.xml and define one in context.xml)
does not solve it.

I met a strange case when trying the plugin:
   If I place serer.xml in tomcatconf directory and also configure it using <serverXml>,
it seems that the web app is not started (not initialized). You can reproduce it using the
attached project.


-----Original Message-----
From: Olivier Lamy [mailto:olamy@apache.org] 
Sent: Wednesday, March 07, 2012 9:40 PM
To: Tomcat Users List
Subject: Re: Using tomcat7-maven-plugin- 2.0-beta-1: java.lang.RuntimeException: Name jdbc
is not bound in this Context

Hello
Sounds like an issue.
It will be really lovely if you could create a sample project to reproduce that and attach
it to a new issue here:
https://issues.apache.org/jira/browse/MTOMCAT

BTW does that work using a context file tru the configuration <contextFile>${tomcatContextXml}</contextFile>
(and not with a server.xml file I mean nothing in src\main\tomcatconf ) ?


Thanks,

2012/3/7 Guofeng Zhang <guofeng@radvision.com>:
> Hi,
>
> I try tomcat7-maven-plugin/2.0-beta-1. When I use "mvn tomcat7:run" to launch my app,
I got:
>  javax.naming.NameNotFoundException: Name jdbc is not bound in this 
> Context
>
> I configured the datatsource as global naming datasource in 
> server.xml,
>  <GlobalNamingResources>
> <Resource
>       auth="Container"
>       maxPoolSize="100" minPoolSize="10"
>       name="jdbc/iviewDS"
>       testQuery="select count(*) from T_ROLE"
>       factory="......"
>       type="javax.sql.DataSource"
>       uniqueResourceName="jdbc/iviewDS"/>
>
> The server.xml is copied to src\main\tomcatconf, (this also copyied by the plugin to
target\tomcat\conf, so it is used).
>
> then in webapp/META-INF/context.xml, I have:
>   <ResourceLink
>        name="jdbc/iviewDS"
>        global="jdbc/iviewDS"
>        type="javax.sql.DataSource"
>    />
>
> And in web.xml:
>                <resource-ref>
>                                <description>datasoruce</description>
>                                
> <res-ref-name>jdbc/iviewDS</res-ref-name>
>                                
> <res-type>javax.sql.DataSource</res-type>
>                                <res-auth>Container</res-auth>
>                </resource-ref>
> In my code, I lookup the datasource using 'java:/comp/env/jdbc/iviewDS'.
>
> This works well when I deploy the app into tomcat/app directory.
>
> How to solve the issue when use the plugin?
>
> Thanks
>
> Guofeng
>
>



--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message