You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mighty Tornado <mi...@gmail.com> on 2009/04/01 03:36:06 UTC

DataSource from Context files - doesn't work

Hi I placed the following in context.xml in META-INF.
But the result set is null, what's wrong with my set up?Can anybody please
advise?

<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource
    auth="Container"
    description="DB Connection"
    name="jdbc/vhousehold"
    type="javax.sql.DataSource"
    password="vhousehold"
    driverClassName="com.mysql.jdbc.Driver"
    maxIdle="2"
    maxWait="5000"
    validationQuery="select * from family_member;"
    username="vhousehold"
    url="jdbc:mysql://localhost:3306/vhousehold"
    maxActive="4"/>
</Context>

Thanks,

Ramy.

Re: DataSource from Context files - doesn't work

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ramy,

Ugh... I wrote a longer reply and did something stupid with it
(fat-fingered the keyboard... something over by the ENTER/SHIFT/UP keys
and the message just disappeared). You're getting the short-short version.

On 3/31/2009 9:36 PM, Mighty Tornado wrote:
>     validationQuery="select * from family_member;"

This sucks. Use validationQuery="/* PING */SELECT 1" instead.

Your stack trace doesn't include what actually happened, which others
have pointed out. You say that it's not happening anymore and is
probably old. I suspect an NPE because...

> InitialContext ic = new InitialContext();
> 
> if(ic == null)
> {
> System.out.println("context not found");
> }

You don't abort the operation at this point. ic.lookup() will still
execute, but ic is null, so you get an NPE. You should do something like
throw an exception or even return null (or an empty list or whatever is
appropriate).

