File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes log4j:WARN No appenders could be found for logger Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "log4j:WARN No appenders could be found for logger " Watch "log4j:WARN No appenders could be found for logger " New topic
Author

log4j:WARN No appenders could be found for logger

renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi,

I got the below error when i tried runing my application in eclipse.

log4j:WARN No appenders could be found for logger (com.tcs.trans.Connection.DBPool).
log4j:WARN Please initialize the log4j system properly.

But when i try adding log4.jar file in the eclipse classpath, i am getting the below error. Could somone help please .

Nov 7, 2008 10:09:34 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Nov 7, 2008 10:09:35 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Documents and Settings\198669\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Trans\WEB-INF\lib\jsp-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class
Nov 7, 2008 10:09:35 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Documents and Settings\198669\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Trans\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Nov 7, 2008 10:09:35 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Documents and Settings\198669\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Trans\WEB-INF\lib\weblogic.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Nov 7, 2008 10:09:35 AM org.apache.catalina.startup.ContextConfig processDefaultWebConfig
SEVERE: Parse error in default web.xml
java.lang.NullPointerException
at oracle.xml.util.StringHashtable.create(StringHashtable.java:116)
at oracle.xml.parser.v2.XMLReader.scanQName(XMLReader.java:1891)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1268)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:328)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)
at org.apache.catalina.startup.ContextConfig.processDefaultWebConfig(ContextConfig.java:677)
at org.apache.catalina.startup.ContextConfig.defaultWebConfig(ContextConfig.java:614)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1043)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3025)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1278)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at java.lang.Thread.run(Thread.java:595)
Nov 7, 2008 10:09:35 AM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/Trans/WEB-INF/web.xml
java.lang.NullPointerException
at oracle.xml.util.StringHashtable.create(StringHashtable.java:116)
at oracle.xml.parser.v2.XMLReader.scanQName(XMLReader.java:1891)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1268)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:328)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:352)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1044)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3025)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1278)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at java.lang.Thread.run(Thread.java:595)
Nov 7, 2008 10:09:35 AM org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
Nov 7, 2008 10:09:35 AM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Nov 7, 2008 10:09:35 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/Trans] startup failed due to previous errors


Cheers,
Richard
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Actually I'm more worried on the fact why there are multiple implementations of the Servlet API in your classpath which is preventing your application to startup.

Did you explicitly add those libraries (servlet-api.jar and weblogic.jar)?

The log4j problem you mentioned is a bit minor issue which just means that log messages from the class com.tcs.trans.Connection.DBPool are unlikely to be processed because of incorrect log4j configuration.


SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi Paul,

Do you want me to remove the servlet-api.jar and weblogic.jar from this location

C:\Documents and Settings\198669\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Trans\WEB-INF\lib\.


Now i have deleted these jars from the above location.
After which i am getting the below logs in the eclipse console.


Nov 7, 2008 2:42:19 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_02\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.5.0_02/bin/../jre/bin/client;C:/Program Files/Java/jdk1.5.0_02/bin/../jre/bin;;C:\Program Files\Java\jdk1.5.0_02\bin;C:\Program Files\Java\jre1.6.0_07\bin;C:\Program Files\Java\jre1.5.0_02\bin;C:\Program Files\Apache SoftwareFoundation\Tomcat6.0\webapps\Listener\WEB-INF\classes;C:\WINDOWS\system32;C:\oracle\ora92\bin;;C:\PROGRA~1\Vitria\BW31\bin\win32;
Nov 7, 2008 2:42:19 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 7, 2008 2:42:19 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1125 ms
Nov 7, 2008 2:42:19 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 7, 2008 2:42:19 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.25
Nov 7, 2008 2:42:19 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Nov 7, 2008 2:42:20 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 7, 2008 2:42:21 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 7, 2008 2:42:21 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
Nov 7, 2008 2:42:21 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Nov 7, 2008 2:42:21 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1797 ms


Could please advise me whether this is correct.
Many Thanks!!

[ November 07, 2008: Message edited by: renu richard ]
[ November 07, 2008: Message edited by: renu richard ]
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Paul,
One more thing to add.
Actually, i dont have any problem in starting the tomcat server.
In my application i am trying to establish a database connetion and then using the select query taking some values from the table. Which i am trying to display in another JSP.
But this is not happening.
The values being returned are 0 and null.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

I'll admit that log4j configuration in webapps is one of the things that drives me crazy.

The "No appenders" message doesn't mean that the log4j classes can't be found, it means that logging hasn't been properly configured. The "No appenders" message comes from log4j itself, so you probably set yourself up for class version conflicts when you included another log4j jar into the classpath.

