You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Szendi, Bence" <be...@accenture.com.INVALID> on 2021/03/11 13:15:08 UTC

asking for help regarding ClassNotFoundException: PreflightParser

Hello,

I would like to ask for your help regarding the following problem I am facing.
I am getting this exception, at runtime: java.lang.ClassNotFoundException: org.apache.pdfbox.preflight.parser.PreflightParser
The code is based on Java 8 and runs on a Weblogic 12c, built with maven 3.6.0.

I have the following dependencies in my project:
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
                                <dependency>
                                                <groupId>org.apache.pdfbox</groupId>
                                                <artifactId>pdfbox</artifactId>
                                                <version>2.0.22</version>
                                                <scope>compile</scope>
                                </dependency>

                                <!-- https://mvnrepository.com/artifact/org.apache.pdfbox/preflight -->
                                <dependency>
                                                <groupId>org.apache.pdfbox</groupId>
                                                <artifactId>preflight</artifactId>
                                                <version>2.0.22</version>
                                                <scope>compile</scope>
                                </dependency>

                                <!-- https://mvnrepository.com/artifact/org.apache.pdfbox/fontbox -->
                                <dependency>
                                                <groupId>org.apache.pdfbox</groupId>
                                                <artifactId>fontbox</artifactId>
                                                <version>2.0.22</version>
                                                <scope>compile</scope>
                                </dependency>

My code:
import org.apache.pdfbox.preflight.Format;
import org.apache.pdfbox.preflight.PreflightDocument;
import org.apache.pdfbox.preflight.ValidationResult;
import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
import org.apache.pdfbox.preflight.parser.PreflightParser;
...
public void validatePDF(DataHandler pdf) ...
{
...
      PreflightParser parser = new PreflightParser(pdf.getDataSource());
      parser.parse(Format.PDF_A1A);
      PreflightDocument document = parser.getPreflightDocument();
      document.validate();
      ValidationResult result = document.getResult()
...

( The exception is thrown at the line PreflightParser parser = new PreflightParser(pdf.getDataSource()); )

Remark: I have added fontbox to the dependencies based on an answer in this post: https://stackoverflow.com/questions/18503159/getting-java-lang-noclassdeffounderror-org-pdfbox-pdfparser, but it did not solve the problem.



Can you help me find the solution?



Thanks in advance and best regards,
Bence Szendi


________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com

Re: asking for help regarding ClassNotFoundException: PreflightParser

Posted by Tilman Hausherr <TH...@t-online.de>.
Likely a classpath problem. Are there any other external jars that you 
use? Do these work? If yes, look at how these are used in the pom.xml file.

Tilman

Am 11.03.2021 um 14:15 schrieb Szendi, Bence:
> Hello,
>
> I would like to ask for your help regarding the following problem I am facing.
> I am getting this exception, at runtime: java.lang.ClassNotFoundException: org.apache.pdfbox.preflight.parser.PreflightParser
> The code is based on Java 8 and runs on a Weblogic 12c, built with maven 3.6.0.
>
> I have the following dependencies in my project:
> <!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
>                                  <dependency>
>                                                  <groupId>org.apache.pdfbox</groupId>
>                                                  <artifactId>pdfbox</artifactId>
>                                                  <version>2.0.22</version>
>                                                  <scope>compile</scope>
>                                  </dependency>
>
>                                  <!-- https://mvnrepository.com/artifact/org.apache.pdfbox/preflight -->
>                                  <dependency>
>                                                  <groupId>org.apache.pdfbox</groupId>
>                                                  <artifactId>preflight</artifactId>
>                                                  <version>2.0.22</version>
>                                                  <scope>compile</scope>
>                                  </dependency>
>
>                                  <!-- https://mvnrepository.com/artifact/org.apache.pdfbox/fontbox -->
>                                  <dependency>
>                                                  <groupId>org.apache.pdfbox</groupId>
>                                                  <artifactId>fontbox</artifactId>
>                                                  <version>2.0.22</version>
>                                                  <scope>compile</scope>
>                                  </dependency>
>
> My code:
> import org.apache.pdfbox.preflight.Format;
> import org.apache.pdfbox.preflight.PreflightDocument;
> import org.apache.pdfbox.preflight.ValidationResult;
> import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
> import org.apache.pdfbox.preflight.parser.PreflightParser;
> ...
> public void validatePDF(DataHandler pdf) ...
> {
> ...
>        PreflightParser parser = new PreflightParser(pdf.getDataSource());
>        parser.parse(Format.PDF_A1A);
>        PreflightDocument document = parser.getPreflightDocument();
>        document.validate();
>        ValidationResult result = document.getResult()
> ...
>
> ( The exception is thrown at the line PreflightParser parser = new PreflightParser(pdf.getDataSource()); )
>
> Remark: I have added fontbox to the dependencies based on an answer in this post: https://stackoverflow.com/questions/18503159/getting-java-lang-noclassdeffounderror-org-pdfbox-pdfparser, but it did not solve the problem.
>
>
>
> Can you help me find the solution?
>
>
>
> Thanks in advance and best regards,
> Bence Szendi
>
>
> ________________________________
>
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
> ______________________________________________________________________________________
>
> www.accenture.com
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org