I would like to load jboss published in the EAR file jar all xml, but not to 
load path, Jboss 4 in the original path:the jar's file path = D: / 
Java/Jboss/server/default/tmp/deploy/tmp29312liveos.ear- contents / liveos.jar, 
but in jboss 5 :the jar's file path = D: / Java / Jboss / server / default / 
deploy / liveos.ear / liveos.jar, why not the jar's file path = D: \ Java \ 
Jboss \ server \ default \ tmp \ vfs-nested.tmp/02804a5d_liveos.jar, such 
JarFile jarFile = new JarFile (filename); can not find jar

private void loadConfig() {
        try {
            String osName = System.getProperty("os.name");
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            String url = 
loader.getResource(BillConfigCache.class.getName().replace(".", "/") + 
".class").toString();
            logger.debug("Current class's filepath : " + url);
            String filename;
            if (osName != null && osName.indexOf("Windows") != -1) {
                logger.debug("Current class begin : " + 
url.substring(url.indexOf("/")) +"/"+url.substring(url.indexOf(".jar/")+4));
                filename = url.substring(url.indexOf("/") + 1, 
url.indexOf(".jar/") + 4);
                //filename = url.substring(url.indexOf("/") + 1, 
url.indexOf("!"));//Jboss 4
            } else {
                filename = url.substring(url.indexOf("/"), url.indexOf(".jar/") 
+ 4);
                //filename = url.substring(url.indexOf("/"), 
url.indexOf("!"));//Jboss 4
            }
            filename = filename.replace("%20", " ");
            logger.debug("jar's file path = " + filename);

            JarFile jarFile = new JarFile(filename);
            Enumeration entries = jarFile.entries();
            while (entries.hasMoreElements()) {
                JarEntry jarEntry = entries.nextElement();
                String configFile = jarEntry.getName();
                if (jarEntry.getName().toLowerCase().endsWith("xml")) {
                    logger.debug("Bill Config File : " + configFile);
                    InputStream inputStream = 
loader.getResourceAsStream(configFile);
                    List templateList = createBillTemplate(inputStream);
                    cacheBillTemplate(templateList);
                }
            }


        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new PAOSBusinessException(e.getMessage(), e);
        }
    }

Any suggestions?thanks!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196435#4196435

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196435
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to