Pessoal, estou dando uma manutencao no sistema, e esta dando o seguinte erro :
java.lang.NullPointerException
O erro esta na linha debaixo
return (T) JAXBContext.newInstance(c).createUnmarshaller().unmarshal(new FileInputStream(ServicoUtils.class.getClassLoader().getResource(d).getPath().replace("%20", " ")));
entao, nao tenho ctz, mas nao esta achando o xml ou a minha classe
alguem pode me dar uma luz ??
String url = "META-INF/configempresas.xml";
try {
for (Configempresa cx : ServicoUtils.leitorXmlArquivo(url, Configempresas.class).getConfigempresa()) {
System.out.print("teste");
}
} catch (JAXBException ex) {
Logger.getLogger(FiltroAutenticacao.class.getName()).log(Level.SEVERE, null, ex);
} catch (FileNotFoundException ex) {
Logger.getLogger(FiltroAutenticacao.class.getName()).log(Level.SEVERE, null, ex);
}
********************************
public class ServicoUtils {
public static <T> T leitorXmlArquivo(String d, Class<T> c) throws JAXBException, FileNotFoundException {
return (T) JAXBContext.newInstance(c).createUnmarshaller().unmarshal(new FileInputStream(ServicoUtils.class.getClassLoader().getResource(d).getPath().replace("%20", " ")));
}