That depends-on configuration is not needed when attributes are annotated
with @inject or @Autowired, spring builds automatically de dependency
hierarchy. Even though the removal of them did not seem to be necessary,
their use is also not necessary. The issue seems to be related to
application contexts building order. I am not sure how spring behaves when
it encounters the “depend-on” configuration and the bean have not yet been
created and this bean is in another XML file that has not yet been
processed. When we moved to fat jar approach, was any version of the
dependencies changed?

On Tue, Nov 14, 2017 at 7:31 AM, Daan Hoogland <daan.hoogl...@gmail.com>
wrote:

> it actually already works with only the depends-on attributes in the xml
> removed but it all makes sense.
>
> On Tue, Nov 14, 2017 at 1:59 AM, Rafael Weingärtner <
> rafaelweingart...@gmail.com> wrote:
>
> > I removed some spring configurations that were not making sense to me.
> > After that, everything started working. I committed these changes at
> > https://github.com/rafaelweingartner/cloudstack/tree/daanTestSimulator
> >
> > Could you test it? If it works I can open a PR.
> >
> > On Mon, Nov 13, 2017 at 5:33 PM, Daan Hoogland <daan.hoogl...@gmail.com>
> > wrote:
> >
> > > trying with only the depends-on lines removed now
> > >
> > > On Mon, Nov 13, 2017 at 8:30 PM, Daan Hoogland <
> daan.hoogl...@gmail.com>
> > > wrote:
> > >
> > > > from maven:
> > > > mvn -pl client jetty:run -Dsimulator
> > > >
> > > > On Mon, Nov 13, 2017 at 8:16 PM, Rafael Weingärtner <
> > > > rafaelweingart...@gmail.com> wrote:
> > > >
> > > >> The error changed! That is good... It is a misconfiguration with
> > > >> dependencies between modules.
> > > >> How are you running the simulator?
> > > >>
> > > >> On Mon, Nov 13, 2017 at 5:13 PM, Daan Hoogland <
> > daan.hoogl...@gmail.com
> > > >
> > > >> wrote:
> > > >>
> > > >> > didn't work:( trying with only some parts removed now
> > > >> >
> > > >> > Caused by: org.springframework.beans.factory.
> > > >> > NoSuchBeanDefinitionException:
> > > >> > No qualifying bean of type
> > > >> > 'org.apache.cloudstack.engine.subsystem.api.storage.
> > SnapshotService'
> > > >> > available: expected at least 1 bean which qualifies as autowire
> > > >> candidate.
> > > >> > Dependency annotations: {@javax.inject.Inject()}
> > > >> >     at
> > > >> > org.springframework.beans.factory.support.
> > DefaultListableBeanFactory.
> > > >> > raiseNoMatchingBeanFound
> > > >> > (DefaultListableBeanFactory.java:1501)
> > > >> >
> > > >> > On Mon, Nov 13, 2017 at 7:27 PM, Rafael Weingärtner <
> > > >> > rafaelweingart...@gmail.com> wrote:
> > > >> >
> > > >> > > These beans declarations do not make much sense. They are
> declared
> > > >> twice,
> > > >> > > once in the XML (spring-engine-storage-
> > snapshot-core-context.xml),
> > > >> and
> > > >> > the
> > > >> > > second declaration is executed through the use of annotations
> > > >> > (@Component)
> > > >> > > in those classes. This exception is happening because there is a
> > > >> > > configuration in the XML saying that one bean is depending on
> the
> > > >> other.
> > > >> > > You can simply remove lines 30-40 from the XML file to fix this.
> > > >> > >
> > > >> > >
> > > >> > >
> > > >> > > Side note: Spring automatically build the chain of dependencies
> > > >> between
> > > >> > > beans to execute the dependency injection properly. The
> > > configuration
> > > >> > > "depends-on" you find in the XML "bean" element is to define an
> > > exotic
> > > >> > and
> > > >> > > not obvious dependency.
> > > >> > >
> > > >> > >
> > > >> > > On Mon, Nov 13, 2017 at 3:48 PM, Daan Hoogland <
> > > >> daan.hoogl...@gmail.com>
> > > >> > > wrote:
> > > >> > >
> > > >> > > > I'm looking at a problem, any one recognises this on master?
> > > >> simulator
> > > >> > > does
> > > >> > > > not start cleanly.
> > > >> > > >
> > > >> > > > [WARNING] Failed startup of context
> > o.e.j.m.p.JettyWebAppContext@
> > > >> > > 51de5efa
> > > >> > > > {/client,file:/Users/dahn/apache/cloudstack/client/
> > > >> > > > target/classes/META-INF/webapp/,STARTING}{file:/Users/
> > > >> > > > dahn/apache/cloudstack/client/target/classes/META-INF/
> webapp/}
> > > >> > > > org.springframework.beans.factory.BeanCreationException:
> Error
> > > >> > creating
> > > >> > > > bean with name 'snapshotDataFactoryImpl' defined in URL
> > > >> > > > [jar:file:/Users/dahn/.m2/repository/org/apache/
> > > >> > cloudstack/cloud-engine-
> > > >> > > > storage-snapshot/4.11.0.0-SNAPSHOT/cloud-engine-storage-
> > > >> > > > snapshot-4.11.0.0-SNAPSHOT.jar!/META-INF/cloudstack/core/
> > > >> > > > spring-engine-storage-snapshot-core-context.xml]:
> > > >> > > > Circular depends-on relationship between
> > 'snapshotDataFactoryImpl'
> > > >> and
> > > >> > > > 'volumeDataFactoryImpl'
> > > >> > > >     at
> > > >> > > > org.springframework.beans.factory.support.
> > > >> > AbstractBeanFactory.doGetBean
> > > >> > > > (AbstractBeanFactory.java:300)
> > > >> > > >     at
> > > >> > > > org.springframework.beans.factory.support.AbstractBeanFactor
> > > >> y.getBean
> > > >> > > > (AbstractBeanFactory.java:200)
> > > >> > > >     at
> > > >> > > > org.springframework.beans.factory.support.
> > > >> > AbstractBeanFactory.doGetBean
> > > >> > > > (AbstractBeanFactory.java:304)
> > > >> > > >     at
> > > >> > > > org.springframework.beans.factory.support.AbstractBeanFactor
> > > >> y.getBean
> > > >> > > > (AbstractBeanFactory.java:200)
> > > >> > > >     at
> > > >> > > > org.springframework.beans.factory.support.DefaultListableBea
> > > >> nFactory.
> > > >> > > > preInstantiateSingletons
> > > >> > > > (DefaultListableBeanFactory.java:756)
> > > >> > > >     at
> > > >> > > > org.springframework.context.support.
> AbstractApplicationContext.
> > > >> > > > finishBeanFactoryInitialization
> > > >> > > > (AbstractApplicationContext.java:868)
> > > >> > > >     at
> > > >> > > > org.springframework.context.support.AbstractApplicationConte
> > > >> xt.refresh
> > > >> > > > (AbstractApplicationContext.java:549)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > DefaultModuleDefinitionSet.
> > > >> > > > loadContext
> > > >> > > > (DefaultModuleDefinitionSet.java:145)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > > DefaultModuleDefinitionSet$2.with
> > > >> > > > (DefaultModuleDefinitionSet.java:122)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > DefaultModuleDefinitionSet.
> > > >> > > > withModule
> > > >> > > > (DefaultModuleDefinitionSet.java:245)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > DefaultModuleDefinitionSet.
> > > >> > > > withModule
> > > >> > > > (DefaultModuleDefinitionSet.java:250)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > DefaultModuleDefinitionSet.
> > > >> > > > withModule
> > > >> > > > (DefaultModuleDefinitionSet.java:250)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > DefaultModuleDefinitionSet.
> > > >> > > > withModule
> > > >> > > > (DefaultModuleDefinitionSet.java:233)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > DefaultModuleDefinitionSet.
> > > >> > > > loadContexts
> > > >> > > > (DefaultModuleDefinitionSet.java:117)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.model.impl.
> > > >> > > DefaultModuleDefinitionSet.
> > > >> > > > load
> > > >> > > > (DefaultModuleDefinitionSet.java:79)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.factory.ModuleBasedConte
> > > >> xtFactory.
> > > >> > > > loadModules
> > > >> > > > (ModuleBasedContextFactory.java:37)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.factory.
> > > >> > CloudStackSpringContext.init
> > > >> > > > (CloudStackSpringContext.java:71)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.factory.
> > > >> > > CloudStackSpringContext.<init>
> > > >> > > > (CloudStackSpringContext.java:58)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.factory.
> > > >> > > CloudStackSpringContext.<init>
> > > >> > > > (CloudStackSpringContext.java:62)
> > > >> > > >     at
> > > >> > > > org.apache.cloudstack.spring.module.web.CloudStackContextLoa
> > > >> derListene
> > > >> > > > r.contextInitialized
> > > >> > > > (CloudStackContextLoaderListener.java:52)
> > > >> > > >     at
> > > >> > > > org.eclipse.jetty.server.handler.ContextHandler.callContextI
> > > >> nitialized
> > > >> > > > (ContextHandler.java:800)
> > > >> > > >     at
> > > >> > > > org.eclipse.jetty.servlet.ServletContextHandler.callContextI
> > > >> nitialized
> > > >> > > > (ServletContextHandler.java:444)
> > > >> > > >     at org.eclipse.jetty.server.handler.ContextHandler.
> > > startContext
> > > >> > > > (ContextHandler.java:791)
> > > >> > > >     at org.eclipse.jetty.servlet.ServletContextHandler.
> > > startContext
> > > >> > > > (ServletContextHandler.java:294)
> > > >> > > >     at org.eclipse.jetty.webapp.WebAppContext.startWebapp
> > > >> > > > (WebAppContext.java:1349)
> > > >> > > >     at org.eclipse.jetty.maven.plugin.JettyWebAppContext.
> > > startWebap
> > > >> p
> > > >> > > > (JettyWebAppContext.java:297)
> > > >> > > >     at org.eclipse.jetty.webapp.WebAppContext.startContext
> > > >> > > > (WebAppContext.java:1342)
> > > >> > > >     at org.eclipse.jetty.server.
> handler.ContextHandler.doStart
> > > >> > > > (ContextHandler.java:741)
> > > >> > > >     at org.eclipse.jetty.webapp.WebAppContext.doStart
> > > >> > > > (WebAppContext.java:505)
> > > >> > > >     at org.eclipse.jetty.maven.plugin.JettyWebAppContext.
> > doStart
> > > >> > > > (JettyWebAppContext.java:366)
> > > >> > > >     at org.eclipse.jetty.util.component.AbstractLifeCycle.
> start
> > > >> > > > (AbstractLifeCycle.java:68)
> > > >> > > >     at org.eclipse.jetty.util.component.ContainerLifeCycle.
> > start
> > > >> > > > (ContainerLifeCycle.java:132)
> > > >> > > >     at org.eclipse.jetty.util.component.ContainerLifeCycle.
> > > doStart
> > > >> > > > (ContainerLifeCycle.java:114)
> > > >> > > >     at org.eclipse.jetty.server.handler.AbstractHandler.
> doStart
> > > >> > > > (AbstractHandler.java:61)
> > > >> > > >     at org.eclipse.jetty.server.handler.
> > ContextHandlerCollection.
> > > >> > doStart
> > > >> > > > (ContextHandlerCollection.java:163)
> > > >> > > >     at org.eclipse.jetty.util.component.AbstractLifeCycle.
> start
> > > >> > > > (AbstractLifeCycle.java:68)
> > > >> > > >     at org.eclipse.jetty.util.component.ContainerLifeCycle.
> > start
> > > >> > > > (ContainerLifeCycle.java:132)
> > > >> > > >     at org.eclipse.jetty.util.component.ContainerLifeCycle.
> > > doStart
> > > >> > > > (ContainerLifeCycle.java:114)
> > > >> > > >     at org.eclipse.jetty.server.handler.AbstractHandler.
> doStart
> > > >> > > > (AbstractHandler.java:61)
> > > >> > > >     at org.eclipse.jetty.util.component.AbstractLifeCycle.
> start
> > > >> > > > (AbstractLifeCycle.java:68)
> > > >> > > >     at org.eclipse.jetty.util.component.ContainerLifeCycle.
> > start
> > > >> > > > (ContainerLifeCycle.java:132)
> > > >> > > >     at org.eclipse.jetty.server.Server.start
> (Server.java:387)
> > > >> > > >     at org.eclipse.jetty.util.component.ContainerLifeCycle.
> > > doStart
> > > >> > > > (ContainerLifeCycle.java:114)
> > > >> > > >     at org.eclipse.jetty.server.handler.AbstractHandler.
> doStart
> > > >> > > > (AbstractHandler.java:61)
> > > >> > > >     at org.eclipse.jetty.server.Server.doStart
> > (Server.java:354)
> > > >> > > >     at org.eclipse.jetty.maven.plugin.JettyServer.doStart
> > > >> > > > (JettyServer.java:73)
> > > >> > > >     at org.eclipse.jetty.util.component.AbstractLifeCycle.
> start
> > > >> > > > (AbstractLifeCycle.java:68)
> > > >> > > >     at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.
> > > startJetty
> > > >> > > > (AbstractJettyMojo.java:535)
> > > >> > > >     at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.
> execute
> > > >> > > > (AbstractJettyMojo.java:358)
> > > >> > > >     at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute
> > > >> > > > (JettyRunMojo.java:167)
> > > >> > > >     at org.apache.maven.plugin.DefaultBuildPluginManager.
> > > executeMoj
> > > >> o
> > > >> > > > (DefaultBuildPluginManager.java:134)
> > > >> > > >     at org.apache.maven.lifecycle.
> internal.MojoExecutor.execute
> > > >> > > > (MojoExecutor.java:208)
> > > >> > > >     at org.apache.maven.lifecycle.
> internal.MojoExecutor.execute
> > > >> > > > (MojoExecutor.java:154)
> > > >> > > >     at org.apache.maven.lifecycle.
> internal.MojoExecutor.execute
> > > >> > > > (MojoExecutor.java:146)
> > > >> > > >     at
> > > >> > > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
> > > >> > buildProject
> > > >> > > > (LifecycleModuleBuilder.java:117)
> > > >> > > >     at
> > > >> > > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
> > > >> > buildProject
> > > >> > > > (LifecycleModuleBuilder.java:81)
> > > >> > > >     at
> > > >> > > > org.apache.maven.lifecycle.internal.builder.singlethreaded.
> > > >> > > > SingleThreadedBuilder.build
> > > >> > > > (SingleThreadedBuilder.java:51)
> > > >> > > >     at org.apache.maven.lifecycle.internal.LifecycleStarter.
> > > execute
> > > >> > > > (LifecycleStarter.java:128)
> > > >> > > >     at org.apache.maven.DefaultMaven.doExecute
> > > >> (DefaultMaven.java:309)
> > > >> > > >     at org.apache.maven.DefaultMaven.doExecute
> > > >> (DefaultMaven.java:194)
> > > >> > > >     at org.apache.maven.DefaultMaven.execute
> > > >> (DefaultMaven.java:107)
> > > >> > > >     at org.apache.maven.cli.MavenCli.execute
> > (MavenCli.java:955)
> > > >> > > >     at org.apache.maven.cli.MavenCli.doMain
> (MavenCli.java:290)
> > > >> > > >     at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
> > > >> > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native
> > > Method)
> > > >> > > >     at sun.reflect.NativeMethodAccessorImpl.invoke
> > > >> > > > (NativeMethodAccessorImpl.java:62)
> > > >> > > >     at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > > >> > > > (DelegatingMethodAccessorImpl.java:43)
> > > >> > > >     at java.lang.reflect.Method.invoke (Method.java:498)
> > > >> > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.
> > > >> > launchEnhanced
> > > >> > > > (Launcher.java:289)
> > > >> > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.
> launch
> > > >> > > > (Launcher.java:229)
> > > >> > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.
> > > >> > > mainWithExitCode
> > > >> > > > (Launcher.java:415)
> > > >> > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.main
> > > >> > > > (Launcher.java:356)
> > > >> > > > [WARNING] !RequestLog
> > > >> > > >
> > > >> > > >
> > > >> > > > --
> > > >> > > > Daan
> > > >> > > >
> > > >> > >
> > > >> > >
> > > >> > >
> > > >> > > --
> > > >> > > Rafael Weingärtner
> > > >> > >
> > > >> >
> > > >> >
> > > >> >
> > > >> > --
> > > >> > Daan
> > > >> >
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> Rafael Weingärtner
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > Daan
> > > >
> > >
> > >
> > >
> > > --
> > > Daan
> > >
> >
> >
> >
> > --
> > Rafael Weingärtner
> >
>
>
>
> --
> Daan
>



-- 
Rafael Weingärtner

Reply via email to