Search code examples
javatomcatjaxbserializable

jaxb and serializable from marshalling server.xml for tomcat server


I need to extract server.xml from tomcat server for got it updated automatically.
I create xsd file from file but now instead turn me the classical bean it return me a List.
In this list i got 2 different element: ResourceType and ManagerType.
How i can cast them to appropriate Class?
I've tried with casting to class (ignoring exception!) but it doesnt work...
I've tried with 'instance of' but it doesnt work...
I've tried with unmarshalling with jaxb method but there is no way to cast serializable to InputStream...
I've run out of ideas.
I see that at runtime the object serializable contain the name of class (ResourceType for instance), but i dont find the way to get it out...
Someone has suggestions?


Solution

  • The solution was to cast serializable object to JAXBElement<T> where T is class i was searching for (JAXBElement<ManagerType> for instance).