Hi,

I'm not sure what I'm missing when I try to run my application jar file.  The intention is to load the cayenne configuration file from the subdirectory etc.

I'm getting the following error

Exception in thread "main" org.apache.cayenne.di.DIRuntimeException: DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.ObjectContextFactory>     at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:158)     at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:144)     at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:134)     at org.apache.cayenne.configuration.CayenneRuntime.newContext(CayenneRuntime.java:124)
    at com.callistacti.quest.crsolstasv2.CRSolstas.main(CRSolstas.java:114)

after executing the following code...

    public static final String DB_FILE = "cayenne-CRSolstas.xml";

        Module myModule = (Binder binder) -> {
            binder.bind(ResourceLocator.class).toInstance(new FilesystemResourceLocator(new File("etc"))); ServerModule.contributeProperties(binder).put(Constants.SERVER_CONTEXTS_SYNC_PROPERTY, "false");
        };

        ServerRuntime cayenneRuntime = ServerRuntime.builder().addConfig(DB_FILE)
                .addModule(myModule)
                .build();
        ObjectContext test = cayenneRuntime.newContext();
        test.commitChanges();

When I run my code within my IDE (Netbeans) I do not get this error so I'm missing something from my jar package but I'm not sure what.

Thanks,

Andrew

Reply via email to