Tuesday, 6 August 2013

Getting a file from WAR file

Getting a file from WAR file

I am trying to get a file from my WAR file.
URL url2 = getClass().getClassLoader().getResource("/package.xsd");
And when I print getPath(), this is the output:
/C:/workspacesFresh2/.metadata/.plugins/org.eclipse.wst.core/tmp1/wtpwebapps/GServer/WEB-INF/lib/GLibrary.jar!/package.xsd
So, it finds the package.xsd, but I can't open it with that path.
Any ideas as to how I can access the file?
The error:
org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema
document
'file:/C:/workspacesFresh2/.metadata/.plugins/org.eclipse.server.core/tmp1/wtpwebapps/Server/WEB-INF/lib/GLibrary.jar!/package.xsd',
because 1) could not find the document; 2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
Thanks

No comments:

Post a Comment