You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Gionni <gi...@tiscali.it> on 2009/04/23 14:31:40 UTC

Bundle starting only after some commands to the shell

Dear forum users, 
thanks in advance for your support!
(I hope to be able to help you in the future.. )

My problem is that, when I start Felix, some bundles starts only after that
I send some commnds to the shell (i.e. ps or also a blank line).

For example the following code reegards a bundle Activator in wich I start a
Derby database:
public class Activator implements BundleActivator {
	[...]fields[..]
	public void start(BundleContext context) {
		 System.out.println("***Starting the server at port: "
						+ dbPort + " on folder " + dbFolder + "***");
		 derbyServer = new NetworkServerControl(InetAddress
						.getByName("localhost"), dbPort);
		 derbyServer.start(null);
		 System.out.println("***Started****");
		}
      [...]stop
    }

If I install the bundle (using Felix shell) and then I start it, it works
correctly.
If I execute the update command it works correcty.

Anyway if the bundle is installed and I stop and re-start felix I just read
the message "Starting the server at port..." . 

Felix seems is blocked, the bunlde stays in the "starting" mode and other
bundles do not start. 

If at this point I input a blank line or a "ps" command the bundle starts
and also other bundles start withouth any problem. In the past I had the
same problem with a bundle starting a SWING gui (it was just an exercise and
I do not found a solution). 

May be that I need to start the derby server on another thread? Anyway do
you undestand Felix behaviour?

Thanks for your answers,
Giovanni  



-- 
View this message in context: http://www.nabble.com/Bundle-starting-only-after-some-commands-to-the-shell-tp23195936p23195936.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by Gionni <gi...@tiscali.it>.
Hi Richard,
I will be happy to test the patch.

Best regards
-Giovanni


Richard S. Hall wrote:
> 
> Giovanni,
> 
> If I create a patched Shell TUI bundle, could you test it to see if the 
> issue goes away?
> 
> -> richard
> 
> On 4/23/09 10:26 AM, Gionni wrote:
>> I have isolated the problem.
>>
>> The instructions blocking Felix until something is entered on the shell
>> is
>>
>> InetAddress.getByName("localhost");
>>
>> The strange thing is that all works correctly if I press I do something
>> on
>> the shell.
>> I also tried to perform the instruction on a thread started in the
>> Activator
>> but the Felix behaviour its the same. Any siggestion?
>>
>> Giovanni
>>
>>
>>
>> Gionni wrote:
>>    
>>> Dear forum users,
>>> thanks in advance for your support!
>>> (I hope to be able to help you in the future.. )
>>>
>>> My problem is that, when I start Felix, some bundles starts only after
>>> that I send some commnds to the shell (i.e. ps or also a blank line).
>>>
>>> For example the following code reegards a bundle Activator in wich I
>>> start
>>> a Derby database:
>>> public class Activator implements BundleActivator {
>>> 	[...]fields[..]
>>> 	public void start(BundleContext context) {
>>> 		 System.out.println("***Starting the server at port: "
>>> 						+ dbPort + " on folder " + dbFolder + "***");
>>> 		 derbyServer = new NetworkServerControl(InetAddress
>>> 						.getByName("localhost"), dbPort);
>>> 		 derbyServer.start(null);
>>> 		 System.out.println("***Started****");
>>> 		}
>>>        [...]stop
>>>      }
>>>
>>> If I install the bundle (using Felix shell) and then I start it, it
>>> works
>>> correctly.
>>> If I execute the update command it works correcty.
>>>
>>> Anyway if the bundle is installed and I stop and re-start felix I just
>>> read the message "Starting the server at port..." .
>>>
>>> Felix seems is blocked, the bunlde stays in the "starting" mode and
>>> other
>>> bundles do not start.
>>>
>>> If at this point I input a blank line or a "ps" command the bundle
>>> starts
>>> and also other bundles start withouth any problem. In the past I had the
>>> same problem with a bundle starting a SWING gui (it was just an exercise
>>> and I do not found a solution).
>>>
>>> May be that I need to start the derby server on another thread? Anyway
>>> do
>>> you undestand Felix behaviour?
>>>
>>> Thanks for your answers,
>>> Giovanni
>>>
>>>
>>>
>>>
>>>      
>>
>>    
> 
> 

-- 
View this message in context: http://www.nabble.com/Bundle-starting-only-after-some-commands-to-the-shell-tp23195936p23592005.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by Patrick Forhan <fe...@muddyhorse.com>.
On Fri, May 15, 2009 at 12:37 PM, Richard S. Hall <he...@ungoverned.org> wrote:
> If I create a patched Shell TUI bundle, could you test it to see if the
> issue goes away?

I'd be willing to try it, too.

Pat.

-- 
Defy mediocrity.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by Gionni <gi...@tiscali.it>.
Hi Richard,
I will be happy to test the patch.

