Thursday, September 20, 2012
JAXBcontext inside servlet context
You are trying to unmarshall an xml to a class in tomcat deployed app.
The class you want to unmarshall to is in the included jar with the jaxb.index. But even then we get the error:
failed to unmarshall, cannot find jaxb.index
JAXB context inside servlet in tomcat. Because of classloader being different. If the classes being unmarshalled are in a dependent jar, it will not be caught by the class loader.JAXBContext get instance takes in the package to load and the classLoader where the package could be found.
ClassLoader cl = Content.class.getClassLoader();
jaxbContext = JAXBContext.newInstance("com...domain", cl);
Subscribe to:
Posts (Atom)