You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Steve McRoberts <st...@doit.wisc.edu> on 2003/03/12 15:34:50 UTC

Access to myJDBCAppender Class

We use Tomcat with an application scoped class utilizing an Oracle
connection pool. In "myJDBCAppender" class I override
JDBCAppender.execute so I can construct/dispose of my own connection
(ultimately thru the pool class mentioned above). My problem is I need
to get a reference to the application class when the myJDBCAppender
class is constructed and I can't seem to determine how to do this. I
tried binding the class in the application JNDI context but Tomcat
creates this as read-only. Looking for any suggestions. //steve


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


RE: Access to myJDBCAppender Class

Posted by Steve McRoberts <st...@doit.wisc.edu>.
That's a good suggestion. Unfortunately this was designed to support
multiple database schemas and therefore multiple pools all from an xml
registry of queries.

But your suggestion triggered an idea which seems to work. Since the
application scoped class is an application bean, only one instance of it
is allocated by the webapp. I simply saved the "this" from the
constructor and added a static getInstance to return it.

> -----Original Message-----
> From: donald larmee [mailto:dlarmee@utopiansoft.com] 
> Sent: Wednesday, March 12, 2003 12:57 PM
> To: Log4J Users List
> Subject: Re: Access to myJDBCAppender Class
> 
> 
> Not sure I have entirely understood your issue correctly.  By 
> 'application 
> scoped class' do you mean one that is created/loaded by the 
> classloader 
> associated only with the webapp itself (i.e., the class 
> resides in your 
> WEB-INF/classes or WEB-INF/lib, not in Tomcats CLASSPATH)?  
> Is the class in 
> this case the ConnectionPool (wrapper) itself?
> 
> Have you tried making your connection pool a singleton 
> obtained by anyone 
> that wants it thru a static MyConnectionPool.getInstance()?
> 
> -don
> 
> At 08:34 AM 3/12/2003 -0600, Steve McRoberts wrote:
> 
> >We use Tomcat with an application scoped class utilizing an Oracle 
> >connection pool. In "myJDBCAppender" class I override 
> >JDBCAppender.execute so I can construct/dispose of my own connection 
> >(ultimately thru the pool class mentioned above). My problem 
> is I need 
> >to get a reference to the application class when the myJDBCAppender 
> >class is constructed and I can't seem to determine how to do this. I 
> >tried binding the class in the application JNDI context but Tomcat 
> >creates this as read-only. Looking for any suggestions. //steve
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> 
> +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
>    donald h. larmee                               
> dlarmee@utopiansoft.com
>                                                               
>             804.301.UTOP
>                           utopian software concepts, inc.
>                                   www.utopiansoft.com
> +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> 


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


Re: Access to myJDBCAppender Class

Posted by donald larmee <dl...@utopiansoft.com>.
Not sure I have entirely understood your issue correctly.  By 'application 
scoped class' do you mean one that is created/loaded by the classloader 
associated only with the webapp itself (i.e., the class resides in your 
WEB-INF/classes or WEB-INF/lib, not in Tomcats CLASSPATH)?  Is the class in 
this case the ConnectionPool (wrapper) itself?

Have you tried making your connection pool a singleton obtained by anyone 
that wants it thru a static MyConnectionPool.getInstance()?

-don

At 08:34 AM 3/12/2003 -0600, Steve McRoberts wrote:

>We use Tomcat with an application scoped class utilizing an Oracle
>connection pool. In "myJDBCAppender" class I override
>JDBCAppender.execute so I can construct/dispose of my own connection
>(ultimately thru the pool class mentioned above). My problem is I need
>to get a reference to the application class when the myJDBCAppender
>class is constructed and I can't seem to determine how to do this. I
>tried binding the class in the application JNDI context but Tomcat
>creates this as read-only. Looking for any suggestions. //steve
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org


+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
   donald h. larmee                               dlarmee@utopiansoft.com
                                                                          804.301.UTOP
                          utopian software concepts, inc.
                                  www.utopiansoft.com
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+



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