Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Kernel not starting when launched from java program
Kernel not starting when launched from java program [message #787278] Tue, 31 January 2012 06:45 Go to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Hello.

I am trying to launch a Virgo kernel from a simple Java program. I do this by using the "startup.bat" script and launching it from Java via the org.apache.common.exec facilities.

When I run my program, I can see the script being executed and Virgo log files being created in the serviceability folder, however the eventlog.log file only shows the
[2012-01-31 11:25:33.302] startup-tracker              <KE0001I> Kernel starting.


message and nothing else. What happens between the "Kernel starting" and "Kernel started" messages? How would I go about debugging this?

TIA,
B.
Re: Kernel not starting when launched from java program [message #787281 is a reply to message #787278] Tue, 31 January 2012 06:50 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Take a look at serviceability/logs/log.log for the trace log for starters.
Re: Kernel not starting when launched from java program [message #787290 is a reply to message #787281] Tue, 31 January 2012 07:01 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Thanks Glyn.

Here is as far as log.log goes:
[2012-01-31 11:25:34.649] INFO  kernel-dm-9                  .a.d.i.BlueprintEventPostingOsgiBundleApplicationContextListener  Sending event to topic 'org/osgi/service/blueprint/container/CREATED' with properties '{bundle.version=3.0.0.RELEASE, bundle=org.eclipse.virgo.kernel.shell_3.0.0.RELEASE [38], bundle.symbolicName=org.eclipse.virgo.kernel.shell, type=1, timestamp=1328009134648, bundle.id=38}'
[2012-01-31 11:25:34.649] INFO  kernel-dm-9                  org.eclipse.virgo.kernel.core.internal.BundleStartTracker         Handling event 'org.osgi.service.event.Event [topic=org/osgi/service/blueprint/container/CREATED]'
[2012-01-31 11:25:34.649] INFO  kernel-dm-9                  org.eclipse.virgo.kernel.core.internal.BundleStartTracker         Recording created application context for bundle 'org.eclipse.virgo.kernel.shell_3.0.0.RELEASE [38]'
[2012-01-31 11:25:34.649] INFO  kernel-dm-9                  o.s.osgi.extender.internal.activator.ContextLoaderListener        Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=org.eclipse.virgo.kernel.shell, config=osgibundle:/META-INF/spring/*.xml))
[2012-01-31 11:25:34.649] INFO  start-signalling-1           org.eclipse.virgo.kernel.core.internal.BundleStartTracker         Driving signal 'org.eclipse.virgo.kernel.core.BlockingAbortableSignal@537e7f88'
[2012-01-31 11:25:34.649] INFO  startup-tracker              org.eclipse.virgo.kernel.core.internal.BundleStartTracker         Adding signal 'org.eclipse.virgo.kernel.core.BlockingAbortableSignal@46b9979b' for bundle 'org.eclipse.virgo.kernel.osgi_3.0.0.RELEASE [39]'
[2012-01-31 11:25:34.650] INFO  startup-tracker              org.eclipse.virgo.kernel.core.internal.BundleStartTracker         Bundle 'org.eclipse.virgo.kernel.osgi_3.0.0.RELEASE [39]' has started and its application context is available
[2012-01-31 11:25:34.650] INFO  start-signalling-1           org.eclipse.virgo.kernel.core.internal.BundleStartTracker         Driving signal 'org.eclipse.virgo.kernel.core.BlockingAbortableSignal@46b9979b'
[2012-01-31 11:25:34.650] INFO  start-signalling-1           org.eclipse.virgo.kernel.core.internal.BundleStartTracker         Driving signal 'org.eclipse.virgo.kernel.core.BlockingAbortableSignal@42906563'
[2012-01-31 11:25:34.829] INFO  system-artifacts             o.e.v.k.m.i.deployer.ModelInstallArtifactLifecycleListener        Processing installing event for plan 'org.eclipse.virgo.kernel.userregion.springdm' version '3.0.0'

Re: Kernel not starting when launched from java program [message #787295 is a reply to message #787290] Tue, 31 January 2012 07:11 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
So the deployer is running. It looks like the startup sequence has gone quite a long way in. Not sure what the current state is. You could try jps and jstack to get a thread stack dump to see what threads are running or waiting. Another approach would be to attach a debugger and hook into the flow at the ModelInstallArtifactLifecycleListener log event above and then trace back from the listener into the deployer and see why that plan does not get installed.

If this sounds too much like hard work, you could consider another launching mechanism, but beware that our launcher is changing to be the standard Equinox launcher in Virgo 3.5.
Re: Kernel not starting when launched from java program [message #787351 is a reply to message #787295] Tue, 31 January 2012 08:39 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Thanks Glyn, will try your recommendations.
Re: Kernel not starting when launched from java program [message #788084 is a reply to message #787351] Wed, 01 February 2012 05:37 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Some progress. On a hunch I reduced all of the logging levels to ERROR. My hunch, btw, was that Virgo was blocking on IO somewhere and logging was the natural suspect. Voila' it all started working. So now where to go? Why should I have buffer issues when executing from within java?

Does this ring any bells for anyone?
Re: Kernel not starting when launched from java program [message #788128 is a reply to message #788084] Wed, 01 February 2012 06:33 Go to previous messageGo to next message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
I got it!!!

The reason why the startup is blocking is the fact that the standard launch command I was using is reading all the std out and std err and, when its streams buffer fills up, it blocks.

By switching from the standard launch command to a lower level one which uses asynchronous processing, all issues are solved.

I will post a complete solution when I am done.

Thanks!
Re: Kernel not starting when launched from java program [message #788194 is a reply to message #788128] Wed, 01 February 2012 08:22 Go to previous messageGo to next message
Hristo Iliev is currently offline Hristo Iliev
Messages: 156
Registered: May 2010
Location: Sofia, Bulgaria
Senior Member

For external processes I'm using Apache's commons.exec:

CommandLine cmdLine = new CommandLine("executable");
cmdLine.addArguments(...)

DefaultExecutor executor = new DefaultExecutor();
executor.setWorkingDirectory(workingDir);
ExecuteWatchdog watchdog = new ExecuteWatchdog(20 * 60 * 1000); // 20 minutes
executor.setWatchdog(watchdog);

PumpStreamHandler pumpHandler = new PumpStreamHandler();
executor.setStreamHandler(pumpHandler);
exitCode = executor.execute(cmdLine);

if (executor.isFailure(exitCode)) {
...
}

You don't need the watchdog in most cases if this will be used for Virgo productively. If you are running tests or using Virgo for short living tasks this can be handy.
Re: Kernel not starting when launched from java program [message #788214 is a reply to message #788194] Wed, 01 February 2012 09:00 Go to previous message
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
Yep, thanks Hristo, org.apache.commons.exec is exactly the lib I am using and I use the same classes as in your code snippet, so I guess I no longer need to post the solution Razz !

[Updated on: Wed, 01 February 2012 09:01]

Report message to a moderator

Previous Topic:Virgo & SecurityManager
Next Topic:Attention Virgo builders: upgrade Ant
Goto Forum:
  


Current Time: Fri Apr 18 19:34:49 EDT 2014

Powered by FUDForum. Page generated in 0.02167 seconds