Prezados, bom dia.
Estou tendo dificuldades para resolver um problema na leitura de um .xml de uma NFe. Estruturei o código todo utilizando JAXB porem tenho o seguinte erro.
Código no GIT: Ler XML
Erro:
“C:\Program Files\Java\jdk-17\bin\java.exe” “-javaagent:E:\IntelliJ IDEA Community Edition 2023.2.3\lib\idea_rt.jar=53385:E:\IntelliJ IDEA Community Edition 2023.2.3\bin” -Dfile.encoding=UTF-8 -classpath “E:\Projetos Java\Projeto Auditoria\target\classes;C:\Users\RAFAEL.m2\repository\org\codehaus\mojo\jaxb2-maven-plugin\3.1.0\jaxb2-maven-plugin-3.1.0.jar;C:\Users\RAFAEL.m2\repository\com\sun\xml\bind\jaxb-xjc\3.0.0\jaxb-xjc-3.0.0.jar;C:\Users\RAFAEL.m2\repository\com\sun\xml\bind\jaxb-core\3.0.0\jaxb-core-3.0.0.jar;C:\Users\RAFAEL.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\3.0.0\jakarta.xml.bind-api-3.0.0.jar;C:\Users\RAFAEL.m2\repository\com\sun\activation\jakarta.activation\2.0.0\jakarta.activation-2.0.0.jar;C:\Users\RAFAEL.m2\repository\com\sun\xml\bind\jaxb-jxc\3.0.0\jaxb-jxc-3.0.0.jar;C:\Users\RAFAEL.m2\repository\com\sun\xml\bind\jaxb-impl\3.0.0\jaxb-impl-3.0.0.jar;C:\Users\RAFAEL.m2\repository\com\thoughtworks\qdox\qdox\2.0.1\qdox-2.0.1.jar;C:\Users\RAFAEL.m2\repository\org\codehaus\plexus\plexus-compiler-api\2.11.1\plexus-compiler-api-2.11.1.jar;C:\Users\RAFAEL.m2\repository\org\codehaus\plexus\plexus-utils\3.1.0\plexus-utils-3.1.0.jar;C:\Users\RAFAEL.m2\repository\org\sonatype\plexus\plexus-build-api\0.0.7\plexus-build-api-0.0.7.jar;C:\Users\RAFAEL.m2\repository\com\sun\istack\istack-commons-runtime\4.0.0\istack-commons-runtime-4.0.0.jar” org.example.Main
Exception in thread “main” java.lang.NullPointerException: Cannot invoke “org.example.xmls.models_jaxb.NFe.getInfNFe()” because the return value of “org.example.xmls.models_jaxb.NfeProc.getNFe()” is null
at org.example.Main.main(Main.java:29)
Process finished with exit code 1