Hi, I have tried to run camunda engine as spring boot app as fat jar, and the processes are not deployed. Everything works fine when i run it from ide or via maven, problem is only with fat jar. There was issue for this last year, Auto-deployment doesn't work for Fat-Jar · Issue #106 · camunda/camunda-bpm-spring-boot-starter · GitHub, however this seems to be another issue, as the code changed in as fix for that incident seems not to be being used.
I think I have identified the possible problem to method ClassPathProcessApplicationScanner.scanUrl(URL url, String paResourceRootPath, boolean isPaLocal, String[] additionalResourceSuffixes, Map<String, byte[]> resourceMap)
protected void scanUrl(URL url, String paResourceRootPath, boolean isPaLocal, String[] additionalResourceSuffixes, Map<String, byte[]> resourceMap) {
String urlPath = url.toExternalForm();
if(isPaLocal) {
if (urlPath.startsWith("file:") || urlPath.startsWith("jar:") || urlPath.startsWith("wsjar:") || urlPath.startsWith("zip:")) {
urlPath = url.getPath();
int withinArchive = urlPath.indexOf('!');
if (withinArchive != -1) {
urlPath = urlPath.substring(0, withinArchive);
} else {
File file = new File(urlPath);
urlPath = file.getParentFile().getParent();
}
}
} else {
if (urlPath.startsWith("file:") || urlPath.startsWith("jar:") || urlPath.startsWith("wsjar:") || urlPath.startsWith("zip:")) {
urlPath = url.getPath();
int withinArchive = urlPath.indexOf('!');
if (withinArchive != -1) {
urlPath = urlPath.substring(0, withinArchive);
}
}
}
try {
urlPath = URLDecoder.decode(urlPath, "UTF-8");
}
catch (UnsupportedEncodingException e) {
throw LOG.cannotDecodePathName(e);
}
LOG.debugRootPath(urlPath);
scanPath(urlPath, paResourceRootPath, isPaLocal, additionalResourceSuffixes, resourceMap);
}
imho, the problem is on the line
int withinArchive = urlPath.indexOf('!');
and it should be
int withinArchive = urlPath.lastIndexOf('!');
I have deduced this from the fact, that when run the application via maven spring boot plugin, the url is “file:/C:/somePathToDependencyJarInMaven/omnichannel-poc-processes-1.0-SNAPSHOT.jar!/META-INF/processes.xml”
and when i run it as fat jar, it is “jar:file:/C:/somePathToFatJar/omnichannel-poc-boot-app.jar!/BOOT-INF
/lib/omnichannel-poc-processes-1.0-SNAPSHOT.jar!/META-INF/processes.xml”
So in result(in fat jar case), the processes will be looked for in “file:/C:/somePathToFatJar/omnichannel-poc-boot-app.jar” instead of in “file:/C:/somePathToFatJar/omnichannel-poc-boot-app.jar!/BOOT-INF
/lib/omnichannel-poc-processes-1.0-SNAPSHOT.jar”
Unfortunately, I am not able to verify my hypothesis, as when I override the class in my project, the camunda-engine original class is still being used for whatever reason. Could somebody verify my hypothesis and raise an issue for this.