Null pointer error


#1

null pointer error . its saying error in this line-
in conversion.java-
conversionConfig.setStoragePath(source.getParent().toString());


This Topic is created by atirtahir3 using the Email to Topic plugin.


Convert docx to pdf using groupdocs-conversion-17.12
#2

@amrit007,

Thank you for your inquiry.
It seems that storage path/directory is not configured properly. Please debug this line and see what path you are getting (does it return a valid path?).
Furthermore, you can see how we are setting the storage path here.


#3

i gave the path to my local correctly. now its showing -
[Fatal Error] :1:1: Content is not allowed in prolog.


#4

while passing the document …
.Conversion.convertToPdfAsFilePath(“D:/New folder/BSWordSample1.docx”);

here is the error coming saying -[Fatal Error] :1:1: Content is not allowed in prolog

i dont know what is thaT


#5

@amrit007,

Do you face this error for a particular file or for all the (different) source files?


#6

ok so it seems the license part is giving error… when i uncommented it , the error was gone.
in Mainclass-
//Utilities.applyLicenseFromFile();


#7

now the error is -Exception in thread “main” java.lang.VerifyError: Bad type on operand stack


#8

@amrit007,

How you are applying the license? You can easily apply it by following this article.


#9

public static final Path licensePath = getProjectBaseDir().resolve(“C:/Users/681120/Downloads/GroupDocs.Conversion-for-Java-master/License”);

    public static void applyLicense()
	{
		License lic=new License();
		lic.setLicense(licensePath.toString());
	}

this is how i am doing. but same error is coming.


#10

where i am doing wrong???:persevere:


#11

@amrit007,

Please try this way:

public static final Path licensePath = getProjectBaseDir().resolve("GroupDocs.Total.Java.lic");

In applyLicense method:

// Setup license
License lic = new License();
lic.setLicense(licensePath.toString());

and in getProjectBaseDir method:

public static Path getProjectBaseDir() {
Properties props = new Properties();
try {
		InputStream i = Utilities.class.getResourceAsStream("/project.properties");
		props.load(i);
	} catch (IOException x) {
		throw new RuntimeException(x);
	}
return FileSystems.getDefault().getPath(props.getProperty("project.basedir"));

}

(Utilities is the class name)

Finally, in your project.properties file:
project.basedir=${basedir}

Moreover, you can evaluate our sample GitHub project.


#12

ok did the same…seems that error resolved… but the error-
now the error is -Exception in thread “main” java.lang.VerifyError: Bad type on operand stack

what is it?


#13

Exception: Can’t find file: C:\Users\681120\Desktop\GroupDocs.Conversion-for-Java-master\Examples\GroupDocs.Conversion.Examples.Java\GroupDocs.Total.Java.lic.


#14

i am running out of deadline :disappointed_relieved:


#15

@amrit007,

It is clearly a path/directory issue. In order to further investigate it at our end, we need a simple console project (using that issue could be reproduced) from you. Or you can explore our example project.


#16

where is this “GroupDocs.Total.Java.lic” located in ur project?


#17

[Fatal Error] :1:1: Content is not allowed in prolog.
this error keep coming


#18

@amrit007,

In base directory (D:\GroupDocs.Conversion-for-Java\Examples\GroupDocs.Conversion.Examples.Java). For better elaboration, see this screenshot and observe the directory path - License Path.JPG (18.2 KB)


#19

is there any chance fault in License file?


#20

I am not having this file… mine looks like this…
Untitled.png (2.7 KB)