You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Garth Keesler <ga...@gdcjk.com> on 2007/01/20 19:47:26 UTC

TC 5.5.20 Config

According to this website:

http://wiki.apache.org/tomcat/UsingDataSources

All I have to do is add a context.xml file like this to the web service:

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

<Context>

    <Resource name="jdbc/MyDB" auth="Container" type="javax.sql.DataSource"
              username="user" password="password"
          url="jdbc:postgresql://pgsrv:5432/TTNA"
              factory="org.apache.commons.dbcp.BasicDataSourceFactory"
              driverClassName="org.postgresql.Driver"
              maxActive="20" maxIdle="10"/>

</Context>

And a few changes to the java that connects like this:

        InitialContext ic = new InitialContext();
        DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/MyDB");
        Connection db = ds.getConnection();

and all ought to work great. Unfortunately, like most other examples out 
there, it probably assumes more knowledge on the part of the noob trying 
it for the first time than it should.

What I see is when all should work is this:

Sat Jan 20 12:15:36 CST 2007 - exception returned from call to Vendor: e 
= java.lang.RuntimeException: Error in Vendor.Save: 
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

There are plenty of discussions about this particular error on the web 
but most of them indicate that other xml files need to be modified as 
well, like server.xml and web.xml.

Any help greatly appreciated...

Thanx,
Garth


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: TC 5.5.20 Config

Posted by Garth Keesler <ga...@gdcjk.com>.
Thanx for the feedback. I'll give it a try and post any interesting results.

As to which docs to start with, I pretty much always start with the 
official and then to sites that provide additional info based on the 
official. I usually don't wander unless I'm not getting anywhere, as was 
the case this time.

Again, thanx for the quick reply.

Garth

Craig McClanahan wrote:
> On 1/20/07, Garth Keesler <ga...@gdcjk.com> wrote:
>>
>> This email concerns the deployment of DBCP in a TC 5.5.20 site. The
>> subject was poorly chosen.
>>
>> Sorry...
>
>
> Actually, I suspect that the subject line *is* pretty accurate :-).
>
> * As an off topic comment, I would generally start with the official
> documentation
>  on a feature before going to the wiki.  In this case, check out
>  <http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html>,
>  in particular the section on JDBC data sources.
>
> * I have seen on a variety of forums where people have had problems
>  in Tomcat 5.5.20 with JNDI configurations that worked fine on Tomcat
> 5.5.17.
>  This implies some issue with Tomcat, which means you would likely be
>  better off addressing this to the Tomcat Users mailing list.  But in the
> mean
>  time, you might try back-reving your Tomcat install and see if that 
> helps.
>
> Craig
>
>
> Garth Keesler wrote:
>> > According to this website:
>> >
>> > http://wiki.apache.org/tomcat/UsingDataSources
>> >
>> > All I have to do is add a context.xml file like this to the web 
>> service:
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> >
>> > <Context>
>> >
>> >    <Resource name="jdbc/MyDB" auth="Container"
>> > type="javax.sql.DataSource"
>> >              username="user" password="password"
>> >          url="jdbc:postgresql://pgsrv:5432/TTNA"
>> >              factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>> >              driverClassName="org.postgresql.Driver"
>> >              maxActive="20" maxIdle="10"/>
>> >
>> > </Context>
>> >
>> > And a few changes to the java that connects like this:
>> >
>> >        InitialContext ic = new InitialContext();
>> >        DataSource ds = (DataSource) ic.lookup
>> ("java:comp/env/jdbc/MyDB");
>> >        Connection db = ds.getConnection();
>> >
>> > and all ought to work great. Unfortunately, like most other examples
>> > out there, it probably assumes more knowledge on the part of the noob
>> > trying it for the first time than it should.
>> >
>> > What I see is when all should work is this:
>> >
>> > Sat Jan 20 12:15:36 CST 2007 - exception returned from call to Vendor:
>> > e = java.lang.RuntimeException: Error in Vendor.Save:
>> > javax.naming.NameNotFoundException: Name jdbc is not bound in this
>> > Context
>> >
>> > There are plenty of discussions about this particular error on the web
>> > but most of them indicate that other xml files need to be modified as
>> > well, like server.xml and web.xml.
>> >
>> > Any help greatly appreciated...
>> >
>> > Thanx,
>> > Garth
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
>> >
>> >
>> > .
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: TC 5.5.20 Config

