Re: DI container has no binding for key

2022-03-23 Thread Andrus Adamchik
Hi Stefan, Could you include a full stack trace please? Thanks, Andrus > On Mar 23, 2022, at 1:04 AM, Stefan Stegic wrote: > > Hi, > > > First some context: I'm working on a custom Minecraft server (Spigot) > plugin. It's just a JAR that you export and place somewhere in the server's >

Re: DI container has no binding for key

2022-03-23 Thread Stefan Stegic
Hi Andrus, Of course: org.apache.cayenne.di.DIRuntimeException: DI container has no binding for key at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:158) ~[?:?] at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:144) ~[?:?]

Re: DI container has no binding for key

2022-03-23 Thread Michael Gentry
Hi Stefan, Attachments, such as images, don't work on the mailing list. You can try uploading to imgur.com or similar and send the link to it. Have you tried updating your "java -cp myPlugin.jar path.to.Main" command to have more classpaths? mrg On Wed, Mar 23, 2022 at 12:10 PM Stefan Stegic

Re: DI container has no binding for key

2022-03-23 Thread Andrus Adamchik
Actually the stack shows that there's already an instance of Cayenne runtime available to the code, but the runtime is in a bad state (not clear why). So thread binding should not be required. Andrus > On Mar 23, 2022, at 4:00 PM, John Huss wrote: > > You have to bind the DI injector to the

Re: DI container has no binding for key

2022-03-23 Thread Stefan Stegic
My knowledge of Java is not so deep, so excuse stupid questions - if any. I believe I am using shading because I'm exporting dependencies into my JAR. IntelliJ does this for me in the build process by publishing the JAR as an artifact. All I did was specify which dependencies I want to package in

Re: DI container has no binding for key

2022-03-23 Thread Stefan Stegic
PS: I'm not using maven-shade (just opened the link you sent) On Wed, Mar 23, 2022 at 5:10 PM Stefan Stegic wrote: > My knowledge of Java is not so deep, so excuse stupid questions - if any. > I believe I am using shading because I'm exporting dependencies into my > JAR. IntelliJ does this for

Re: DI container has no binding for key

2022-03-23 Thread Stefan Stegic
Hi Michael, Oh, I wasn't aware, thanks. Here's the screenshot from my last e-mail: https://imgur.com/QJoBGAV . Right, I'll give maven-shade-plugin a try now and check if it works that way, thanks. On Wed, Mar 23, 2022 at 5:18 PM Michael Gentry wrote: > If you aren't using a shaded JAR (which

Re: DI container has no binding for key

2022-03-23 Thread Andrus Adamchik
The bootstrap code is as vanilla as it can get: >> ServerRuntime cayenneRuntime = ServerRuntime.builder() >> .addConfig("cayenne-project.xml") >> .build(); Missing ObjectContextFactory means ServerModule is not loaded in the environment. Since 4.1 (BTW, which version

Re: DI container has no binding for key

2022-03-23 Thread Stefan Stegic
Hi, Thanks for your quick responses! I'm using version 4.1.1. Right, so you're saying Spigot is somehow blocking the execution of said code, or it's circumventing it somehow so that those steps of initialization are never actually executed? Also, you mean that it's a common problem with Cayenne

Re: DI container has no binding for key

2022-03-23 Thread Michael Gentry
If you aren't using a shaded JAR (which merges all JARs into a single JAR), then you'll need more JARs listed on your Java command. On Wed, Mar 23, 2022 at 12:16 PM Stefan Stegic wrote: > PS: I'm not using maven-shade (just opened the link you sent) > > On Wed, Mar 23, 2022 at 5:10 PM Stefan

Re: DI container has no binding for key

2022-03-23 Thread Stefan Stegic
Ok, just tried maven-shade-plugin, but no luck - still the same error... It seems that the shading is working as expected: when I run maven package, the output jar really has cayenne's stuff in there, but DI is still failing when I copy the plugin into the server and start it. Michael, in

Re: DI container has no binding for key

2022-03-23 Thread Andrus Adamchik
This is not a common problem with Cayenne. In fact this is the first time I see it happen in any environment. So Spigot is special in this respect. I found this link: https://bukkit.fandom.com/wiki/Using_External_Libraries_with_Plugins

Re: DI container has no binding for key

2022-03-23 Thread John Huss
You have to bind the DI injector to the thread (and unbind it later): CayenneRuntime.*bindThreadInjector*(cayenneRuntime.getInjector()); If you are using servlets, then CayenneFilter will do this for you. Otherwise you can bind it at the start of a request and unbind it at the end. On Wed, Mar

Re: DI container has no binding for key

2022-03-23 Thread Stefan Stegic
Yup, it's in there: ## # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright

Re: Apache cayenne 4.0.2 bug

2022-03-23 Thread John Huss
What version of Java are you using? There wasn't support for JDK 17 yet in that version, so that could be the problem. On Wed, Mar 23, 2022 at 12:25 PM Mustafa Said Tozluoğlu wrote: > Hello, > > I just bought new macbook pro M1 chip. And I have to install apache > cayenne 4.0.2 version becase

Apache cayenne 4.0.2 bug

2022-03-23 Thread Mustafa Said Tozluoğlu
Hello, I just bought new macbook pro M1 chip. And I have to install apache cayenne 4.0.2 version becase my company use this version. But this version does not open in my mac. When I click the cayenne modeller app icon just appear in dock but after a couple seconds it is gone. Do you know what

Re: DI container has no binding for key

2022-03-23 Thread Andrus Adamchik
Ok, shading can be tricky. Do you have this file inside the shaded jar: >> "META-INF/services/org.apache.cayenne.configuration.server.CayenneServerModuleProvider" And if you do, can you check the contents of it? It is a simple text file, so once you extract it form the jar, you can check it in