You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Andreas Mucha <si...@gmx.net> on 2009/05/26 18:45:55 UTC

unable to start felix swing app in eclipse

Hi everybody,

i have a problem to run felix with a gui-bunlde out of eclipse.
i use felix 1.8.0 . i tested eclipse 3.4.1 and 3.4.2 .
i tested some combinations of running eclipse and/or felix
with jre 1.5.19 and/or 1.6.13 .

the problem : my simple bundle activator (a runnable)
looks e.g. like this :
//code adapted from felix gui app example
public void start(BundleContext context) throws Exception
{
 if (SwingUtilities.isEventDispatchThread())
 {
  run();
 }
 else
 {
  try
  {
   javax.swing.SwingUtilities.invokeAndWait(this);            	
  }
  catch (Throwable t)
  {
   t.printStackTrace();
  }
 }
}

public void run()
{
 m_frame = new JFrame();
 m_frame.setSize(...);
 m_frame.setVisible(true);
}

when i start felix with my bundle from console, everything is fine.
the frame is displayed as expected.
when i start felix with my bundle in debug mode inside eclipes,
everything is fine. the frame is displayed as expected.

but if i start felix with my bundle inside eclipse as normal 
app/launch config, it hangs. the swing thread seems to be blokcing.

felix ps says in that case :
-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Starting   ] [    0] System Bundle (1.8.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
[   4] [Starting   ] [    1] my.little.bundle (1.0.0)
-> 

if i now type 'start 0' then everything goes fine.

in the mail archive i found that this problem is known.
but i couldnt find any suitable solution.

any ideas about that strange behaviour ??

best regards and thanx in advance
andreas mucha
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

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


Re: unable to start felix swing app in eclipse

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Yes, the problem is known, but there is no apparent universal solution.

The bug is in the JDK and results when Felix' shell TUI reads from 
System.in...this somehow interferes with something in the JDK leading to 
some sort of deadlock until there is input on the stream.

One possible solution is to check the input stream for available input 
before reading, however, this approach works in Eclipse, but doesn't 
echo characters when you run it from the console under Windows.

The only option is to potentially have a configuration switch that you 
can flip back and forth when you are running the Felix shell TUI within 
Eclipse.

Apparently, Equinox does this, but they are able to set the switch 
automatically so you don't need to change your configuration...

Not sure what we should do...please feel free to comment on:

     http://issues.apache.org/jira/browse/FELIX-619

-> richard

On 5/26/09 12:45 PM, Andreas Mucha wrote:
> Hi everybody,
>
> i have a problem to run felix with a gui-bunlde out of eclipse.
> i use felix 1.8.0 . i tested eclipse 3.4.1 and 3.4.2 .
> i tested some combinations of running eclipse and/or felix
> with jre 1.5.19 and/or 1.6.13 .
>
> the problem : my simple bundle activator (a runnable)
> looks e.g. like this :
> //code adapted from felix gui app example
> public void start(BundleContext context) throws Exception
> {
>   if (SwingUtilities.isEventDispatchThread())
>   {
>    run();
>   }
>   else
>   {
>    try
>    {
>     javax.swing.SwingUtilities.invokeAndWait(this);            	
>    }
>    catch (Throwable t)
>    {
>     t.printStackTrace();
>    }
>   }
> }
>
> public void run()
> {
>   m_frame = new JFrame();
>   m_frame.setSize(...);
>   m_frame.setVisible(true);
> }
>
> when i start felix with my bundle from console, everything is fine.
> the frame is displayed as expected.
> when i start felix with my bundle in debug mode inside eclipes,
> everything is fine. the frame is displayed as expected.
>
> but if i start felix with my bundle inside eclipse as normal
> app/launch config, it hangs. the swing thread seems to be blokcing.
>
> felix ps says in that case :
> ->  ps
> START LEVEL 1
>     ID   State         Level  Name
> [   0] [Starting   ] [    0] System Bundle (1.8.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
> [   4] [Starting   ] [    1] my.little.bundle (1.0.0)
> ->
>
> if i now type 'start 0' then everything goes fine.
>
> in the mail archive i found that this problem is known.
> but i couldnt find any suitable solution.
>
> any ideas about that strange behaviour ??
>
> best regards and thanx in advance
> andreas mucha
>    

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


Re: unable to start felix swing app in eclipse

Posted by Marcel Offermans <ma...@luminis.nl>.
Are you running on Mac OS X?

On May 26, 2009, at 18:45 , Andreas Mucha wrote:

> i have a problem to run felix with a gui-bunlde out of eclipse.
> any ideas about that strange behaviour ??



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


Re: unable to start felix swing app in eclipse

Posted by Karl Pauls <ka...@gmail.com>.
Can you point us to where in the archives it does say that this
problem is known?

regards,

Karl

On Tue, May 26, 2009 at 6:45 PM, Andreas Mucha <si...@gmx.net> wrote:
> Hi everybody,
>
> i have a problem to run felix with a gui-bunlde out of eclipse.
> i use felix 1.8.0 . i tested eclipse 3.4.1 and 3.4.2 .
> i tested some combinations of running eclipse and/or felix
> with jre 1.5.19 and/or 1.6.13 .
>
> the problem : my simple bundle activator (a runnable)
> looks e.g. like this :
> //code adapted from felix gui app example
> public void start(BundleContext context) throws Exception
> {
>  if (SwingUtilities.isEventDispatchThread())
>  {
>  run();
>  }
>  else
>  {
>  try
>  {
>   javax.swing.SwingUtilities.invokeAndWait(this);
>  }
>  catch (Throwable t)
>  {
>   t.printStackTrace();
>  }
>  }
> }
>
> public void run()
> {
>  m_frame = new JFrame();
>  m_frame.setSize(...);
>  m_frame.setVisible(true);
> }
>
> when i start felix with my bundle from console, everything is fine.
> the frame is displayed as expected.
> when i start felix with my bundle in debug mode inside eclipes,
> everything is fine. the frame is displayed as expected.
>
> but if i start felix with my bundle inside eclipse as normal
> app/launch config, it hangs. the swing thread seems to be blokcing.
>
> felix ps says in that case :
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Starting   ] [    0] System Bundle (1.8.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
> [   4] [Starting   ] [    1] my.little.bundle (1.0.0)
> ->
>
> if i now type 'start 0' then everything goes fine.
>
> in the mail archive i found that this problem is known.
> but i couldnt find any suitable solution.
>
> any ideas about that strange behaviour ??
>
> best regards and thanx in advance
> andreas mucha
> --
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
>
> ---------------------------------------------------------------------
> 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