phax / peppol-commons

Java library with shared Peppol components - identifier handling, codelists, SBDH handler, SMP Client, SML Client
Apache License 2.0
29 stars 8 forks source link

java.lang.NoClassDefFoundError: jakarta/xml/bind/JAXBException #47

Closed francescodiperna closed 10 months ago

francescodiperna commented 10 months ago

Hi, I have updated the version to the library from 8.7.5 to 9.2.1. I got the exception in the title at line "new SBDMarshaller().getAsString (aSBD)" (see below).

Probably I need to update some other library, any idea?

Thanks


final PeppolSBDHData aData = PeppolSBDHData.createUBL21 (documento.getDocumentElement (),
                    PeppolIdentifierFactory.INSTANCE)
      .setSenderWithDefaultScheme (sender)
      .setReceiverWithDefaultScheme (receiver)
      .setDocumentTypeWithBusdoxDocidQns (docType)
      .setProcessWithDefaultScheme (procType)
      .setCountryC1 ("IT");

            // Create the SBDH document
            final StandardBusinessDocument aSBD = new PeppolSBDHDocumentWriter().createStandardBusinessDocument (aData);
            result = new SBDMarshaller().getAsString (aSBD);
phax commented 10 months ago

The new versions switched from JAXB 2.x to JAXB 4.x which means that you need to update your implementation accordingly. This is needs to consider all libraries. It also depends on Spring Boot etc.

francescodiperna commented 10 months ago

Thanks, at moment I cannot use JAXB 4.x because I'm using Spring boot 2.X. Is there another way to add the country code with the version 8.8.5, I see you add the method "setCountryC1" but in the resulting XML I cannot find.


PeppolIdentifierFactory.INSTANCE)
                        .setSenderWithDefaultScheme (sender)
                        .setReceiverWithDefaultScheme (receiver)
                        .setDocumentTypeWithBusdoxDocidQns (docType)
                        .setProcessWithDefaultScheme (procType);
                        .setCountryC1("IT");
phax commented 10 months ago

In general that should do the trick - I also checked the code and it was good. Eventually there is some code in the middle that overwrites it?

francescodiperna commented 10 months ago

Nothing in the middle. It seems that che country code is not written in the following instrunction:

final StandardBusinessDocument aSBD = new PeppolSBDHDocumentWriter().createStandardBusinessDocument (aData);

phax commented 10 months ago

But it is here: https://github.com/phax/peppol-commons/blob/8.x/peppol-sbdh/src/main/java/com/helger/peppol/sbdh/write/PeppolSBDHDocumentWriter.java#L175

phax commented 10 months ago

Ah, please us v8.8.6 - see https://github.com/phax/peppol-commons/tree/8.x#news-and-noteworthy

francescodiperna commented 10 months ago

It works, thanks