URL jarURL = ExternalOrdersManagerUtils.class.getClassLoader().getResource("com/session/utils/ExternalOrdersManagerUtils.class");
JarURLConnection jurlConn = null;
try {
jurlConn = (JarURLConnection)jarURL.openConnection();
} catch (IOException e) {
logger.error(e.getMessage(),e);
}
Manifest mf = null;
try {
mf = jurlConn.getManifest();
} catch (IOException e) {
logger.error(e.getMessage(),e);
}
Attributes attr = mf.getMainAttributes();
I used the Java 8 version and jboss-6.1.0.Final_cp version deployment server. I got an error as follows. Please help me to fix this problem.
java.lang.ClassCastException: org.jboss.vfs.protocol.VirtualFileURLConnection cannot be cast to java.net.JarURLConnectionad.run(Thread.java:748) [:1.8.0_261]
You should load the manifest using
new Manifest(ExternalOrdersManagerUtils.class.getClassLoader().getResourceAsStream("/META-INF/manifest.mf"));