Category Archives: apache-commons

Apache common daemon procrun with batch file

i wrote a simple batch file which reads the configuration from a external file. the script looks like this:

@echo off

for /f "delims=" %%x in (test-config.txt) do (
    set "%%x" 

prunsrv.exe //IS//%SERVICE_NAME%

and my configuration like this:

PR_DESCRIPTION=test description




for some reason, the configuration are not applied at all while installing the service. this can be seen at the description for example, as it does not get set. does anyone know why the configuration is not applied?

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/BeanMap

I am trying to use below code for comparing two object values and print the mismtach:

  BeanMap map = new BeanMap(ep);
  PropertyUtilsBean propUtils = new PropertyUtilsBean();
  for (Object propNameObject : map.keySet()) {
     String propertyName = (String) propNameObject;
     Object expectedValue = propUtils.getProperty(ep, propertyName);
     Object actualValue = propUtils.getProperty(ap, propertyName);
     if (!expectedValue.equals(actualValue)) {
        WorkloadGeneratorLogger.log("> " + propertyName
              + " is different (oldValue=\"" + expectedValue
              + "\", newValue=\"" + actualValue + "\")");

Getting below error while using beanMap:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/BeanMap ..................... Caused by: java.lang.ClassNotFoundException:


Below is my pom.xml entries for the same:


Not sure what is being missed here,I tried the same combination of jars suggested by below link:

java.lang.NoClassDefFoundError: org/apache/commons/collections/Transformer

Still unable to sort this out.

commons-beanutils: if set method return is this model, can’t get writeMethod [on hold]

private long payActualMoney; 

public long getPayActualMoney() {
  return this.payActualMoney;

public TAllocate setPayActualMoney(long payActualMoney) {
  this.payActualMoney = payActualMoney;
  return this;

PropertyUtils.getPropertyDescriptors not return payActualMoney 's writeMethod,and return an property 'setPayActualMoney'

Issues with CloseableHttpClient throwing NullPointerException

I am using the CloseableHttpClient to make an api call. However, I am getting the NullPointerException with the following stack trace:


I have looked for it but haven't found any concrete post regarding it. Any suggestions?

Apache Commons Codec

i missed my class on Apache Commons for java earlier this week and was wondering if someone could just help explain this code for me, can't find any tutorials on line specifically for this :/

Soundex s = new Soundex();
System.out.println("Soundex: " + s.encode(args[0]));

Nysiis n = new Nysiis();
System.out.println("Nysiis: " + n.encode(args[0]));

Caverphone2 c = new Caverphone2();
System.out.println("Caverphone2: " + c.encode(args[0]));

Metaphone m = new Metaphone();
System.out.println("Metaphone: " + m.encode(args[0]));

And also if there is different syntax for them . Thank you!

How to check incoming file transfer status in apache commons io monitor

I have implemented a simple file listener using Apache commons io monitor.I have also implemented a selenium script that simply do is download file into the pre hard coded path folder.That is totally working fine.My listener monitoring downloaded files and collect the necessary information.According to my requirement i should be able to stop the file listener once my selenium script is finished execution.To do that i must know that the incoming file transferring status to handle it better way.because i can not stop listener middle of the file transferring.(sometimes download file can be heavy so it will take some time to download).So how can i know that incoming file status in Apache commons io monitor before stop the file listener.If any one knows please let me know.

Sample code snippet

    public class SimpleTestMonitor {
    // A hardcoded path to a folder you are monitoring .
    public static final String FOLDER =

    public static void main(String[] args) throws Exception {
        // The monitor will perform polling on the folder every 5 seconds
        final long pollingInterval = 5 * 1000;

        File folder = new File(FOLDER);

        if (!folder.exists()) {
            // Test to see if monitored folder exists
            throw new RuntimeException("Directory not found: " + FOLDER);

        FileAlterationObserver observer = new FileAlterationObserver(folder);
        FileAlterationMonitor monitor =
                new FileAlterationMonitor(pollingInterval);
        FileAlterationListener listener = new FileAlterationListenerAdaptor() {
            // Is triggered when a file is created in the monitored folder
            public void onFileCreate(File file) {
                try {
                    // "file" is the reference to the newly created file
                    System.out.println("File created: "
                            + file.getCanonicalPath());
                } catch (IOException e) {

            // Is triggered when a file is deleted from the monitored folder
            public void onFileDelete(File file) {
                try {
                    // "file" is the reference to the removed file
                    System.out.println("File removed: "
                            + file.getCanonicalPath());
                    // "file" does not exists anymore in the location
                    System.out.println("File still exists in location: "
                            + file.exists());
                } catch (IOException e) {