cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ab@dataloy.com"...@dataloy.com>
Subject Re: Cayenne 4 DI container has no binding for key BindingKey
Date Mon, 02 Oct 2017 13:10:27 GMT


On 2017-10-02 14:34, Nikita Timofeev <ntimofeev@objectstyle.com> wrote: 
> You should change direct binding of sniffer to more convenient extension API:
> 
> ServerModule.contributeAdapterDetectors(binder).add(new DataloyOracleSniffer());
> 
> But that's not what causing your problems.
> 
> On Mon, Oct 2, 2017 at 3:28 PM, ab@dataloy.com <ab@dataloy.com> wrote:
> >
> >
> > On 2017-10-02 13:59, Nikita Timofeev <ntimofeev@objectstyle.com> wrote:
> >> Correct way to do this in 4.0:
> >>
> >> runtime = ServerRuntime.builder().addConfig(CONFIG).addModule(new
> >> DataloyOracleModule()).build();
> >>
> >> On Mon, Oct 2, 2017 at 2:54 PM, ab@dataloy.com <ab@dataloy.com> wrote:
> >> >
> >> >
> >> > On 2017-10-02 13:40, Nikita Timofeev <ntimofeev@objectstyle.com>
wrote:
> >> >> How do you create ServerRuntime? Do you use new
> >> >> ServerRuntime.builder() method or directly create it?
> >> >>
> >> >> On Mon, Oct 2, 2017 at 2:20 PM, ab@dataloy.com <ab@dataloy.com>
wrote:
> >> >> > I got this exception at deploy time (Ia m using 4.0 but in the
log refers to 3.1B2, I do not know why):
> >> >> >
> >> >> > Caused by: javax.ejb.EJBException: org.apache.cayenne.CayenneRuntimeException:
[v.3.1B2 Feb 05 2013 20:19:35] Error creating instance of class com.dataloy.platform.DataloyOracleAdapter
of type org.apache.cayenne.dba.DbAdapter
> >> >> >         at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:190)
> >> >> >         at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
> >> >> >         at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:369)
> >> >> >         at org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:66)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
[wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:160)
[wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
> >> >> >         ... 11 more
> >> >> > Caused by: org.apache.cayenne.CayenneRuntimeException: [v.3.1B2
Feb 05 2013 20:19:35] Error creating instance of class com.dataloy.platform.DataloyOracleAdapter
of type org.apache.cayenne.dba.DbAdapter
> >> >> >         at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.newInstance(DefaultAdhocObjectFactory.java:75)
> >> >> >         at com.dataloy.platform.DataloyOracleSniffer.createAdapter(DataloyOracleSniffer.java:33)
> >> >> >         at org.apache.cayenne.configuration.server.DefaultDbAdapterFactory.detectAdapter(DefaultDbAdapterFactory.java:122)
> >> >> >         at org.apache.cayenne.configuration.server.DefaultDbAdapterFactory.detectAdapter(DefaultDbAdapterFactory.java:100)
> >> >> >         at org.apache.cayenne.configuration.server.DefaultDbAdapterFactory$1.get(DefaultDbAdapterFactory.java:84)
> >> >> >         at org.apache.cayenne.configuration.server.DefaultDbAdapterFactory$1.get(DefaultDbAdapterFactory.java:81)
> >> >> >         at org.apache.cayenne.dba.AutoAdapter.loadAdapter(AutoAdapter.java:93)
> >> >> >         at org.apache.cayenne.dba.AutoAdapter.getAdapter(AutoAdapter.java:81)
> >> >> >         at org.apache.cayenne.dba.AutoAdapter.getExtendedTypes(AutoAdapter.java:141)
> >> >> >         at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:254)
> >> >> >         at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:442)
> >> >> >         at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:70)
> >> >> >         at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:415)
> >> >> >         at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:877)
> >> >> >         at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:412)
> >> >> >         at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:122)
> >> >> >         at org.apache.cayenne.access.DataDomain.onQueryNoFilters(DataDomain.java:758)
> >> >> >         at org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:1009)
> >> >> >         at org.apache.cayenne.lifecycle.audit.AuditableFilter.onQuery(AuditableFilter.java:70)
> >> >> >         at org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:1009)
> >> >> >         at org.apache.cayenne.lifecycle.changeset.ChangeSetFilter.onQuery(ChangeSetFilter.java:54)
> >> >> >         at org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:1009)
> >> >> >         at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:748)
> >> >> >         at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:350)
> >> >> >         at org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:106)
> >> >> >         at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:93)
> >> >> >         at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:989)
> >> >> >         at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:978)
> >> >> >         at com.dataloy.vms.DataloyConfig.fetchMinAreaReportFromDB(DataloyConfig.java:260)
> >> >> >         at com.dataloy.vms.DataloyConfig.applicationStartup(DataloyConfig.java:177)
> >> >> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) [rt.jar:1.8.0_121]
> >> >> >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[rt.jar:1.8.0_121]
> >> >> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0_121]
> >> >> >         at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_121]
> >> >> >         at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:96)
[wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doLifecycleInterception(Jsr299BindingsInterceptor.java:114)
> >> >> >         at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:103)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
> >> >> >         at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:53)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:109)
[wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)
[wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.weld.ejb.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:94)
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
[wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
> >> >> >         at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
[jboss-invocation-1.2.1.Final.jar:1.2.1.Final]
> >> >> >         at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273)
> >> >> >         ... 27 more
> >> >> > Caused by: org.apache.cayenne.ConfigurationException: [v.3.1B2
Feb 05 2013 20:19:35] DI container has no binding for key <BindingKey: org.apache.cayenne.resource.ResourceLocator,
'cayenne.server.resource_locator'>
> >> >> >         at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> >> >> >         at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:107)
> >> >> >         at org.apache.cayenne.di.spi.ConstructorInjectingProvider.get(ConstructorInjectingProvider.java:155)
> >> >> >         at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:42)
> >> >> >         at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.newInstance(DefaultAdhocObjectFactory.java:72)
> >> >> >         ... 86 more
> >> >> >
> >> >> > The class DataloyOracleAdapter is like this:
> >> >> >
> >> >> > public class DataloyOracleAdapter extends OracleAdapter {
> >> >> >
> >> >> >         public DataloyOracleAdapter(@Inject RuntimeProperties
runtimeProperties,
> >> >> >                         @Inject(Constants.SERVER_DEFAULT_TYPES_LIST)
List<ExtendedType> defaultExtendedTypes,
> >> >> >                         @Inject(Constants.SERVER_USER_TYPES_LIST)
List<ExtendedType> userExtendedTypes,
> >> >> >                         @Inject(Constants.SERVER_TYPE_FACTORIES_LIST)
List<ExtendedTypeFactory> extendedTypeFactories,
> >> >> >                         @Inject(Constants.SERVER_RESOURCE_LOCATOR)
ResourceLocator resourceLocator,
> >> >> >                         @Inject ValueObjectTypeRegistry valueObjectTypeRegistry)
{
> >> >> >                 super(runtimeProperties, defaultExtendedTypes,
userExtendedTypes, extendedTypeFactories, resourceLocator,
> >> >> >                                 valueObjectTypeRegistry);
> >> >> >                 setSupportsGeneratedKeys(false);
> >> >> >                 setSupportsBatchUpdates(false);
> >> >> >
> >> >> >         }
> >> >> >
> >> >> >         @Override
> >> >> >         protected PkGenerator createPkGenerator() {
> >> >> >                 return new DataloyPkGenerator();
> >> >> >         }
> >> >> >
> >> >> > }
> >> >> >
> >> >> > Any ideas!
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Best regards,
> >> >> Nikita Timofeev
> >> >>
> >> > private final String CONFIG = "cayenne-DataloyVMS.xml";
> >> > private final Module[] MODULES = { new DataloyOracleModule() };
> >> >
> >> > ..
> >> > runtime = new ServerRuntime(CONFIG, MODULES);
> >>
> >>
> >>
> >> --
> >> Best regards,
> >> Nikita Timofeev
> >
> > The class DataloyOracleModule is  like this:
> >
> > public class DataloyOracleModule implements Module {
> >
> >         @Inject AdhocObjectFactory objFac;
> >
> >         @Override
> >         public void configure(Binder binder) {
> >
> >                 binder.bindList(Constants.SERVER_ADAPTER_DETECTORS_LIST).add(new
DataloyOracleSniffer());
> >                 binder.bind(EntitySorter.class).to(DataloyEntitySorter.class).withoutScope();
> >         }
> >
> > }
> 
> 
> 
> -- 
> Best regards,
> Nikita Timofeev
> 

You are right, the problem was related to a wrong version of Cayenne. Inside the war file
the Cayenne jars were correct but there was a reference to 3.1 inside jboss-deployment-structure.xml.
Now works. there is another problem but I will open a new thread.

Many thanks
Andrea

Mime
View raw message