1 2 Previous Next 15 Replies Latest reply on Sep 9, 2008 1:18 AM by Ashok Kadam

    unable to find log4j.properties file in classpath

    Ashok Kadam Newbie

      Hi,

      I am using following folder structure in my EAR.
      .EAR
      |
      log4j.properties
      log4j.jar
      myCustomJars.jar
      myWar.war
      myEjb.jar
      |META-INF
      jboss-web.xml
      application.xml

      Here from myCustomJars.jar I am trying to load log4j.properties. And there has been some problem. Log file is not generating. My class is not able to find log4j.prop in classpath. It searches in jboss-home/lib as it's default dir.

      Please suggest,

      -Ashok

        • 2. Re: unable to find log4j.properties file in classpath
          Ashok Kadam Newbie

          Hi ,
          Thanks for your reply.

          The configurations given in link you sent were helpful.
          But my actual concern is I want to provide those configuration using log4j.properties. I am unable to load that configuration file from my java files.

          Regards,
          -Ashok

          • 4. Re: unable to find log4j.properties file in classpath
            Ashok Kadam Newbie

            Hi JaiKiran,

            I am using jboss-5.0.0.CR1.
            I have referred your blog at http://jaitechwriteups.blogspot.com for log4j configurations.
            I have done exact setup suggested by you.
            Also I have tried it on jboss-4.0.5.GA. but no use.
            log files are not getting generated.
            I have 2 EAR's
            1]Containing only war,EJB interfaces and supporting jars with application.xml etc
            2]Containing EJB's and supporting jars with conf files.

            In both of the EAR files I am giving log4j.prop and log4j.jar suggested by you at your blog.

            Please suggest.

            Thanks and Regards,
            -Ashok

            • 5. Re: unable to find log4j.properties file in classpath
              jaikiran pai Master

               

              I am using jboss-5.0.0.CR1.


              I haven't tried with 5.0 CR1. But i believe it should work.

              I have 2 EAR's


              Let's just concentrate on one EAR for now.

              Post the output of:

              jar -tf MyEAROne.ear


              where MyEAROne.ear is the name of your EAR file.

              While posting the logs or xml content or code, remember to wrap it in a code block using the Code button in the message editor window and please hit the Preview button to make sure your post is correctly formatted

              • 6. Re: unable to find log4j.properties file in classpath
                Ashok Kadam Newbie

                Hi Jaikiran,

                Thanks for your quick reply.
                Here is ouput of


                jar -tf MyEAROne.ear


                META-INF/
                META-INF/MANIFEST.MF
                User_Form.war
                User_Form_EJBClient.jar
                User_Form_dao.jar
                User_Form_Utils.jar
                log4j-1.2.15.jar
                log4j.properties
                META-INF/application.xml
                META-INF/jboss-web.xml
                




                Regards,
                -Ashok

                • 7. Re: unable to find log4j.properties file in classpath
                  jaikiran pai Master

                  1) Create a lib folder at the root of the EAR and move the log4j and other jar files into that lib folder.

                  MyEAROne.ear
                   |
                   |--- META-INF
                   | |
                   | |--- application.xml
                   | |
                   | |--- jboss-app.xml
                   |
                   |
                   |--- lib
                   | |
                   | |--- log4j-1.2.15.jar
                   | |
                   | |--- User_Form_Utils.jar
                   | |
                   | |
                   | |--- User_Form_dao.jar
                   | |
                   | |--- User_Form_Utils.jar
                   |
                   |
                   |--- User_Form.war
                  



                  2)
                  META-INF/jboss-web.xml


                  This is incorrect. For an EAR file, you should have a jboss-app.xml. That jboss-app.xml will contain the classloading configuration.

                  • 8. Re: unable to find log4j.properties file in classpath
                    Ashok Kadam Newbie

                    Hi Jaikiran,

                    I have made following changes to my EAR file.
                    And tested but still no use.

                    META-INF/
                    META-INF/MANIFEST.MF
                    User_Form.war
                    User_Form_EJBClient.jar
                    APP-INF/
                    APP-INF/lib/
                    APP-INF/lib/log4j-1.2.15.
                    log4j.properties
                    User_Form_Utils.jar
                    User_Form_dao.jar
                    META-INF/application.xml
                    META-INF/jboss-app.xml
                    



                    But I am having following error while deploying it on Jboss 5.0
                    17:12:03,471 WARN [HDScanner] Scan failed
                    org.jboss.deployers.spi.DeploymentException: Exception determining structure: AbstractVFSDeployment(User_Form.ear)
                     at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                     at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:85)
                     at org.jboss.deployers.plugins.main.MainDeployerImpl.determineStructure(MainDeployerImpl.java:845)
                     at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:303)
                     at org.jboss.deployers.plugins.main.MainDeployerImpl.addDeployment(MainDeployerImpl.java:260)
                     at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:267)
                     at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
                     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
                     at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
                     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
                     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
                     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
                     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
                     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
                     at java.lang.Thread.run(Thread.java:595)
                    Caused by: java.lang.RuntimeException: Error determining structure: User_Form.ear
                     at org.jboss.deployment.EARStructure.determineStructure(EARStructure.java:278)
                     at org.jboss.deployers.vfs.plugins.structure.StructureDeployerWrapper.determineStructure(StructureDeployerWrapper.java:72)
                     at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.doDetermineStructure(VFSStructuralDeployersImpl.java:196)
                     at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.determineStructure(VFSStructuralDeployersImpl.java:220)
                     at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:77)
                     ... 14 more
                    Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: class-loading not found as a child of jboss-app
                     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203)
                     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:183)
                     at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:161)
                     at org.jboss.deployment.EARStructure.determineStructure(EARStructure.java:168)
                     ... 18 more
                    Caused by: org.jboss.xb.binding.JBossXBRuntimeException: class-loading not found as a child of jboss-app
                     at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:396)
                     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401)
                     at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                     at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
                     at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
                     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
                     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
                     at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
                     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:199)
                     ... 21 more
                    


                    Though getting deployed on Jboss 4.0 but here my logs are getting appended in /log/server.log file


                    I guess my class is unable to locate the log4j.properties and since not loading my configuration from log4j.prop.

                    Regards,
                    -Ashok

                    • 9. Re: unable to find log4j.properties file in classpath
                      jaikiran pai Master

                      Your EAR packaging still does not look right. You have created a new folder named "APP-INF" and placed the jar in the subfolder "lib" under APP-INF. JBoss does not recognize this "APP-INF" folder. Please read through my earlier reply again to see how the packaging should look like.

                      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: class-loading not found as a child of jboss-app


                      I guess, you did something wrong in the jboss-app.xml. Please post its contents.


                      • 10. Re: unable to find log4j.properties file in classpath
                        Ashok Kadam Newbie

                        Hi Jaikiran,

                        Problem is now solved for following structure of my .EAR file

                        UserForm.EAR
                         |
                         |----META-INF
                         | |
                         | |--MANIFEST.MF
                         | |--application.xml
                         | |--jboss-app.xml
                         |
                         |----lib
                         | |
                         | |--log4j-1.2.15.jar
                         |
                         |----User_Form.war
                         |
                         |----User_Form_EJBClient.jar
                         |
                         |----User_Form_Utils.jar
                         |
                         |----User_Form_dao.jar
                         |
                         |----log4j.properties
                        


                        Now Jboss is loading my files and also ganerating log files(blank) at specified path from log4j.prop (at EAR file deployment).
                        *But still I am getting getting file not found exception while accessing files from my java class.

                        Regards,
                        -Ashok

                        • 11. Re: unable to find log4j.properties file in classpath
                          Ashok Kadam Newbie

                          Hi Jaikiran,

                          Can you put your comments on my previous post?


                          Thanks and Regards,
                          -Ashok

                          • 12. Re: unable to find log4j.properties file in classpath
                            jaikiran pai Master

                             

                            "ashok.kadam" wrote:

                            *But still I am getting getting file not found exception while accessing files from my java class.



                            You will have be provide us more details. This thread started off with configuring your own log4j.properties file in the EAR, which you have been able to successfully configure at this point.

                            Post the exception stacktrace that you are seeing. Also what file are you trying to access and how? Post the code too.


                            • 13. Re: unable to find log4j.properties file in classpath
                              Ashok Kadam Newbie

                              Hi Jaikiran,

                              Here is some more information about my case.

                              I have written my own classes for logging which extends functionality of logging as follows,

                              BaseLogger --> Abstraction class for debuging and logging.Loads the
                              logging configuration. And uses the Logger for logging
                              functionality.
                              DefaultLogger-->Default logger class extends BaseLogger used for logging
                              purpose by Actions, utility classes etc.
                              EjbLogger -->Extends BaseLogger. Used for logging purpose by EJB's
                              only.

                              Now here is the code used to load propertifile. It is used by BaseLogger

                              
                              import org.apache.log4j.Logger;
                              import org.apache.log4j.PropertyConfigurator;
                              
                              /**
                               * This class is an abstraction class for debuging and logging.
                               *
                               * @author Ashok Kadam
                               * @since 29th August 2008
                               */
                              public abstract class BaseLogger {
                              
                               public static final String TRACE = "TRACE";
                               public static final String DEBUG = "DEBUG";
                               public static final String INFO = "INFO";
                               public static final String WARN = "WARN";
                               public static final String ERROR = "ERROR";
                               public static final String FATAL = "FATAL";
                              
                               protected static final String PREFIX_SEPARATER = ".";
                              
                               private boolean isEnabled = true;
                               protected String logLevel = INFO;
                              
                               private static final String DEFAULT_LOGLEVEL = INFO;
                              
                               protected Logger logger = null;
                              
                               /**
                               * Default BaseLogger Constructor.
                               */
                               private BaseLogger() {
                               PropertyConfigurator.configure("log4j.properties");
                               logLevel = DEFAULT_LOGLEVEL;
                               }
                              
                               /**
                               * BaseLogger Constructor.
                               *
                               * @param loggerName - Name of the Logger
                               */
                               public BaseLogger(String loggerName) {
                               this();
                               this.logger = Logger.getLogger(loggerName);
                               }
                              
                               /**
                               * BaseLogger Constructor
                               *
                               * @param loggerComponent - Name of the Logger Component
                               */
                               public BaseLogger(Object loggerComponent) {
                               this(loggerComponent.toString());
                               }
                              
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               */
                               public void debug(Object obj) {
                               if(isEnabled) {
                               logger.debug(obj);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               * @param exp - Exception for printing the StackTrace
                               */
                              
                               public void debug(Object obj, Throwable exp) {
                               if(isEnabled) {
                               logger.debug(obj,exp);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               */
                               public void info(Object obj) {
                               if(isEnabled) {
                               logger.info(obj);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               * @param exp - Exception for printing the StackTrace
                               */
                               public void info(Object obj, Throwable exp) {
                               if(isEnabled) {
                               logger.info(obj,exp);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               */
                               public void warn(Object obj) {
                               if(isEnabled) {
                               logger.warn(obj);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               * @param exp - Exception for printing the StackTrace
                               */
                               public void warn(Object obj, Throwable exp) {
                               if(isEnabled) {
                               logger.warn(obj,exp);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               */
                               public void error(Object obj) {
                               if(isEnabled) {
                               logger.error(obj);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               * @param exp - Exception for printing the StackTrace
                               */
                               public void error(Object obj, Throwable exp) {
                               if(isEnabled) {
                               logger.error(obj, exp);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               */
                               public void fatal(Object obj) {
                               if(isEnabled) {
                               logger.fatal(obj);
                               }
                               }
                              
                               /**
                               *
                               * @param obj - Message to be printed
                               * @param exp - Exception for printing the StackTrace
                               */
                               public void fatal(Object obj, Throwable exp) {
                               if(isEnabled) {
                               logger.fatal(obj,exp);
                               }
                               }
                              }
                              
                              


                              Here the first private constructor is providing logging configuration from log4j.prop at,
                              private BaseLogger() {
                               PropertyConfigurator.configure("log4j.properties");
                               logLevel = DEFAULT_LOGLEVEL;
                              }
                              


                              I am getting following Exception

                              log4j:ERROR Could not read configuration file [log4j.properties].
                              java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)
                               at java.io.FileInputStream.open(Native Method)
                               at java.io.FileInputStream.<init>(FileInputStream.java:106)
                               at java.io.FileInputStream.<init>(FileInputStream.java:66)
                               at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
                               at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:342)
                               at com.pearson.arch.utils.logging.BaseLogger.<init>(BaseLogger.java:38)
                               at com.pearson.arch.utils.logging.BaseLogger.<init>(BaseLogger.java:48)
                               at com.pearson.arch.utils.logging.Debug.<init>(Debug.java:28)
                               at com.pearson.arch.action.Login.execute(Login.java:22)
                               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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:399)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:262)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:224)
                               at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213)
                               at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
                               at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
                               at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:161)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
                              
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInterceptor.java:115)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
                               at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507)
                               at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:183)
                               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:189)
                               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:90)
                               at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:96)
                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                               at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:325)
                               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
                               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
                               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                               at java.lang.Thread.run(Thread.java:595)
                              log4j:ERROR Ignoring configuration file [log4j.properties].
                              <Entry in LoginAction --------------------------------------------------------->>>
                              log4j:ERROR Could not read configuration file [log4j.properties].
                              java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)
                               at java.io.FileInputStream.open(Native Method)
                               at java.io.FileInputStream.<init>(FileInputStream.java:106)
                               at java.io.FileInputStream.<init>(FileInputStream.java:66)
                               at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
                               at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:342)
                               at com.pearson.arch.utils.logging.BaseLogger.<init>(BaseLogger.java:38)
                               at com.pearson.arch.utils.logging.BaseLogger.<init>(BaseLogger.java:48)
                               at com.pearson.arch.utils.logging.Debug.<init>(Debug.java:28)
                               at com.pearson.arch.locator.ServiceLocator.<init>(ServiceLocator.java:46)
                               at com.pearson.arch.locator.ServiceLocator.<clinit>(ServiceLocator.java:33)
                               at com.pearson.arch.delegate.UserFormDelegate.<init>(UserFormDelegate.java:36)
                               at com.pearson.arch.delegate.UserFormDelegate.getInstance(UserFormDelegate.java:51)
                               at com.pearson.arch.action.Login.execute(Login.java:30)
                               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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:399)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:262)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:224)
                               at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213)
                               at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
                               at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
                               at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:161)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInterceptor.java:115)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
                               at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
                               at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
                               at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
                               at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
                               at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507)
                               at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:183)
                               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:189)
                               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:90)
                               at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:96)
                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                               at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:325)
                               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
                               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
                               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                               at java.lang.Thread.run(Thread.java:595)
                               log4j:ERROR Ignoring configuration file [log4j.properties].
                              
                              


                              Please suggest. If you want any other information please reply.

                              -Ashok


                              • 14. Re: unable to find log4j.properties file in classpath
                                jaikiran pai Master

                                The PropertyConfigurator.configure(filename) expects an absolute filename path.

                                How about changing this piece of code:

                                "ashok.kadam" wrote:

                                
                                 /**
                                 * Default BaseLogger Constructor.
                                 */
                                 private BaseLogger() {
                                 PropertyConfigurator.configure("log4j.properties");
                                 logLevel = DEFAULT_LOGLEVEL;
                                 }
                                
                                


                                to:
                                private BaseLogger() {
                                 Properties props = new Properties();
                                
                                 //load from classpath
                                 InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("log4j.properties");
                                 props.load(inputStream);
                                
                                 // Now pass these properties to PropertyConfigurator
                                 PropertyConfigurator.configure(props);
                                
                                 logLevel = DEFAULT_LOGLEVEL;
                                }
                                


                                1 2 Previous Next