weblogic 扫描不到jar包的类问题解决方案

是由于见识的比较少
不知道weblogic jar包使用的是zip协议
偶然发现日志中都是URL [zip:E:/weblogic/user_projects/domains/base_domain/lib/com.xxx.jar!/,
利用之前的见识 偶然一猜,果然是之前扫描的时候的问题,之前只扫描了file和jar包,对于zip类型的没有处理
,果然加上一个if条件 就可以了。。。。
if(URL_PROTOCOL_JAR.equals(protocol)||URL_PROTOCOL_ZIP.equals(protocol))

附上代码

 if (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_ZIP.equals(protocol)) {

                        String packageDirName = packageName.replace('.', '/');
                        JarFile jarFile = new JarFile(new File(url.getFile().replace("!/" + packageDirName, "")));


                        Enumeration<JarEntry> jarEntryEnumeration = jarFile.entries();
                        while (jarEntryEnumeration.hasMoreElements()) {
                            JarEntry jarEntry = jarEntryEnumeration.nextElement();
                            String jarEntryName = jarEntry.getName();
                            if (jarEntryName.endsWith(CLASS_FILE_NAME_ENDED)) {
                                String className = jarEntryName.substring(0, jarEntryName.lastIndexOf(".")).replaceAll("/", ".");
                                doAddClass(classSet, className);
                            }
                        }

                    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值