Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Remote Repository Timing and Dependency Issues
Remote Repository Timing and Dependency Issues [message #658788] Wed, 09 March 2011 13:56 Go to next message
Aaron  is currently offline Aaron
Messages: 21
Registered: February 2011
Junior Member
This is a hard one to describe, but here it goes...

I set up an instance of Virgo to use as a hosted repository. Let's call this server 'remote repo'.

I have two other Virgo instances, each running on its own hardware. Once instance is very close on the network to the remote repo and the network speed between them is fast. Let's call this Virgo instance 'client 1'. The other is far away from the remote repo and the network speed between them is slower. Let's call this Virgo instance 'client 2'. Both client 1 and 2 have the remote repo configured as a remote repository.

My goal is to add all my application's bundles and its bundle dependencies to the remote repo and then just deploy a simple plan file to client 1 and client 2.

My application depends on Hibernate, Hibernate Cache, and Ehcache, amongst many other bundles. Those bundles are added to the remote repo with all the other bundles. Nothing special there.

Here is what is interesting, though: When I start the Virgo process on client 1 for the first time, it is able to quickly detect that the remote repo is available and quickly cache the remote repo's contents because of the fast network connection between them. My impression is that this all happens before Virgo starts loading its standard bundles. Once the server is up and running, I can see that all the standard Virgo bundles are installed as well as Hibernate, Hibernate Cache, and Ehcahe. Remember, at this point I have NOT attempted to install my plan that depends on Hibernate, Hibernate Cache, and Ehcahe. I'm assuming that these bundles were loaded as optional dependencies of Virgo's standard Spring bundles. Here is a sample of the server log showing the order of things:
[2011-03-09 10:48:27.618] startup-tracker     <KE0001I> Kernel starting. 
[2011-03-09 10:48:31.424] iris-dev		        <RP0051I> The repository 'iris-dev' is available. 
[2011-03-09 10:48:33.222] startup-tracker     <KE0002I> Kernel started. 
[2011-03-09 10:48:33.374] system-artifacts   <DE0000I> Installing plan 'org.eclipse.virgo.kernel.userregion.springdm' version '2.1.0'. 
[2011-03-09 10:48:33.648] system-artifacts   <DE0000I> Installing bundle 'org.springframework.osgi.core' version '1.2.1'.
...

I am then able to install my plan that depends on Hibernate, Hibernate Cache, and Ehcahe and everything works as expected.

On client 2, things are different. When I start the Virgo process for the first time, it appears that Virgo begins installing it's bundles before the remote repo is available and cached. Here is a sample of the log showing that:
[2011-03-09 11:59:17.977] startup-tracker     <KE0001I> Kernel starting.
[2011-03-09 11:59:28.718] startup-tracker     <KE0002I> Kernel started. 
[2011-03-09 11:59:29.155] system-artifacts   <DE0000I> Installing plan 'org.eclipse.virgo.kernel.userregion.springdm' version '2.1.0'. 
[2011-03-09 11:59:29.569] iris-dev                  <RP0051I> The repository 'iris-dev' is available.
[2011-03-09 11:59:29.581] system-artifacts   <DE0000I> Installing bundle 'org.springframework.osgi.core' version '1.2.1'.
...

As you might expect, once the server is up and running, all the Virgo bundles are installed, but there are no Hibernate, Hibernate Cache, and Ehcahe bundles installed. I'm guessing this is because they were not available as optional dependencies when Virgo's Spring bundles were loaded. This could be caused by the slower network connection between client 2 and the remote repo.

No big deal, right? The Hibernate, Hibernate Cache, and Ehcahe bundles are in the remote repo and should be cached by client 2 at some point in the near future... Go ahead and install the plan and let Hibernate, Hibernate Cache, and Ehcahe be pulled from the remote repo cache and installed along with the rest of the plan dependencies.

Well, that does not work. For some reason, I can only get my plan to install when the Hibernate, Hibernate Cache, and Ehcahe bundles are already installed as optional dependencies of Virgo's Spring bundels before the plan is installed. The only way I can solve this on client 2 is to restart Virgo. When restarting Virgo, I'm guessing that the remote repo bundles have been cached and are available as optional dependencies to Virgo's Spring bundles durning start up. After the restart, Hibernate, Hibernate Cache, and Ehcahe are installed automatically and I can go on with my plan installation.

For reference, here is an example of the type of errors I see when I attempt to install my plan without the Hibernate, Hibernate Cache, and Ehcahe bundles previously installed, even though they are available in the remote repo:
creating bean with name 'searchDAO' defined in URL [bundleentry://69.fwk129655114/META-INF/spring/bundle-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/SessionFactory
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
	at org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/SessionFactory
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
	at java.lang.Class.privateGetPublicMethods(Class.java:2547)
	at java.lang.Class.getMethods(Class.java:1410)
	at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1284)
	at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1158)
	at java.beans.Introspector.getBeanInfo(Introspector.java:408)
	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
	at java.beans.Introspector.getBeanInfo(Introspector.java:230)
	at java.beans.Introspector.<init>(Introspector.java:389)
	at java.beans.Introspector.getBeanInfo(Introspector.java:167)
	at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:224)
	at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149)
	at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:305)
	at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:312)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1208)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1069)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
	... 16 common frames omitted
Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.hibernate.SessionFactory in KernelBundleClassLoader: [bundle=org.springframework.orm_3.0.5.RELEASE]
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	... 34 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.SessionFactory
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)
	... 35 common frames omitted

