0

Jar placement - Aspose.BarCode.jar and servlet.jar files have been placed under the ColdFusion Instance as per Aspose site for word

Jar path: ColdFusion2016\Instance-1\wwwroot\WEB-INF\lib

Code The code I am trying to run, all failed.

 try {
            somevar=5;
            pdflib1 = createObject("java","com.pdflib.pdflib");
            writedump("pdflib1 initiated");
    //below did not worked
            
            //asposeObj = CreateObject("java", "com.aspose.barcode.generation.BarCodeGenerator");
            asposeObj = CreateObject("java", "com.aspose.barcode.BarCodeGenerator");

//below code worked
            //asposeObj = CreateObject("java", "com.aspose.barcode.BarCodeException");
        }
        catch(any ex){  
            writedump(ex);
        }

Error it is giving class not found.

ClassName Aspose.Barcode.BarCodeBuilder Detail Class not found: Aspose.Barcode.BarCodeBuilder ErrorMessage Aspose.Barcode.BarCodeBuilder Message Object Instantiation Exception. RootCause struct Message Aspose.Barcode.BarCodeBuilder StackTrace java.lang.ClassNotFoundException: Aspose.Barcode.BarCodeBuilder at coldfusion.bootstrap.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:303) at java.base/java.lan

Can someone please suggest how to initiate Java Aspose Barcode?

Anil
  • 3,722
  • 2
  • 24
  • 49
  • 1
    Did you install the jar file in an appropriate folder (one included in the classpath for ColdFusion)? After doing that, did you restart the ColdFusion service to pick up the new file? – Miguel-F Aug 07 '23 at 18:10
  • yes jar file was placed as 1st step. ColdFusion services were also restarted. – Anil Aug 08 '23 at 08:31
  • 1
    Hrm well the error suggests CF doesn't think the jar file is there. Where exactly did you put it (don't answer here, update the question as this is critical information to the question you are asking). – Adam Cameron Aug 08 '23 at 10:07
  • Thanks @AdamCameron , jar path has been updated in Question, – Anil Aug 08 '23 at 12:38

1 Answers1

1

I found my issue, adding answer here for other to refer. The c is small in class name, BarcodeGenerator. My mistake was to use it as BarCodeGenerator, however it should be BarcodeGenerator Working code

<cfscript>
writedump("aspose before test");

try {
    asposeObj = CreateObject("java", "com.aspose.barcode.generation.BarcodeGenerator");
    writedump("asposeObj initiated");
}
catch(any ex){  
    writedump(ex);
}
Anil
  • 3,722
  • 2
  • 24
  • 49