> DataSource ds =
> (DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");
> 
> if(ds == null)
> {
> System.out.println("DataSource not found");
> }

Same here. If your DataSource is null, you still call getConnection() on
it. NPE.

> conn = ds.getConnection();
> 
> stat = conn.createStatement();
> 
> rs = stat.executeQuery("SELECT * FROM family_member ");

So, rs is null at this point? Are you sure it's rs and not something
like ic or ds? Try adding logging statements after each "real" line of
code and print out the values of these five local variables: ic, ds,
conn, stat, rs.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAknTYOAACgkQ9CaO5/Lv0PDmgACgsplbJtueEOrON9WQ/IJ04Xcc
OcQAoImb6KgWR1Csb2DjG1v7GkY3LJbP
=qc6f
-----END PGP SIGNATURE-----

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


Re: DataSource from Context files - doesn't work

Posted by Gregor Schneider <rc...@googlemail.com>.
If you haven't specified a console-logger:

catalina.out

Rgds

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available
@ http://pgpkeys.pca.dfn.de:11371
@ http://pgp.mit.edu:11371/

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


Re: DataSource from Context files - doesn't work

Posted by Mighty Tornado <mi...@gmail.com>.
Trying to put in some logging statements.
Can anyone suggest where System.out prints to?

I don't see it in any of the logs.

On Wed, Apr 1, 2009 at 8:47 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ramy,
>
> (Hey! I found my original message. Here's a bit more detail on the
> validationQuery)
>
> On 3/31/2009 9:36 PM, Mighty Tornado wrote:
> > Hi I placed the following in context.xml in META-INF.
> > But the result set is null, what's wrong with my set up? Can anybody
> please
> > advise?
>
> As others have suggested, your exception does not include the important
> part: what actually happened. We only got a piece of what happened. You
> say that it's an old exception so maybe it's unrelated.
>
> Let's take a look at your configuration:
>
> >     validationQuery="select * from family_member;"
>
> Yikes! A complete table-scan for each validation query? I would
> recommend something like "/* PING */ SELECT 1" where the database
> doesn't have to do any work to fulfill the query. Remember, the
> validation query just checks to see if communication with the database
> is still working. It's not intended to return any actual data.
>
> Other than that, your configuration looks good. It appears to be
> working, so you're probably fine.
>
> (See my other message with comments on your code)
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAknTYkYACgkQ9CaO5/Lv0PArVwCeNrLv9Z57uFqpM6i9c4OU4AmD
> sJYAoK6l6VD93NAjvDEhxkBPWDtJDk0T
> =mdTH
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: DataSource from Context files - doesn't work

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ramy,

(Hey! I found my original message. Here's a bit more detail on the
validationQuery)

On 3/31/2009 9:36 PM, Mighty Tornado wrote:
> Hi I placed the following in context.xml in META-INF.
> But the result set is null, what's wrong with my set up? Can anybody please
> advise?

As others have suggested, your exception does not include the important
part: what actually happened. We only got a piece of what happened. You
say that it's an old exception so maybe it's unrelated.

Let's take a look at your configuration:

>     validationQuery="select * from family_member;"

Yikes! A complete table-scan for each validation query? I would
recommend something like "/* PING */ SELECT 1" where the database
doesn't have to do any work to fulfill the query. Remember, the
validation query just checks to see if communication with the database
is still working. It's not intended to return any actual data.

Other than that, your configuration looks good. It appears to be
working, so you're probably fine.

(See my other message with comments on your code)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAknTYkYACgkQ9CaO5/Lv0PArVwCeNrLv9Z57uFqpM6i9c4OU4AmD
sJYAoK6l6VD93NAjvDEhxkBPWDtJDk0T
=mdTH
-----END PGP SIGNATURE-----

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


Re: DataSource from Context files - doesn't work

Posted by Mighty Tornado <mi...@gmail.com>.
No Exception there. Even after I restart the server and call the Servlet
that is supposed to retrieve the DB data.

On Wed, Apr 1, 2009 at 6:24 AM, Yassine <el...@users.sourceforge.net>wrote:

> catalina.out
>
>
> On Wed, Apr 1, 2009 at 12:17 PM, Mighty Tornado
> <mi...@gmail.com> wrote:
> > I have the following files in the logs directory:
> >
> > admin.2009-04-01.log
> > catalina.out
> > localhost.2009-04-01.log
> > catalina.2009-04-01.log
> > host-manager.2009-04-01.log
> > manager.2009-04-01.log
> >
> > Which one of them should I VI or LESS to find the complete stack trace
> for
> > the exception?
> >
> > Also, is there something obviously wrong with my context definition or
> > reference? I followed the Tomcat online tutorial to define them.
> > Also, previously a regular JDBC code with the same parameters was able to
> > access the DB and retrieve the data correctly.
> >
> > Thank you all.
> >
> > On Wed, Apr 1, 2009 at 6:09 AM, Yassine <elassad@users.sourceforge.net
> >wrote:
> >
> >> don't "tail -f"
> >> use less and copy the part containing the exception from its beginning
> >> to the end.
> >>
> >>
> >>
> >> On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
> >> <mi...@gmail.com> wrote:
> >> > Where can I obtain it?
> >> > The exception that I posted is the only exception that showed up
> >> following
> >> > "tail -f *"
> >> >
> >> > On Wed, Apr 1, 2009 at 6:04 AM, Gregor <rc...@googlemail.com> wrote:
> >> >
> >> >> your log is useless.
> >> >> please post the complete stacktrace incl. the type of the exception
> >> >>
> >> >> rds
> >> >>
> >> >> gregor
> >> >>
> >> >> Am 01.04.2009 um 11:57 schrieb Mighty Tornado <
> mighty.tornado@gmail.com
> >> >:
> >> >>
> >> >>
> >> >>  Additional info:
> >> >>>
> >> >>> I get the following exception in the log when I start the server up:
> >> >>>
> >> >>> ==> localhost.2009-03-03.log <==
> >> >>>   at
> >> >>>
> >> >>>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> >> >>>   at
> >> >>>
> >> >>>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> >> >>>   at
> >> >>>
> >> >>>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> >> >>>   at
> >> >>>
> >> >>>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >> >>>   at
> >> >>>
> >> >>>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >> >>>   at
> >> >>>
> >> >>>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> >> >>>   at
> >> >>>
> >>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> >> >>>   at
> >> >>>
> >> >>>
> >>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> >> >>>   at
> >> >>>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> >> >>>   at java.lang.Thread.run(Thread.java:613)
> >> >>>
> >> >>>
> >> >>>
> >> >>> I use the following code to get the connection:
> >> >>>
> >> >>> InitialContext ic = new InitialContext();
> >> >>>
> >> >>>           if(ic == null)
> >> >>>           {
> >> >>>               System.out.println("context not found");
> >> >>>           }
> >> >>>
> >> >>>           DataSource ds =
> >> >>> (DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");
> >> >>>
> >> >>>           if(ds == null)
> >> >>>           {
> >> >>>               System.out.println("DataSource not found");
> >> >>>           }
> >> >>>
> >> >>>           conn = ds.getConnection();
> >> >>>
> >> >>>           stat = conn.createStatement();
> >> >>>
> >> >>>           rs = stat.executeQuery("SELECT * FROM family_member ");
> >> >>>
> >> >>> On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado <
> >> mighty.tornado@gmail.com
> >> >>> >wrote:
> >> >>>
> >> >>>  Hi I placed the following in context.xml in META-INF.
> >> >>>> But the result set is null, what's wrong with my set up?Can anybody
> >> >>>> please
> >> >>>> advise?
> >> >>>>
> >> >>>> <?xml version="1.0" encoding="UTF-8"?>
> >> >>>> <Context>
> >> >>>> <Resource
> >> >>>>   auth="Container"
> >> >>>>   description="DB Connection"
> >> >>>>   name="jdbc/vhousehold"
> >> >>>>   type="javax.sql.DataSource"
> >> >>>>   password="vhousehold"
> >> >>>>   driverClassName="com.mysql.jdbc.Driver"
> >> >>>>   maxIdle="2"
> >> >>>>   maxWait="5000"
> >> >>>>   validationQuery="select * from family_member;"
> >> >>>>   username="vhousehold"
> >> >>>>   url="jdbc:mysql://localhost:3306/vhousehold"
> >> >>>>   maxActive="4"/>
> >> >>>> </Context>
> >> >>>>
> >> >>>> Thanks,
> >> >>>>
> >> >>>> Ramy.
> >> >>>>
> >> >>>>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >> >>
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> --
> >> Yassine Elassad
> >> Bonn, Germany.
> >> Fon : +49 228 97629355
> >> Mobile : +49 157 74519666
> >>
> >> PEACE :
> >> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
>
>
> --
> --
> Yassine Elassad
> Bonn, Germany.
> Fon : +49 228 97629355
> Mobile : +49 157 74519666
>
> PEACE :
> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: DataSource from Context files - doesn't work

Posted by Yassine <el...@users.sourceforge.net>.
catalina.out


On Wed, Apr 1, 2009 at 12:17 PM, Mighty Tornado
<mi...@gmail.com> wrote:
> I have the following files in the logs directory:
>
> admin.2009-04-01.log
> catalina.out
> localhost.2009-04-01.log
> catalina.2009-04-01.log
> host-manager.2009-04-01.log
> manager.2009-04-01.log
>
> Which one of them should I VI or LESS to find the complete stack trace for
> the exception?
>
> Also, is there something obviously wrong with my context definition or
> reference? I followed the Tomcat online tutorial to define them.
> Also, previously a regular JDBC code with the same parameters was able to
> access the DB and retrieve the data correctly.
>
> Thank you all.
>
> On Wed, Apr 1, 2009 at 6:09 AM, Yassine <el...@users.sourceforge.net>wrote:
>
>> don't "tail -f"
>> use less and copy the part containing the exception from its beginning
>> to the end.
>>
>>
>>
>> On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
>> <mi...@gmail.com> wrote:
>> > Where can I obtain it?
>> > The exception that I posted is the only exception that showed up
>> following
>> > "tail -f *"
>> >
>> > On Wed, Apr 1, 2009 at 6:04 AM, Gregor <rc...@googlemail.com> wrote:
>> >
>> >> your log is useless.
>> >> please post the complete stacktrace incl. the type of the exception
>> >>
>> >> rds
>> >>
>> >> gregor
>> >>
>> >> Am 01.04.2009 um 11:57 schrieb Mighty Tornado <mighty.tornado@gmail.com
>> >:
>> >>
>> >>
>> >>  Additional info:
>> >>>
>> >>> I get the following exception in the log when I start the server up:
>> >>>
>> >>> ==> localhost.2009-03-03.log <==
>> >>>   at
>> >>>
>> >>>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> >>>   at
>> >>>
>> >>>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>> >>>   at
>> >>>
>> >>>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>> >>>   at
>> >>>
>> >>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> >>>   at
>> >>>
>> >>>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> >>>   at
>> >>>
>> >>>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>> >>>   at
>> >>>
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>> >>>   at
>> >>>
>> >>>
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>> >>>   at
>> >>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>> >>>   at java.lang.Thread.run(Thread.java:613)
>> >>>
>> >>>
>> >>>
>> >>> I use the following code to get the connection:
>> >>>
>> >>> InitialContext ic = new InitialContext();
>> >>>
>> >>>           if(ic == null)
>> >>>           {
>> >>>               System.out.println("context not found");
>> >>>           }
>> >>>
>> >>>           DataSource ds =
>> >>> (DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");
>> >>>
>> >>>           if(ds == null)
>> >>>           {
>> >>>               System.out.println("DataSource not found");
>> >>>           }
>> >>>
>> >>>           conn = ds.getConnection();
>> >>>
>> >>>           stat = conn.createStatement();
>> >>>
>> >>>           rs = stat.executeQuery("SELECT * FROM family_member ");
>> >>>
>> >>> On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado <
>> mighty.tornado@gmail.com
>> >>> >wrote:
>> >>>
>> >>>  Hi I placed the following in context.xml in META-INF.
>> >>>> But the result set is null, what's wrong with my set up?Can anybody
>> >>>> please
>> >>>> advise?
>> >>>>
>> >>>> <?xml version="1.0" encoding="UTF-8"?>
>> >>>> <Context>
>> >>>> <Resource
>> >>>>   auth="Container"
>> >>>>   description="DB Connection"
>> >>>>   name="jdbc/vhousehold"
>> >>>>   type="javax.sql.DataSource"
>> >>>>   password="vhousehold"
>> >>>>   driverClassName="com.mysql.jdbc.Driver"
>> >>>>   maxIdle="2"
>> >>>>   maxWait="5000"
>> >>>>   validationQuery="select * from family_member;"
>> >>>>   username="vhousehold"
>> >>>>   url="jdbc:mysql://localhost:3306/vhousehold"
>> >>>>   maxActive="4"/>
>> >>>> </Context>
>> >>>>
>> >>>> Thanks,
>> >>>>
>> >>>> Ramy.
>> >>>>
>> >>>>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> --
>> Yassine Elassad
>> Bonn, Germany.
>> Fon : +49 228 97629355
>> Mobile : +49 157 74519666
>>
>> PEACE :
>> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>



-- 
--
Yassine Elassad
Bonn, Germany.
Fon : +49 228 97629355
Mobile : +49 157 74519666

PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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


Re: DataSource from Context files - doesn't work

Posted by Mighty Tornado <mi...@gmail.com>.
I have the following files in the logs directory:

admin.2009-04-01.log
catalina.out
localhost.2009-04-01.log
catalina.2009-04-01.log
host-manager.2009-04-01.log
manager.2009-04-01.log

Which one of them should I VI or LESS to find the complete stack trace for
the exception?

Also, is there something obviously wrong with my context definition or
reference? I followed the Tomcat online tutorial to define them.
Also, previously a regular JDBC code with the same parameters was able to
access the DB and retrieve the data correctly.

Thank you all.

On Wed, Apr 1, 2009 at 6:09 AM, Yassine <el...@users.sourceforge.net>wrote:

> don't "tail -f"
> use less and copy the part containing the exception from its beginning
> to the end.
>
>
>
> On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
> <mi...@gmail.com> wrote:
> > Where can I obtain it?
> > The exception that I posted is the only exception that showed up
> following
> > "tail -f *"
> >
> > On Wed, Apr 1, 2009 at 6:04 AM, Gregor <rc...@googlemail.com> wrote:
> >
> >> your log is useless.
> >> please post the complete stacktrace incl. the type of the exception
> >>
> >> rds
> >>
> >> gregor
> >>
> >> Am 01.04.2009 um 11:57 schrieb Mighty Tornado <mighty.tornado@gmail.com
> >:
> >>
> >>
> >>  Additional info:
> >>>
> >>> I get the following exception in the log when I start the server up:
> >>>
> >>> ==> localhost.2009-03-03.log <==
> >>>   at
> >>>
> >>>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> >>>   at
> >>>
> >>>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> >>>   at
> >>>
> >>>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> >>>   at
> >>>
> >>>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >>>   at
> >>>
> >>>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >>>   at
> >>>
> >>>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> >>>   at
> >>>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> >>>   at
> >>>
> >>>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> >>>   at
> >>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> >>>   at java.lang.Thread.run(Thread.java:613)
> >>>
> >>>
> >>>
> >>> I use the following code to get the connection:
> >>>
> >>> InitialContext ic = new InitialContext();
> >>>
> >>>           if(ic == null)
> >>>           {
> >>>               System.out.println("context not found");
> >>>           }
> >>>
> >>>           DataSource ds =
> >>> (DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");
> >>>
> >>>           if(ds == null)
> >>>           {
> >>>               System.out.println("DataSource not found");
> >>>           }
> >>>
> >>>           conn = ds.getConnection();
> >>>
> >>>           stat = conn.createStatement();
> >>>
> >>>           rs = stat.executeQuery("SELECT * FROM family_member ");
> >>>
> >>> On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado <
> mighty.tornado@gmail.com
> >>> >wrote:
> >>>
> >>>  Hi I placed the following in context.xml in META-INF.
> >>>> But the result set is null, what's wrong with my set up?Can anybody
> >>>> please
> >>>> advise?
> >>>>
> >>>> <?xml version="1.0" encoding="UTF-8"?>
> >>>> <Context>
> >>>> <Resource
> >>>>   auth="Container"
> >>>>   description="DB Connection"
> >>>>   name="jdbc/vhousehold"
> >>>>   type="javax.sql.DataSource"
> >>>>   password="vhousehold"
> >>>>   driverClassName="com.mysql.jdbc.Driver"
> >>>>   maxIdle="2"
> >>>>   maxWait="5000"
> >>>>   validationQuery="select * from family_member;"
> >>>>   username="vhousehold"
> >>>>   url="jdbc:mysql://localhost:3306/vhousehold"
> >>>>   maxActive="4"/>
> >>>> </Context>
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Ramy.
> >>>>
> >>>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
>
>
> --
> --
> Yassine Elassad
> Bonn, Germany.
> Fon : +49 228 97629355
> Mobile : +49 157 74519666
>
> PEACE :
> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: DataSource from Context files - doesn't work

Posted by Yassine <el...@users.sourceforge.net>.
don't "tail -f"
use less and copy the part containing the exception from its beginning
to the end.



On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
<mi...@gmail.com> wrote:
> Where can I obtain it?
> The exception that I posted is the only exception that showed up following
> "tail -f *"
>
> On Wed, Apr 1, 2009 at 6:04 AM, Gregor <rc...@googlemail.com> wrote:
>
>> your log is useless.
>> please post the complete stacktrace incl. the type of the exception
>>
>> rds
>>
>> gregor
>>
>> Am 01.04.2009 um 11:57 schrieb Mighty Tornado <mi...@gmail.com>:
>>
>>
>>  Additional info:
>>>
>>> I get the following exception in the log when I start the server up:
>>>
>>> ==> localhost.2009-03-03.log <==
>>>   at
>>>
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>   at
>>>
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>   at
>>>
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>   at
>>>
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>   at
>>>
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>   at
>>>
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>>>   at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>>>   at
>>>
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>   at
>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>>   at java.lang.Thread.run(Thread.java:613)
>>>
>>>
>>>
>>> I use the following code to get the connection:
>>>
>>> InitialContext ic = new InitialContext();
>>>
>>>           if(ic == null)
>>>           {
>>>               System.out.println("context not found");
>>>           }
>>>
>>>           DataSource ds =
>>> (DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");
>>>
>>>           if(ds == null)
>>>           {
>>>               System.out.println("DataSource not found");
>>>           }
>>>
>>>           conn = ds.getConnection();
>>>
>>>           stat = conn.createStatement();
>>>
>>>           rs = stat.executeQuery("SELECT * FROM family_member ");
>>>
>>> On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado <mighty.tornado@gmail.com
>>> >wrote:
>>>
>>>  Hi I placed the following in context.xml in META-INF.
>>>> But the result set is null, what's wrong with my set up?Can anybody
>>>> please
>>>> advise?
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <Context>
>>>> <Resource
>>>>   auth="Container"
>>>>   description="DB Connection"
>>>>   name="jdbc/vhousehold"
>>>>   type="javax.sql.DataSource"
>>>>   password="vhousehold"
>>>>   driverClassName="com.mysql.jdbc.Driver"
>>>>   maxIdle="2"
>>>>   maxWait="5000"
>>>>   validationQuery="select * from family_member;"
>>>>   username="vhousehold"
>>>>   url="jdbc:mysql://localhost:3306/vhousehold"
>>>>   maxActive="4"/>
>>>> </Context>
>>>>
>>>> Thanks,
>>>>
>>>> Ramy.
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>



-- 
--
Yassine Elassad
Bonn, Germany.
Fon : +49 228 97629355
Mobile : +49 157 74519666

PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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


Re: DataSource from Context files - doesn't work

Posted by Mighty Tornado <mi...@gmail.com>.
guess it was an old exception. no new ones in the logs. But I am doing
something wrong with the way I define the data source and hand it to Tomcat
for handling. Any suggestions as to how I can find out where the mistake is?

On Wed, Apr 1, 2009 at 6:36 AM, Gregor Schneider <rc...@googlemail.com>wrote:

> On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
> <mi...@gmail.com> wrote:
> > Where can I obtain it?
>
> You wrote before:
>
> > I get the following exception in the log when I start the server up:
> >
> > ==> localhost.2009-03-03.log <==
> >    at
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> >    at
>
> so in that "log" there should be the complete stacktrace of the
> exception including it's type.
>
> Unfortunately my apps are working like charm, so I ain't got an
> example to cpy and post here... *cough*
>
> Rgds
>
> Gregor
>
> @ Yassine: Availabe for a chat via Google? I got your shirts, remeber... ;)
> --
> just because your paranoid, doesn't mean they're not after you...
> gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
> gpgp-key available
> @ http://pgpkeys.pca.dfn.de:11371
> @ http://pgp.mit.edu:11371/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: [OT] Re: DataSource from Context files - doesn't work

Posted by Gregor Schneider <rc...@googlemail.com>.
Hi André,

On Wed, Apr 1, 2009 at 4:52 PM, André Warnier <aw...@ice-sa.com> wrote:
> Gregor Schneider wrote:
>>
>> Unfortunately my apps are working like charm, so I ain't got an
>> example to cpy and post here... *cough*
>>
> Angeber.
>

Promise to conserve my next exception-log and will send it to you.. ;)

Cheers

Gregor

PS.: To be honest: One app is not working as expected, but there ain't
no exception-log *ouch*
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available
@ http://pgpkeys.pca.dfn.de:11371
@ http://pgp.mit.edu:11371/

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


[OT] Re: DataSource from Context files - doesn't work

Posted by André Warnier <aw...@ice-sa.com>.
Gregor Schneider wrote:
> 
> Unfortunately my apps are working like charm, so I ain't got an
> example to cpy and post here... *cough*
> 
Angeber.


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


Re: DataSource from Context files - doesn't work

Posted by Gregor Schneider <rc...@googlemail.com>.
On Wed, Apr 1, 2009 at 12:07 PM, Mighty Tornado
<mi...@gmail.com> wrote:
> Where can I obtain it?

You wrote before:

> I get the following exception in the log when I start the server up:
>
> ==> localhost.2009-03-03.log <==
>    at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>    at

so in that "log" there should be the complete stacktrace of the
exception including it's type.

Unfortunately my apps are working like charm, so I ain't got an
example to cpy and post here... *cough*

Rgds

Gregor

@ Yassine: Availabe for a chat via Google? I got your shirts, remeber... ;)
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available
@ http://pgpkeys.pca.dfn.de:11371
@ http://pgp.mit.edu:11371/

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


Re: DataSource from Context files - doesn't work

Posted by Mighty Tornado <mi...@gmail.com>.
Where can I obtain it?
The exception that I posted is the only exception that showed up following
"tail -f *"

On Wed, Apr 1, 2009 at 6:04 AM, Gregor <rc...@googlemail.com> wrote:

> your log is useless.
> please post the complete stacktrace incl. the type of the exception
>
> rds
>
> gregor
>
> Am 01.04.2009 um 11:57 schrieb Mighty Tornado <mi...@gmail.com>:
>
>
>  Additional info:
>>
>> I get the following exception in the log when I start the server up:
>>
>> ==> localhost.2009-03-03.log <==
>>   at
>>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>   at
>>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>   at
>>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>   at
>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>   at
>>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>   at
>>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>>   at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>>   at
>>
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>   at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>   at java.lang.Thread.run(Thread.java:613)
>>
>>
>>
>> I use the following code to get the connection:
>>
>> InitialContext ic = new InitialContext();
>>
>>           if(ic == null)
>>           {
>>               System.out.println("context not found");
>>           }
>>
>>           DataSource ds =
>> (DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");
>>
>>           if(ds == null)
>>           {
>>               System.out.println("DataSource not found");
>>           }
>>
>>           conn = ds.getConnection();
>>
>>           stat = conn.createStatement();
>>
>>           rs = stat.executeQuery("SELECT * FROM family_member ");
>>
>> On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado <mighty.tornado@gmail.com
>> >wrote:
>>
>>  Hi I placed the following in context.xml in META-INF.
>>> But the result set is null, what's wrong with my set up?Can anybody
>>> please
>>> advise?
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <Context>
>>> <Resource
>>>   auth="Container"
>>>   description="DB Connection"
>>>   name="jdbc/vhousehold"
>>>   type="javax.sql.DataSource"
>>>   password="vhousehold"
>>>   driverClassName="com.mysql.jdbc.Driver"
>>>   maxIdle="2"
>>>   maxWait="5000"
>>>   validationQuery="select * from family_member;"
>>>   username="vhousehold"
>>>   url="jdbc:mysql://localhost:3306/vhousehold"
>>>   maxActive="4"/>
>>> </Context>
>>>
>>> Thanks,
>>>
>>> Ramy.
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: DataSource from Context files - doesn't work

Posted by Gregor <rc...@googlemail.com>.
your log is useless.
please post the complete stacktrace incl. the type of the exception

rds

gregor

Am 01.04.2009 um 11:57 schrieb Mighty Tornado  
<mi...@gmail.com>:

> Additional info:
>
> I get the following exception in the log when I start the server up:
>
> ==> localhost.2009-03-03.log <==
>    at
> org. 
> apache. 
> catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 
> 233)
>    at
> org. 
> apache. 
> catalina.core.StandardContextValve.invoke(StandardContextValve.java: 
> 191)
>    at
> org. 
> apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 
> 128)
>    at
> org. 
> apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 
> 102)
>    at
> org. 
> apache. 
> catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>    at
> org. 
> apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 
> 286)
>    at
> org. 
> apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>    at
> org.apache.coyote.http11.Http11Protocol 
> $Http11ConnectionHandler.process(Http11Protocol.java:583)
>    at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 
> 447)
>    at java.lang.Thread.run(Thread.java:613)
>
>
>
> I use the following code to get the connection:
>
> InitialContext ic = new InitialContext();
>
>            if(ic == null)
>            {
>                System.out.println("context not found");
>            }
>
>            DataSource ds =
> (DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");
>
>            if(ds == null)
>            {
>                System.out.println("DataSource not found");
>            }
>
>            conn = ds.getConnection();
>
>            stat = conn.createStatement();
>
>            rs = stat.executeQuery("SELECT * FROM family_member ");
>
> On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado <mighty.tornado@gmail.com 
> >wrote:
>
>> Hi I placed the following in context.xml in META-INF.
>> But the result set is null, what's wrong with my set up?Can anybody  
>> please
>> advise?
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <Context>
>> <Resource
>>    auth="Container"
>>    description="DB Connection"
>>    name="jdbc/vhousehold"
>>    type="javax.sql.DataSource"
>>    password="vhousehold"
>>    driverClassName="com.mysql.jdbc.Driver"
>>    maxIdle="2"
>>    maxWait="5000"
>>    validationQuery="select * from family_member;"
>>    username="vhousehold"
>>    url="jdbc:mysql://localhost:3306/vhousehold"
>>    maxActive="4"/>
>> </Context>
>>
>> Thanks,
>>
>> Ramy.
>>

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


Re: DataSource from Context files - doesn't work

Posted by Mighty Tornado <mi...@gmail.com>.
Additional info:

I get the following exception in the log when I start the server up:

==> localhost.2009-03-03.log <==
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:613)



I use the following code to get the connection:

InitialContext ic = new InitialContext();

            if(ic == null)
            {
                System.out.println("context not found");
            }

            DataSource ds =
(DataSource)ic.lookup("java:comp/env/jdbc/vhousehold");

            if(ds == null)
            {
                System.out.println("DataSource not found");
            }

            conn = ds.getConnection();

            stat = conn.createStatement();

            rs = stat.executeQuery("SELECT * FROM family_member ");

On Tue, Mar 31, 2009 at 9:36 PM, Mighty Tornado <mi...@gmail.com>wrote:

> Hi I placed the following in context.xml in META-INF.
> But the result set is null, what's wrong with my set up?Can anybody please
> advise?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Context>
> <Resource
>     auth="Container"
>     description="DB Connection"
>     name="jdbc/vhousehold"
>     type="javax.sql.DataSource"
>     password="vhousehold"
>     driverClassName="com.mysql.jdbc.Driver"
>     maxIdle="2"
>     maxWait="5000"
>     validationQuery="select * from family_member;"
>     username="vhousehold"
>     url="jdbc:mysql://localhost:3306/vhousehold"
>     maxActive="4"/>
> </Context>
>
> Thanks,
>
> Ramy.
>