Remember, Hibernate, Hibernate Cache, and Ehcahe are available in remote repo, but for some reason aren't helping the installation of my plan.

So, I guess I have two main questions:

Is there an issue with the timing of the availability of remote repositories relative to Virgo loading its own bundles? Is there a way to control that? Should there be?

Why can I only get my plan to install when Hibernate, Hibernate Cache, and Ehcahe have previously been installed as optional dependencies of Virgo's Spring bundles? Why can't they just be resolved as dependencies of my plan and installed along with all the other plan's bundle dependencies?

If you made it this far, thank you for reading, and I appreciate any input.

Thanks,
Aaron
Re: Remote Repository Timing and Dependency Issues [message #658903 is a reply to message #658788] Thu, 10 March 2011 06:09 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Aaron wrote on Wed, 09 March 2011 18:56
This is a hard one to describe, but here it goes...

Thanks for taking the time to describe things clearly. You've no idea how helpful that is. Smile
Quote:
8< snip 8<
So, I guess I have two main questions:

Is there an issue with the timing of the availability of remote repositories relative to Virgo loading its own bundles? Is there a way to control that? Should there be?
There seems to be an issue. I can't think of a way for you to affect the timing. The problem is that ArtifactDescriptorStoreWatcher runs an asynchronous thread to download the index of the remote repository and I suspect repository lookups are allowed to fail silently in the case where the remote index has not downloaded successfully. I suggest you raise a bug.

Please note that the downloaded index is cached across a warm (i.e. not -clean) start of Virgo, so that may give you a workaround by warm starting when the index has been downloaded. But beware: network errors may also be causing the index not to download. These will show up as warnings or errors in the logs if you want to take a look. See the above code link for some idea of what to search for.
Quote:

Why can I only get my plan to install when Hibernate, Hibernate Cache, and Ehcahe have previously been installed as optional dependencies of Virgo's Spring bundles? Why can't they just be resolved as dependencies of my plan and installed along with all the other plan's bundle dependencies?

These optional dependencies are needed for Spring to load the necessary classes later on which is why class loading errors ensue.
Quote:
If you made it this far, thank you for reading, and I appreciate any input.

Thanks,
Aaron

[Updated on: Thu, 10 March 2011 06:12]

Report message to a moderator

Re: Remote Repository Timing and Dependency Issues [message #661489 is a reply to message #658788] Thu, 24 March 2011 18:15 Go to previous messageGo to next message
Aaron  is currently offline Aaron
Messages: 21
Registered: February 2011
Junior Member
Thanks for the reply, Glyn. I'll submit a bug report.

For now, I have created a customized distribution of Virgo for use within my organization that has an updated version of Spring and includes those optional dependencies.

Aron
Re: Remote Repository Timing and Dependency Issues [message #661677 is a reply to message #658788] Fri, 25 March 2011 22:58 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Ok, thanks Aron.

That bug could be a tricky one to reproduce, so the more information you can add the better. Please attach serviceability/logs/log.log, especially if it shows any repository-related stack traces.
Re: Remote Repository Timing and Dependency Issues [message #716606 is a reply to message #661677] Wed, 17 August 2011 16:32 Go to previous message
Michael  is currently offline Michael
Messages: 1
Registered: August 2011
Junior Member
Was there a bug filed for this? I was unable to find it in Bugzilla, but this is causing us serious difficulties right now. We have quite a few bundles (currently 80+) in a remote repository and it's virtually impossible to get virgo to startup with our plan without doing two full restarts. Any other workarounds, or a bug number I can track on this? The option to do a "synchronous" repository download when there is no cache currently present would be a nice start...
Previous Topic:Virgo + EclipseLink JPA + Weaving + Spring
Next Topic:Install Plandora Project Management on Eclipse Virgo
Goto Forum:
  


Current Time: Fri Aug 01 04:08:15 EDT 2014

Powered by FUDForum. Page generated in 0.02357 seconds