-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi module spring boot project can't support #76
Comments
Which version are you using? I think it's fixed by this #43. |
v 5.0 |
That's why. It was fixed in 6.5 and 7.0 IIRC. |
but i hacked this class to my project, it still can't work. |
by the way, i package my app to a jar will occur the problem ,by command 'java -jar app.jar', when i use IDE to run will work ok. |
What did you do exactly? Could you reproduce the problem with 7.0? |
ok, i will try it, ty |
Any news? |
Can confirm, doesn't work in multi module projects. I fixed it by using the maven resources plugin and copying the index configs from the other module into the actual packaged module. Didn't look through the code too thorough, but it seems like it can't locate additional resources in the BOOT-INF/lib folders. |
It would help if you could share a full simple (the easiest one as possible) which could show the problem. And if you have a fix what is it actually (in another commit). |
Sorry, I just saw it. I think there may be some problems in obtaining path of source file. like that
|
@lwpk110 where this code is coming from? Any idea on how to fix this issue? |
I've found the problem. In a multi module project, when the main module depends on another sub module, and the sub module is responsible for handling es.when the main module is packaged as jar, and the main module also needs to parse the sub module jar package when the app runs. if (dirURL.getProtocol().equals("jar")) {
/* A JAR path */
logger.trace("found a jar file resource: {}", dirURL);
String jarPath = dirURL.getPath().substring(5, dirURL.getPath().indexOf("!")); //strip out only the JAR file
JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));
Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
Set<String> result = new HashSet<>(); //avoid duplicates in case it is a subdirectory
while(entries.hasMoreElements()) {
String name = entries.nextElement().getName();
if (name.startsWith(root)) { //filter according to the path
String entry = name.substring(root.length());
int checkSubdir = entry.indexOf("/");
if (checkSubdir >= 0) {
// if it is a subdirectory, we just return the directory name
entry = entry.substring(0, checkSubdir);
}
result.add(entry);
}
} |
Yeah. I guess so. it would help a lot if someone could provide a sample project which reproduces the problem. That way I could work on a patch and make sure it solves it. or better, if someone could provide the patch itself 😉 |
i integrate es with spring-elasticsearch,my project is multi module project. when use idea tool run app, it's ok,but when i package it to jar , it doesn't work. i debug it,found 'ResourceList' cause the problem. jar file can't read valid classpaht resource, it can't read the resource of sub moudule. expect fix it!
for exam:
jar:file:/C:/Users/steven/Desktop/delivery/xb-lbs-service-1.0.0.jar!/BOOT-INF/lib/xb-lbs-core-1.0.0-SNAPSHOT.jar!/elasticsearch/client/rest/
The text was updated successfully, but these errors were encountered: