tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gaurav Kushwaha" <gaurav.kushw...@gmail.com>
Subject Re: log4j and CLASSPATH problems on linux
Date Sun, 04 Feb 2007 13:11:21 GMT
Log4j loads "log4j.properties" from the classpath of the classloader that
loaded itself(log4j classes). In your case, log4j is loaded by tomcat
classloader, since it is present in $TOMCAT_HOME/lib. Classes and files
under WEB-INF/classes are not visible to that classloader, hence the
problem.

Regards,
Gaurav Singh Kushwaha
http://www.chakpak.com

Ph: +91-9880110695
Bangalore, India.

On 2/3/07, Oren Livne <olivne@aoce.utah.edu> wrote:
>
> Dear All:
>
> I'm running tomcat 6.0.7 beta on a linux redhat 8 system. Here are my
> questions:
> 1. I tried to set up some useful libraries in directories outside
> $tomcat_home/lib but they were not recognized.
> I did that by setting:
> CLASSPATH=/srv/lib/hibernate-
> 3.2.1.GA:/srv/lib/hibernate-tools-3.2.0.beta8:/srv/lib/j2ee-1.4:/srv/lib/misc:/srv/lib/struts-1.3.5
> export CLASSPATH
> and restarting tomcat, but it didn't find my libraries. So I put them
> all under $tomcat_home/lib. Is that right?
>
> 2. I deployed a web application called "Catalog" to tomcat (it uses
> Struts 1.3.5 and Hibernate 3.2.1 GA), and placed log4.properties under
> webapps/Catalog/WEB-INF/classes. It is not recognized, and I get these
> warnings:
>
> log4j:WARN No appenders could be found for logger
> (net.ruready.struts.filter.FindItemFilter).
> log4j:WARN Please initialize the log4j system properly.
>
> Also, I don't see any output although my log4j is configured to output
> messages. On my windows XP system,
> I see messages and I can declare libraries outside tomcat, but I'm using
> MyEclipse 5.1 so I don't know how it's done
> behind the scenes.
>
> 3. When I run my app, it hangs trying to access the database. I have a
> hibernate.cfg.xml which works on windows, but once again,
> I am not sure what is going on because I don't see any log messages on
> linux.
>
> What am I doing wrong, and how should I configure tomcat and my web app?
> Attached below please find my relevant config files.
>
> Thanks so much in advance,
> Oren
>
> =============
> Classpath: empty
> [ruready@dev lib]$ echo $CLASSPATH
>
> [ruready@dev lib]$
>
> web apps dir:
> [ruready@dev lib]$ ls $webapps/
> Catalog  docs  examples  host-manager  manager  ROOT
> [ruready@dev lib]$
>
> classes directory (I thought it is automatically added to the app's
> classpath!):
> [ruready@dev lib]$ ls /srv/tomcat/webapps/Catalog/WEB-INF/classes/
> ApplicationResources.properties  hibernate.struts.cfg.xml
> net                    project.version
> hibernate.cfg.xml                hibernate.test.cfg.xml    ols.properties
> hibernate.stand_alone.cfg.xml    log4j.properties
> ols_states.properties
>
> log4j.properties:
> #============================ Appenders (Output Streams)
> ==========================
>
> ### direct log messages to stdout ###
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.Target=System.out
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
> - %m%n
>
> ### direct messages to file catalog.log ###
> log4j.appender.file=org.apache.log4j.FileAppender
> log4j.appender.file.File=catalog.log
> log4j.appender.file.layout=org.apache.log4j.PatternLayout
> log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
> %m%n
>
> #============================ All Classes & Packages
> ==============================
> # Format: logger=LOGLEVEL, appender1, appender2, etc. will set the log
> level to
> # LOGLEVEL and direct the output to all appenders that follow.
>
> log4j.rootLogger=INFO, stdout
>
> #============================ RUReady
> =============================================
>
> log4j.logger.net.ruready=DEBUG, stdout
>
> #============================ Struts
> ==============================================
>
> log4j.logger.org.apache.struts.util=ERROR, stdout
>
> #============================ Hibernate
> ===========================================
>
> #log4j.logger.org.hibernate=info
> #log4j.logger.org.hibernate=debug
>
> #============================ Hibernate
> ===========================================
>
> #log4j.logger.org.hibernate=info
> #log4j.logger.org.hibernate=debug
>
> ### log HQL query parser activity
> #log4j.logger.org.hibernate.hql.ast.AST=debug
>
> ### log just the SQL
> #log4j.logger.org.hibernate.SQL=debug
>
> ### log JDBC bind parameters ###
> log4j.logger.org.hibernate.type=info
> #log4j.logger.org.hibernate.type=debug
>
> ### log schema export/update ###
> log4j.logger.org.hibernate.tool.hbm2ddl=debug
>
> ### log HQL parse trees
> #log4j.logger.org.hibernate.hql=debug
>
> ### log cache activity ###
> #log4j.logger.org.hibernate.cache=debug
>
> ### log transaction activity
> #log4j.logger.org.hibernate.transaction=debug
>
> ### log JDBC resource acquisition
> #log4j.logger.org.hibernate.jdbc=debug
>
> ### enable the following line if you want to track down connection ###
> ### leakages when using DriverManagerConnectionProvider ###
>
> #log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
>
> Tomcat library directory:
> [ruready@dev lib]$ ls /srv/tomcat/lib
> activation.jar                          commons-logging.jar
> junit.jar
> annotations-api.jar                     commons-validator-1.3.0.jar
> jwordnet.jar
> ant-1.6.5.jar                           concurrent-1.3.2.jar
> log4j-1.2.11.jar
> ant-antlr-1.6.5.jar                     connector.jar
> mail.jar
> ant-junit-1.6.5.jar                     dom4j-1.6.1.jar
> mysql-connector-java-3.1.10-bin.jar
> ant-launcher-1.6.5.jar                  ehcache-1.2.3.jar
> naming-factory-dbcp.jar
> antlr-2.7.6.jar                         ejb3-persistence.jar
> naming-factory.jar
> ant-swing-1.6.5.jar                     el-api.jar
> naming-resources.jar
> asm-attrs.jar                           hibernate3.jar
> oro-2.0.8.jar
> asm.jar                                 hibernate-annotations.jar
> oscache-2.1.jar
> bsf-2.3.0.jar                           hibernate-tools.jar
> proxool-0.8.3.jar
> c3p0-0.9.0.jar                          itext-1.4.1.jar
> resolver.jar
> catalina-ant.jar                        jaas.jar
> servlet-api.jar
> catalina-ha.jar                         jacc-1_0-fr.jar
> standard.jar
> catalina.jar                            jasper-compiler.jar
> struts-core-1.3.5.jar
> catalina-tribes.jar                     jasper-el.jar
> struts-el-1.3.5.jar
> cglib-2.1.3.jar                         jasper.jar
> struts-extras-1.3.5.jar
> checkstyle-all.jar                      jasper-jdt.jar
> struts-faces-1.3.5.jar
> cleanimports.jar                        jasper-runtime.jar
> struts-mailreader-dao-1.3.5.jar
> commons-beanutils-1.7.0.jar             javassist.jar
> struts-scripting-1.3.5.jar
> commons-beanutils-bean-collections.jar  jaxen-1.1-beta-7.jar
> struts-taglib-1.3.5.jar
> commons-beanutils-core.jar              jazzy-core.jar
> struts-tiles-1.3.5.jar
> commons-beanutils.jar                   jboss-cache.jar
> swarmcache-1.0rc2.jar
> commons-chain-1.1.jar                   jboss-common.jar
> syndiag2.jar
> commons-collections-2.1.1.jar           jboss-jmx.jar
> tomcat-coyote.jar
> commons-collections-3.1.jar             jboss-system.jar
> tomcat-dbcp.jar
> commons-dbutils-1.0.jar                 jcommon-1.0.0-rc1.jar
> tomcat-i18n-es.jar
> commons-digester-1.6.jar                jdbc2_0-stdext.jar
> tomcat-i18n-fr.jar
> commons-el.jar                          jfreechart-1.0.0-rc1.jar
> tomcat-i18n-ja.jar
> commons-fileupload-1.1.1.jar            jgroups-2.2.8.jar
> versioncheck.jar
> commons-io-1.1.jar                      jsp-api.jar
> xerces-2.6.2.jar
> commons-lang-2.2.jar                    jstl.jar
> xercesImpl.jar
> commons-logging-1.0.4.jar               jta.jar
> xercesSamples.jar
> commons-logging-api.jar                 junit-3.8.1.jar
> xml-apis.jar
>
>
>
> --
> ======================================================================
> Oren Livne, Ph.D.
> Research Assistant Professor of Mathematics
> RUReady Software Architect
>
> Academic Outreach and Continuing Education
> 1901 East South Campus Dr., Room 2197-D
> University of Utah, Salt Lake City, UT 84112-9399
> Tel  : (801) 581-6831     Cell: (801) 631-3885     Fax: (801) 585-5414
> Email: olivne@aoce.utah.edu              Web:  http://ruready.net/oren
> ======================================================================
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message