Skip to content
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

java.io.FileNotFoundException: public.ks #29

Open
tied opened this issue Sep 10, 2022 · 0 comments
Open

java.io.FileNotFoundException: public.ks #29

tied opened this issue Sep 10, 2022 · 0 comments

Comments

@tied
Copy link

tied commented Sep 10, 2022

Hello,

I'm building a Java plugin for Atlassian Jira (On-Premise) and try to implement truelicense to license our plugin.

Everything works in the local testing / development from IntelliJ / Maven and the public.ks file is visible in target/classes/public.ks. If I extract my *.jar file I also can see the file.

I've installed the public in my standalone server instance and the truelicense libraries / dependencies are correctly loaded and can be used.

It always throw FileNotFoundException on manager.install(source).

I've also did some research... https://developer.atlassian.com/server/confluence/what-is-the-best-way-to-load-a-class-or-resource-from-a-plugin/

I've tried multiple variants.

InputStream inputStream = ClassLoaderUtils.getResourceAsStream("public.ks", this.getClass());
        int value = inputStream.available();
        log.debug("inputStream.available() " + value);

final URL publicKsURL = ClassLoaderUtils.getResource("public.ks", getClass());

URL resource1 = getClass().getClassLoader().getResource("public.ks");
URL resource2 = ConsumerLicenseManager.class.getClassLoader().getResource("public.ks");
URL resource3 = getClass().getResource("/public.ks");
URL resource4 = ConsumerLicenseManager.class.getResource("/public.ks");
2022-09-10 11:03:47,311+0200 inputStream.available() 1378
2022-09-10 11:03:47,311+0200 Loading publicKsURL from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200 Loading resource1 from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200 Loading resource2 from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200 Loading resource3 from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200  Loading resource4 from bundle://295.0:1/public.ks

If I replace the filename with something different if failes with a NullPointerException. So for me it looks like that the public.ks is in the classpath. truelicense doesn't picks it.

Did I miss something? I'm slowly running out of ideas and I hope you can give me some hint.

Kind Regards,
Tim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant