title: Trying to add log4j in plugin type project. Error : java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
body: <p>I am trying to add Log4j.jar in plugin project for logging purpose. I add the log4j jar by using build path->add external jar. After that I am trying to run the plugin project I get error </p>
  
  <blockquote>
    <p>java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator. </p>
    
    <p>if I run the same code by using java main method it will working fine. </p>
  </blockquote>
  
  <pre><code>public HHLogger(Object className) {
      DateTimeFormatter df  = DateTimeFormatter.ofPattern("ddMMYYYY");
      System.setProperty("filename", df.format(LocalDate.now()));
      PropertyConfigurator.configure(".\\resources\\log4j.properties");
      logger = Logger.getLogger(className.getClass());
  }
  
  
  
  public static void main(String args[]) {
      DateTimeFormatter df  = DateTimeFormatter.ofPattern("ddMMYYYY");
      System.setProperty("filename", df.format(LocalDate.now()));
      PropertyConfigurator.configure(".\\resources\\log4j.properties");
      logger = Logger.getLogger(HHLogger.class);
      logger.info(" 999 Welcom");
  
  }
  </code></pre>
  
  <p>java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
      at com.americanexpress.connecthotelforgbt.utility.HHLogger.(HHLogger.java:22)
      at com.americanexpress.connecthotelforgbt.parsers.OhhRqRsParser.(OhhRqRsParser.java:104)
      at com.americanexpress.connecthotelforgbt.DataIntelliSense.upshellcommand(DataIntelliSense.java:322)
      at com.americanexpress.connecthotelforgbt.listener.CommandModificationService.process(CommandModificationService.java:102)
      at com.sabre.edge.cf.core.executors.PublicServiceExecutor.decide(PublicServiceExecutor.java:143)
      at org.jbpm.graph.node.Decision.execute(Decision.java:85)
      at org.jbpm.graph.def.Node.enter(Node.java:314)
      at org.jbpm.graph.def.Transition.take(Transition.java:151)
      at org.jbpm.graph.def.Node.leave(Node.java:389)
      at org.jbpm.graph.node.StartState.leave(StartState.java:70)
      at org.jbpm.graph.exe.Token.signal(Token.java:192)
      at org.jbpm.graph.exe.Token.signal(Token.java:140)
      at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:271)
      at com.sabre.edge.cf.core.flow.JBPMFlowExecutor.execute(JBPMFlowExecutor.java:45)
      at com.sabre.edge.cf.core.SRWRuntime.executeWorkflow(SRWRuntime.java:238)
      at com.sabre.edge.cf.core.SRWRuntime.process(SRWRuntime.java:173)
      at com.sabre.edge.cf.emu.bridge.EmulatorBridge.processServiceContext(EmulatorBridge.java:198)
      at com.sabre.edge.cf.emu.bridge.EmulatorBridge.updateCommand(EmulatorBridge.java:87)
      at com.sabre.stn.emulator.core.bridge.BridgeFilter.preSend(BridgeFilter.java:80)
      at com.sabre.stn.emulator.basic.model.BasicEmulatorModel.sendPreProcess(BasicEmulatorModel.java:3737)
      at com.sabre.stn.emulator.basic.model.BasicEmulatorModel.sendMessage(BasicEmulatorModel.java:3596)
      at com.sabre.stn.emulator.basic.model.BasicEmulatorModel.doEnter(BasicEmulatorModel.java:3516)
      at com.sabre.stn.emulator.basic.model.BasicEmulatorModel.enter(BasicEmulatorModel.java:1749)
      at com.sabre.stn.emulator.basic.BasicEmulator.enter(BasicEmulator.java:1979)
      at com.sabre.stn.emulator.core.EmuManager.emptyTheKeyBuffer(EmuManager.java:1132)
      at com.sabre.stn.emulator.core.KeysToScreenThread.run(KeysToScreenThread.java:78)
  Caused by: java.lang.ClassNotFoundException: org.apache.log4j.PropertyConfigurator
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      ... 26 more</p>