Jboss下运行此Demo,会提示如下错误:
com.dingtalk.open.client.common.SdkInitException: 在包[com.dingtalk.open.client.api]下未扫描到任何钉钉开放平台API
经分析,发现是由于“com.dingtalk.open.client.utils”中的 PackageScan.scan 方法,在读取jar包时少了vfs的判断引起的(ps: Jboss在运行时默认将所有的部署的资源统一放到vfs目录中),修改之前的代码如下:
`>......
if ("file".equals(protocol)){
String filePath = URLDecoder.decode(url.getFile(), "UTF-8");
findAndAddClassesInPackageByFile(packageName, filePath, recursive, classes);
} else if ("jar".equals(protocol)){
try {
JarFile jar = ((JarURLConnection)url.openConnection()).getJarFile();
......`
修改后的代码如下:
`>......
if ("file".equals(protocol)) {
String filePath = URLDecoder.decode(url.getFile(), "UTF-8");
findAndAddClassesInPackageByFile(packageName, filePath, recursive, classes);
} else if ("jar".equals(protocol) || "vfs".equals(protocol)) {
try {
JarFile jar = null;
URLConnection conn = url.openConnection();
if (conn instanceof JarURLConnection) {
jar = ((JarURLConnection) conn).getJarFile();
} else {
jar = getAlternativeJarFile(url);
}
Enumeration entries = jar.entries();
......
`
Jboss下运行此Demo,会提示如下错误:
经分析,发现是由于“com.dingtalk.open.client.utils”中的 PackageScan.scan 方法,在读取jar包时少了vfs的判断引起的(ps: Jboss在运行时默认将所有的部署的资源统一放到vfs目录中),修改之前的代码如下:
`>......
修改后的代码如下:
`>......