To get rid of the "No appenders" message, you need to supply a log4j config file. According to my blood-and-tear-stained model project, this file - either the old version or the XML version - should appear at a root level in the application classpath. For a webapp, that would mean a file like this:

WEB-INF/classes/log4j.xml

Here's a not-so-typical example.


The "papertrail" logger writes to an external logfile for some specialized debugging. You wouldn't normally use that. Additionally, I've bumped some of the library loggers up or down based on what I needed to see while debugging the project. I believe the Digester has an odd idea of what priorities go where, so I hid anything less than a severe error iun order to keep from being buried in trivial messages.


Customer surveys are for companies who didn't pay proper attention to begin with.
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Hi Richard,

Did you try testing your jsp again after the jar issues have been resolved? Still getting the same result or what?

-Mourougan


Mourougan
Open Source leads to Open Mind
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Wow. The UBB software really butchered that display. I don't know what happened there. Sorry.
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Originally posted by renu richard:
Hi Paul,

INFO: Server startup in 1797 ms


Could please advise me whether this is correct.


Yes, it looks like the server now started up properly.
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi All,
Server started properly. Actually i tried to execute a SQL statement(insert query) to insert a row in a table. The values got inserted, but then i am getting the below error. Can you please tellme why i am gettign this error ?

before printing the query
INSERT INTO Employee VALUES (1987863,'raja.p@yahoo.com',97909257657536,'Raj','rajathi')
after printing the query
just before executing the query
false
insife if loop
log4j:WARN No appenders could be found for logger (com.tcs.trans.Connection.DBPool).
log4j:WARN Please initialize the log4j system properly.
TRUE
datasource
outside if loop
after connection factory
--------got Connection-----------
inside the got connetion
oracle.jdbc.driver.OracleResultSetImpl@16acdd1
something is returned
ErrorORA-00900: invalid SQL statement

java.sql.SQLException: ORA-00900: invalid SQL statement

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.v8Odscrarr.receive(v8Odscrarr.java:205)
at oracle.jdbc.ttc7.TTC7Protocol.describe(TTC7Protocol.java:754)
at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:6195)
at oracle.jdbc.driver.OracleResultSetMetaData.<init>(OracleResultSetMetaData.java:55)
at oracle.jdbc.driver.OracleResultSetImpl.getMetaData(OracleResultSetImpl.java:152)
at sun.jdbc.rowset.CachedRowSet.populate(CachedRowSet.java:605)
at com.tcs.trans.Connection.DBPool.executeQuery(DBPool.java:242)
at com.tcs.trans.DAO.LoginDAO.LoginCheck(LoginDAO.java:33)
at com.tcs.trans.servlet.Logincheck.doPost(Logincheck.java:40)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
java.sql.SQLException: ORA-00900: invalid SQL statement

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.v8Odscrarr.receive(v8Odscrarr.java:205)
at oracle.jdbc.ttc7.TTC7Protocol.describe(TTC7Protocol.java:754)
at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:6195)
at oracle.jdbc.driver.OracleResultSetMetaData.<init>(OracleResultSetMetaData.java:55)
at oracle.jdbc.driver.OracleResultSetImpl.getMetaData(OracleResultSetImpl.java:152)
at sun.jdbc.rowset.CachedRowSet.populate(CachedRowSet.java:605)
at com.tcs.trans.Connection.DBPool.executeQuery(DBPool.java:242)
at com.tcs.trans.DAO.LoginDAO.LoginCheck(LoginDAO.java:33)
at com.tcs.trans.servlet.Logincheck.doPost(Logincheck.java:40)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)

Many Thanks !!
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

The answer lies in the error code itself. See the lines below.


ErrorORA-00900: invalid SQL statement

java.sql.SQLException: ORA-00900: invalid SQL statement


Some of the useful links are:

http://ora-00900.ora-code.com/
http://www.techonthenet.com/oracle/errors/ora00900.php

But these seems to be when you are dealing with a Procedure (Stored Procedure). Are you?


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Moreover, now this thread deserves to be shifted to the "SQL" or "JDBC" forum
[ November 08, 2008: Message edited by: Raghavan Muthu ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j:WARN No appenders could be found for logger
 
Similar Threads
ClassNotFoundException
rg.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "java.sql.SQLExcepti
File not found error
java.lang.ClassCastException: org.spring.....ContextLoaderPlugIn cannot be cast to ..action.PlugIn
How to call login.jsp in eclipse