Posted by Craig McClanahan <cr...@apache.org>.
On 1/20/07, Garth Keesler <ga...@gdcjk.com> wrote:
>
> This email concerns the deployment of DBCP in a TC 5.5.20 site. The
> subject was poorly chosen.
>
> Sorry...


Actually, I suspect that the subject line *is* pretty accurate :-).

* As an off topic comment, I would generally start with the official
documentation
  on a feature before going to the wiki.  In this case, check out
  <http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html>,
  in particular the section on JDBC data sources.

* I have seen on a variety of forums where people have had problems
  in Tomcat 5.5.20 with JNDI configurations that worked fine on Tomcat
5.5.17.
  This implies some issue with Tomcat, which means you would likely be
  better off addressing this to the Tomcat Users mailing list.  But in the
mean
  time, you might try back-reving your Tomcat install and see if that helps.

Craig


Garth Keesler wrote:
> > According to this website:
> >
> > http://wiki.apache.org/tomcat/UsingDataSources
> >
> > All I have to do is add a context.xml file like this to the web service:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <Context>
> >
> >    <Resource name="jdbc/MyDB" auth="Container"
> > type="javax.sql.DataSource"
> >              username="user" password="password"
> >          url="jdbc:postgresql://pgsrv:5432/TTNA"
> >              factory="org.apache.commons.dbcp.BasicDataSourceFactory"
> >              driverClassName="org.postgresql.Driver"
> >              maxActive="20" maxIdle="10"/>
> >
> > </Context>
> >
> > And a few changes to the java that connects like this:
> >
> >        InitialContext ic = new InitialContext();
> >        DataSource ds = (DataSource) ic.lookup
> ("java:comp/env/jdbc/MyDB");
> >        Connection db = ds.getConnection();
> >
> > and all ought to work great. Unfortunately, like most other examples
> > out there, it probably assumes more knowledge on the part of the noob
> > trying it for the first time than it should.
> >
> > What I see is when all should work is this:
> >
> > Sat Jan 20 12:15:36 CST 2007 - exception returned from call to Vendor:
> > e = java.lang.RuntimeException: Error in Vendor.Save:
> > javax.naming.NameNotFoundException: Name jdbc is not bound in this
> > Context
> >
> > There are plenty of discussions about this particular error on the web
> > but most of them indicate that other xml files need to be modified as
> > well, like server.xml and web.xml.
> >
> > Any help greatly appreciated...
> >
> > Thanx,
> > Garth
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> > .
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Re: TC 5.5.20 Config

Posted by Garth Keesler <ga...@gdcjk.com>.
This email concerns the deployment of DBCP in a TC 5.5.20 site. The 
subject was poorly chosen.

Sorry...

Garth Keesler wrote:
> According to this website:
>
> http://wiki.apache.org/tomcat/UsingDataSources
>
> All I have to do is add a context.xml file like this to the web service:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <Context>
>
>    <Resource name="jdbc/MyDB" auth="Container" 
> type="javax.sql.DataSource"
>              username="user" password="password"
>          url="jdbc:postgresql://pgsrv:5432/TTNA"
>              factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>              driverClassName="org.postgresql.Driver"
>              maxActive="20" maxIdle="10"/>
>
> </Context>
>
> And a few changes to the java that connects like this:
>
>        InitialContext ic = new InitialContext();
>        DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/MyDB");
>        Connection db = ds.getConnection();
>
> and all ought to work great. Unfortunately, like most other examples 
> out there, it probably assumes more knowledge on the part of the noob 
> trying it for the first time than it should.
>
> What I see is when all should work is this:
>
> Sat Jan 20 12:15:36 CST 2007 - exception returned from call to Vendor: 
> e = java.lang.RuntimeException: Error in Vendor.Save: 
> javax.naming.NameNotFoundException: Name jdbc is not bound in this 
> Context
>
> There are plenty of discussions about this particular error on the web 
> but most of them indicate that other xml files need to be modified as 
> well, like server.xml and web.xml.
>
> Any help greatly appreciated...
>
> Thanx,
> Garth
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
> .
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org