Re: Logging application messages to a file instead of to the console

2006-09-22 Thread Mark Barnes

Shiby -

Could you show us the code where your code creates your Logger and set your 
Formatter and Handler, then give us an example where your code
actually uses the Logger to log a message?


---Mark


Shiby Maria John wrote:

Ok thanks


.
.
.


Sorry Shiby,

I've got no idea about the java logger as such. But had it been Log4j,

I'd have checked my log4j.properties for the configured appender.

Santosh.

Shiby Maria John wrote:

No, java logger. (java.util.logging package)

.
.
.

Hi,

What Logger are you using within the application. Is it Log4j?

Santosh.

Shiby Maria John wrote:


Thanks for the immediate reply..
But I tried that .. it is loggin only Tomcat server specific


messages


and not the application messages.

This is what I gave in my server.xml file

Logger classname=org.apache.catalina.logger.FileLogger
path=D:\applog.log verbosity=INFORMATION /

But only the INFO: messages from the server is coming in the file.

.
.
.





From: Shiby Maria John [mailto:[EMAIL PROTECTED]
Subject: Logging application messages to a file instead of to
the console

I have an application deployed in Tomcat 5.0 in Linux OS.

I want my application messages as well as the JVM logs to log into


a


file instead of into the console.



Perhaps you should read the doc:
http://tomcat.apache.org/tomcat-5.0-doc/config/logger.html

 - Chuck


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Database connection pooling in Tomcat 5.5

2006-09-18 Thread Mark Barnes

Do you include a resource-ref in your WEB-INF/web.xml file?

You might also want to post your web.xml


Pid wrote:

post your context.xml




Darren Hall wrote:

Hi all.

 


I'm attempting to set up database connection pool using Tomcat 5.5 and
Oracle 10g. I've been following the JNDI How To guide from Apache
(http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
). My question is - where should I define the connection pool resource?
Meaning, where should my Resource element appear. I've read two different
descriptions about how this should be done in the Apache documentation. The
first description (from the above link) states that I should modify
server.xml and add a new Context element as such Context path=/DBTest
docBase=DBTest debug=5 reloadable=true crossContext=true and in
that new context define my resource for my connection pool. However, if you
read the Context documentation linked to the above How-To (located at this
link: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html) you'll
find in there the following text - Please note that for tomcat 5, unlike
tomcat 4.x, it is NOT recommended to place Context elements directly in
the server.xml file. Instead, put them in the META-INF/context.xml directory
of your WAR file or the conf directory. So I'm wondering if I should modify
server.xml or create a context.xml file. Currently I'm trying the
context.xml file route, but it is not working (although this could be
because I'm configuring things incorrectly). Can anyone point me in the
right direction here?
 
Thanks,

Darren

 






-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Solution Re: Problem setting up Application-managed DataSource???

2006-09-13 Thread Mark Barnes

Well, by reading the source for DBCP 1.2.1, I can see that
BasicDataSource method:

getConnection(String username, String password)

is not supported because the delegate which BasicDataSource
uses, an instance of PoolingDataSource, throws an
UnsupportedOperationException in method:

getConnection(String username, String password).




This essentially tells me that Tomcat 5.5.17 does not
support an Application-managed DataSource if you use the
standard  Java API.  You can, however, cast the
DataSource returned from JNDI to:

org.apache.tomcat.dbcp.dbcp.BasicDataSource

and then call the following before getting the first
connection (where ds is the reference to the
BasicDataSource):

ds.setUsername(username);
ds.setPassword(password);

or:

ds.addConnectionProperty(user, username);
ds.addConnectionProperty(password, password);

This, of course, makes the code Tomcat-specific.




Mark Barnes wrote:

I just cannot seem to get an Application-managed DataSource to work!


I am using Tomcat 5.5.17 on JDK 1.5.0_07 on Red Hat Linux.

I have done what I think is required in the context.xml and the web.xml 
files for my application to enable an Application-managed DataSource, 
and have done what is require to get the DataSource and get a connection 
from it, passing the correct username  password, but when I try to get 
my first connection to the database I always get an Exception telling me 
the username/password are invalid.


I have included below copies of the Stack Trace Back, the context.xml, 
the web.xml, and the code used to access the DataSource and get the 
connection.


Everything was working fine with the same username  password using a 
Container-managed DataSource, but now I have the requirement that I get 
the plain-text username  password out of the XML files.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem setting up Application-managed DataSource???

2006-09-11 Thread Mark Barnes

I just cannot seem to get an Application-managed DataSource to work!


I am using Tomcat 5.5.17 on JDK 1.5.0_07 on Red Hat Linux.

I have done what I think is required in the context.xml and the web.xml files 
for my application to enable an Application-managed DataSource, and have done 
what is require to get the DataSource and get a connection from it, passing the 
correct username  password, but when I try to get my first connection to the 
database I always get an Exception telling me the username/password are invalid.


I have included below copies of the Stack Trace Back, the context.xml, the 
web.xml, and the code used to access the DataSource and get the connection.


Everything was working fine with the same username  password using a 
Container-managed DataSource, but now I have the requirement that I get the 
plain-text username  password out of the XML files.


I tried to cast the DataSource to org.apache.tomcat.dbcp.dbcp.BasicDataSource,
so as to get and display some of the properties (username, password, url, etc)
but the package and class could not be found when compiling.  So I added this 
jar file to the classpath:

INSTALL_DIR/apache-tomcat-5.5.17/common/lib/naming-factory-dbcp.jar
Same error!  I looked inside the jar file, and the .class file is indeed there. 
  Am I to assume this class is private or package-protected?


I downloaded the Tomcat source but cannot find the source for this class.  I 
could not even find and directories named 'dbcp' in the source tree.  And I 
grep'ed the entire source tree for the string 'BasicDataSource' and it wasn't found.


(And, like many, it seems, I tried ResourceParams in my context.xml, only to 
find it doesn't work.)



Now I don't know what to do.

Can someone please help me?

Has anyone ever gotten an Application-managed DataSource to work?



Thanks,
---Mark Barnes
---Burlington Coat Factory Warehouse, Inc
---Lebanon, NH






Here's the Stack Trace Back:


   org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (ORA-01017:

invalid username/password; logon denied
)
at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:554)

at coat.util.DatabaseAlias.getConnection(DatabaseAlias.java:108)
at coat.util.DbUtils.getDatabaseConnection(DbUtils.java:383)
at cwp.DmTrxRequest.getInternetMap(DmTrxRequest.java:72)
at DmTrx.initializeData(DmTrx.java:1159)
at DmTrx.initialize(DmTrx.java:745)
at DmTrx.init(DmTrx.java:738)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)

at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)

at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at 
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
at 
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)

at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at 
org.apache.catalina.core.StandardService.start(StandardService.java:450)
at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: java.sql.SQLException: ORA-01017: invalid username/password; logon 
denied







Here