-Giovanni


Richard S. Hall wrote:
> 
> Giovanni,
> 
> If I create a patched Shell TUI bundle, could you test it to see if the 
> issue goes away?
> 
> -> richard
> 
> On 4/23/09 10:26 AM, Gionni wrote:
>> I have isolated the problem.
>>
>> The instructions blocking Felix until something is entered on the shell
>> is
>>
>> InetAddress.getByName("localhost");
>>
>> The strange thing is that all works correctly if I press I do something
>> on
>> the shell.
>> I also tried to perform the instruction on a thread started in the
>> Activator
>> but the Felix behaviour its the same. Any siggestion?
>>
>> Giovanni
>>
>>
>>
>> Gionni wrote:
>>    
>>> Dear forum users,
>>> thanks in advance for your support!
>>> (I hope to be able to help you in the future.. )
>>>
>>> My problem is that, when I start Felix, some bundles starts only after
>>> that I send some commnds to the shell (i.e. ps or also a blank line).
>>>
>>> For example the following code reegards a bundle Activator in wich I
>>> start
>>> a Derby database:
>>> public class Activator implements BundleActivator {
>>> 	[...]fields[..]
>>> 	public void start(BundleContext context) {
>>> 		 System.out.println("***Starting the server at port: "
>>> 						+ dbPort + " on folder " + dbFolder + "***");
>>> 		 derbyServer = new NetworkServerControl(InetAddress
>>> 						.getByName("localhost"), dbPort);
>>> 		 derbyServer.start(null);
>>> 		 System.out.println("***Started****");
>>> 		}
>>>        [...]stop
>>>      }
>>>
>>> If I install the bundle (using Felix shell) and then I start it, it
>>> works
>>> correctly.
>>> If I execute the update command it works correcty.
>>>
>>> Anyway if the bundle is installed and I stop and re-start felix I just
>>> read the message "Starting the server at port..." .
>>>
>>> Felix seems is blocked, the bunlde stays in the "starting" mode and
>>> other
>>> bundles do not start.
>>>
>>> If at this point I input a blank line or a "ps" command the bundle
>>> starts
>>> and also other bundles start withouth any problem. In the past I had the
>>> same problem with a bundle starting a SWING gui (it was just an exercise
>>> and I do not found a solution).
>>>
>>> May be that I need to start the derby server on another thread? Anyway
>>> do
>>> you undestand Felix behaviour?
>>>
>>> Thanks for your answers,
>>> Giovanni
>>>
>>>
>>>
>>>
>>>      
>>
>>    
> 
> 

-- 
View this message in context: http://www.nabble.com/Bundle-starting-only-after-some-commands-to-the-shell-tp23195936p23592004.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Giovanni,

If I create a patched Shell TUI bundle, could you test it to see if the 
issue goes away?

-> richard

On 4/23/09 10:26 AM, Gionni wrote:
> I have isolated the problem.
>
> The instructions blocking Felix until something is entered on the shell is
>
> InetAddress.getByName("localhost");
>
> The strange thing is that all works correctly if I press I do something on
> the shell.
> I also tried to perform the instruction on a thread started in the Activator
> but the Felix behaviour its the same. Any siggestion?
>
> Giovanni
>
>
>
> Gionni wrote:
>    
>> Dear forum users,
>> thanks in advance for your support!
>> (I hope to be able to help you in the future.. )
>>
>> My problem is that, when I start Felix, some bundles starts only after
>> that I send some commnds to the shell (i.e. ps or also a blank line).
>>
>> For example the following code reegards a bundle Activator in wich I start
>> a Derby database:
>> public class Activator implements BundleActivator {
>> 	[...]fields[..]
>> 	public void start(BundleContext context) {
>> 		 System.out.println("***Starting the server at port: "
>> 						+ dbPort + " on folder " + dbFolder + "***");
>> 		 derbyServer = new NetworkServerControl(InetAddress
>> 						.getByName("localhost"), dbPort);
>> 		 derbyServer.start(null);
>> 		 System.out.println("***Started****");
>> 		}
>>        [...]stop
>>      }
>>
>> If I install the bundle (using Felix shell) and then I start it, it works
>> correctly.
>> If I execute the update command it works correcty.
>>
>> Anyway if the bundle is installed and I stop and re-start felix I just
>> read the message "Starting the server at port..." .
>>
>> Felix seems is blocked, the bunlde stays in the "starting" mode and other
>> bundles do not start.
>>
>> If at this point I input a blank line or a "ps" command the bundle starts
>> and also other bundles start withouth any problem. In the past I had the
>> same problem with a bundle starting a SWING gui (it was just an exercise
>> and I do not found a solution).
>>
>> May be that I need to start the derby server on another thread? Anyway do
>> you undestand Felix behaviour?
>>
>> Thanks for your answers,
>> Giovanni
>>
>>
>>
>>
>>      
>
>    

