-
Notifications
You must be signed in to change notification settings - Fork 36
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
Running selfcontained spring boot jar (fat jar) fails on help command #340
Comments
ok again, I'll check this today - are you running one of the demo bots, or your own bot? |
one of my own, but I think its reproducible with demobots,
|
Well, I found a different issue with ... however, I didn't manage to reproduce this. I'm going to try importing your code now and see if I can get it to happen |
ok, I ran some of your code above. I removed the stuff to do with http, since chances are I don't have access to that.. Here's the help page: And I'm calling the method ok: This is on teams which I gather you're using, but also works on Symphony for me. I'll update the other ticket you raised too, which was about using @ - mentions... |
Ok cool, does this mean that it worked or you found a bug? |
It worked. Can you provide the complete stack trace? |
|
This line:
To me, this points to a classpath problem with
Is there any way you can debug at this line and tell me what happens with the |
from what I can see it tries to discover the template from classpath but cannot find it, I susspect it has something todo with the way thymeleaf class path scanning are setup? its a little different when running in a fat jar. |
yeah I was also trying to replicate the problem by running from the fat jar. I couldn't replicate it though - hence me asking you. Maybe it's a java version or something? Anyway, if you can get back to me on the above maybe we can figure it out together |
Okay, so this is the java version: |
You know maybe it'd be easier if we did this on a call? My email is rob -at- kite9 -dot- com - can you drop me a mail and we'll try and schedule something? I think it'd be easier if I see it running on your machine. I'd definitely like to get to the bottom of this. Are you ok with that? |
We managed to reproduce this on a call. Looking at it, symphony looks for this:
whereas teams does this:
We attached a debugger:
Debugging into
This works from the Symphony bean, but fails from the teams bean.
The resource looks like this from teams:
Whereas from symphony it looks like this:
Thymeleaf Engine is loaded using When we call the code from Symphony, it uses When done from teams, it uses Thread.currentThread().getContextClassLoader(); thread = |
Answer is to set the class loader on the ResourceLoader that all these templaters use, rather than allowing it to default to |
I've tried this in my spring boot project:
rl = org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServ In the fat jar.. |
interesting!
Great meeting you last week, btw.
I'm going to have another look at this tomorrow - I had an idea over
the weekend for a work-around for you (which, if it does indeed work we'll
include in the next point release also)
…On Thu, Jun 30, 2022 at 6:43 AM Nino Martinez Wael ***@***.***> wrote:
I've tried this in my spring boot project:
@PostConstruct
public void setResourceLoader() {
System.out.println("rl = " + rl);
System.out.println("cl = " + rl.getClassLoader());
Resource resource = rl.getResource("classpath:/templates/teams/help-template.html");
}
rl =
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServ
***@***.***, started on Thu Jun 30 07:41:16 CEST 2022
cl = ***@***.***
resource.exists() = true
In the fat jar..
—
Reply to this email directly, view it on GitHub
<#340 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEK2YJSDMJE4BVSTTPYCRTVRUXW3ANCNFSM5U6WA2HA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Okay great to hear :)
And looking forward to it.
…On Mon, Jul 4, 2022 at 1:12 PM Rob Moffat ***@***.***> wrote:
interesting!
Great meeting you last week, btw.
I'm going to have another look at this tomorrow - I had an idea over
the weekend for a work-around for you (which, if it does indeed work we'll
include in the next point release also)
On Thu, Jun 30, 2022 at 6:43 AM Nino Martinez Wael ***@***.***>
wrote:
> I've tried this in my spring boot project:
>
> @PostConstruct
> public void setResourceLoader() {
> System.out.println("rl = " + rl);
> System.out.println("cl = " + rl.getClassLoader());
> Resource resource =
rl.getResource("classpath:/templates/teams/help-template.html");
>
> }
>
> rl =
>
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServ
> ***@***.***, started on Thu Jun 30 07:41:16 CEST 2022
> cl = ***@***.***
> resource.exists() = true
>
> In the fat jar..
>
> —
> Reply to this email directly, view it on GitHub
> <#340 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAEK2YJSDMJE4BVSTTPYCRTVRUXW3ANCNFSM5U6WA2HA
>
> .
> You are receiving this because you modified the open/close state.Message
> ID: ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#340 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF3P5YRTXICA2M6R2RTK53VSLBI7ANCNFSM5U6WA2HA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Best regards / Med venlig hilsen
Nino Martinez
|
Ok, I had a spare few minutes right now. The reason you get As we discovered last week, teams is doing some shenanigans with it's thread pool, and the teams threads end up with a different class loader. So, this is why templates got loaded in symphony but not teams. To fix this, we have to supply a classloader, so the default one isn't used. I tested this code out inside
... and everything was well in the world! I will submit a PR and add this to our teams library for the next version, but you should add this snippet to a spring |
I can confirm this fix works for me too :) Great work and support! |
Pleasure working with you, Nino! Keep in touch |
When im running the repakaged jar made by spring I end up getting this:
Caused by: java.lang.UnsupportedOperationException: Don't know how to construct default template for WorkResponse
Running the same class from my IDE works just fine, looks like someother configuration of thymeleaf takes precidense on the condittional missiong beans here:
springbot/teams-chat-workflow-spring-boot-starter/9.0.0.BETA2/teams-chat-workflow-spring-boot-starter-9.0.0.BETA2-sources.jar!/org/finos/springbot/teams/TeamsWorkflowConfig.java:92
POSSIBLE fix? Maybe add an @order to prefer this being configured before the unkown culprit?
The text was updated successfully, but these errors were encountered: