Solved

JSP + Struts: Error 9 java.lang.NoSuchFieldError:  org.apache.log4j.Priority.INFO)

Posted on 2006-11-05
6
821 Views
Last Modified: 2010-05-18
I need to create jsp page using struts

First i follow the below link
http://www.oracle.com/technology/obe/obe9051jdev/strutsvalidator/validator.htm#o

But when i run i got the following error.

500 Internal Server Error

java.lang.NoSuchFieldError:  org.apache.log4j.Priority.INFO  <=== i got no idea where to cause this problem

      at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:152)
      at org.apache.struts.util.PropertyMessageResources.<init>(PropertyMessageResources.java:127)
      at org.apache.struts.util.PropertyMessageResourcesFactory.createResources(PropertyMessageResourcesFactory.java:90)
      at org.apache.struts.util.MessageResources.getMessageResources(MessageResources.java:577)
      at org.apache.struts.action.ActionServlet.initInternal(ActionServlet.java:1329)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:464)

Please help urgent

0
Comment
Question by:LeanMoreTryMore
6 Comments
 
LVL 10

Assisted Solution

by:kupra1
kupra1 earned 200 total points
ID: 17879777
Since "NoSuchFieldError" is coming, you are getting the 500 error.
The reason being is that you are probably using the log4j 1.3 instead of 1.2.

log4j1.3 doesn't extend Priority. Hence, it doesn't find the field "INFO" and throws the "NoSuchFieldError".

To avoid this, you should use log4j1.2.*.
0
 
LVL 8

Expert Comment

by:reach2piyush
ID: 17879780
Make sure you have both log4j.jar and commons-logging.jar in your classpath
0
 
LVL 10

Assisted Solution

by:kupra1
kupra1 earned 200 total points
ID: 17879860
It shouldn't be the classpath issue becoz u would be getting the "NoSuchClass" error otherwise.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 10

Accepted Solution

by:
jaggernat earned 300 total points
ID: 17881024
Make sure your log4j.properties is set correctly.

log4j.properties file  should be  like this :

log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
log4j.logger.httpclient.wire.header=DEBUG
log4j.logger.org.apache.commons.httpclient=DEBUG
0
 

Author Comment

by:LeanMoreTryMore
ID: 17902403
it works.
that's exactly the problem is.

MANY THANKS
0
 
LVL 10

Expert Comment

by:jaggernat
ID: 17902598
u r welcome
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you thought ransomware was bad, think again! Doxware has the potential to be even more damaging.
Knowing where your website is hosted is as important as the features you receive, the monthly fee, and the support you receive. Due diligence should be done when choosing your next hosting provider.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question