Re: Bundle starting only after some commands to the shell

Posted by Karl Pauls <ka...@gmail.com>.
The point is that you need two things to happen:

1) Something reading System.in
2) Something loading a native library

When you run felix from the shell only 1) happens so it works. Inside
eclipse, somebody must do 2) and then you have this problem.

We will workaround the bug for the next shell version.

regards,

Karl

On Fri, Apr 24, 2009 at 9:20 AM, Gionni <gi...@tiscali.it> wrote:
>
> Hi Patrick,
> you are right!
> I was executing the bundle under eclipse.
> If I try it using the DOS command line all works correctly.
> Anyway it is difficult to understand the cause.
> If the cause as Tom suggested is the VM then it should not work in both the
> case because I use the same VM (jdk1.6.0_11).
> Anyway thanks for you support.
>
> Giovanni
>
>
> Patrick Forhan-2 wrote:
>>
>> Are you by any chance running this in eclipse?  Have you tried from
>> the command line?  This looks very similar to the behavior we had when
>> running from eclipse.  You can also try removing the shell.tui bundle
>> and running to see how it behaves.
>>
>> Pat.
>>
>> --
>> Defy mediocrity.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Bundle-starting-only-after-some-commands-to-the-shell-tp23195936p23211220.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by Gionni <gi...@tiscali.it>.
Hi Patrick,
you are right!
I was executing the bundle under eclipse. 
If I try it using the DOS command line all works correctly.
Anyway it is difficult to understand the cause. 
If the cause as Tom suggested is the VM then it should not work in both the
case because I use the same VM (jdk1.6.0_11).
Anyway thanks for you support.

Giovanni


Patrick Forhan-2 wrote:
> 
> Are you by any chance running this in eclipse?  Have you tried from
> the command line?  This looks very similar to the behavior we had when
> running from eclipse.  You can also try removing the shell.tui bundle
> and running to see how it behaves.
> 
> Pat.
> 
> -- 
> Defy mediocrity.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Bundle-starting-only-after-some-commands-to-the-shell-tp23195936p23211220.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by Patrick Forhan <fe...@muddyhorse.com>.
Are you by any chance running this in eclipse?  Have you tried from
the command line?  This looks very similar to the behavior we had when
running from eclipse.  You can also try removing the shell.tui bundle
and running to see how it behaves.

Pat.

-- 
Defy mediocrity.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by Gionni <gi...@tiscali.it>.
I have isolated the problem.

The instructions blocking Felix until something is entered on the shell is

InetAddress.getByName("localhost");

The strange thing is that all works correctly if I press I do something on
the shell.
I also tried to perform the instruction on a thread started in the Activator
but the Felix behaviour its the same. Any siggestion?

Giovanni



Gionni wrote:
> 
> Dear forum users, 
> thanks in advance for your support!
> (I hope to be able to help you in the future.. )
> 
> My problem is that, when I start Felix, some bundles starts only after
> that I send some commnds to the shell (i.e. ps or also a blank line).
> 
> For example the following code reegards a bundle Activator in wich I start
> a Derby database:
> public class Activator implements BundleActivator {
> 	[...]fields[..]
> 	public void start(BundleContext context) {
> 		 System.out.println("***Starting the server at port: "
> 						+ dbPort + " on folder " + dbFolder + "***");
> 		 derbyServer = new NetworkServerControl(InetAddress
> 						.getByName("localhost"), dbPort);
> 		 derbyServer.start(null);
> 		 System.out.println("***Started****");
> 		}
>       [...]stop
>     }
> 
> If I install the bundle (using Felix shell) and then I start it, it works
> correctly.
> If I execute the update command it works correcty.
> 
> Anyway if the bundle is installed and I stop and re-start felix I just
> read the message "Starting the server at port..." . 
> 
> Felix seems is blocked, the bunlde stays in the "starting" mode and other
> bundles do not start. 
> 
> If at this point I input a blank line or a "ps" command the bundle starts
> and also other bundles start withouth any problem. In the past I had the
> same problem with a bundle starting a SWING gui (it was just an exercise
> and I do not found a solution). 
> 
> May be that I need to start the derby server on another thread? Anyway do
> you undestand Felix behaviour?
> 
> Thanks for your answers,
> Giovanni  
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Bundle-starting-only-after-some-commands-to-the-shell-tp23195936p23197360.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle starting only after some commands to the shell

Posted by Tom Watson <tj...@gmail.com>.
This appears to be the VM bug
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4809647

In Equinox we had to implement a similar workaround as described in the bug
(check isAvailable()) before before reading from the InputStream.  Also see
eclipse bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=40066

Tom.
-- 
View this message in context: http://www.nabble.com/Bundle-starting-only-after-some-commands-to-the-shell-tp23195936p23198274.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org