Results 1 to 2 of 2

Thread: OSGi and Swing

  1. #1
    dead_devil_66 is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default OSGi and Swing


    I'm having serious issues in having JFrames declared inside the Activator class or any class used in a service!!!
    When i try to start the bundle, there's always an error like this (an example):
    "Error executing commang: Activator start error in bundle swing_osgi [183]."
    swing_osgi is the bundle and 183 is the ID.

    What's is the problem????

    I didn't put any code here because it's happening the same, i have the saaaaaaaaaame issue, in every example i make...
    Last edited by dead_devil_66; 02-08-2011 at 04:55 AM.

  2. #2
    dead_devil_66 is offline Member
    Join Date
    Feb 2011
    Rep Power



    Java Code:
    package pack.server;
    import java.util.Dictionary;
    import java.util.Hashtable;
    import javax.swing.JFrame;
    import org.osgi.framework.BundleActivator;
    import org.osgi.framework.BundleContext;
    import org.osgi.framework.ServiceRegistration;
    import pack.iserver.IServer;
    public class Activator implements BundleActivator {
    	private ServiceRegistration registration;
    	private JFrame f = null;
    	public void start(BundleContext context) throws Exception {
    		Dictionary<String, String> props = new Hashtable<String, String>();
    		javax.swing.SwingUtilities.invokeLater(new Runnable() {
                // This creates of the application window.
                public void run()
                	f = new JFrame();
    //		Console c = new Console();
    //		c.setSystemInput();
    //		c.setSystemOutput();
    //		c.setSystemErr();
    		registration = context.registerService(IServer.class.getName(), 
    					new Server(), props);
    		System.out.println("O servidor foi registado");
    //		String[] keys = registration.getReference().getPropertyKeys();
    //		for(String k: keys){
    //			System.out.println(k);
    //		}
    	public void stop(BundleContext context) throws Exception {
    this will fail to start and will cause apache servicemix to throw a message like the one i posted in the first post.

    strange thing is that "hey" isn't even printed.... wtf

    I even tried without using the invokeLater method and causes to happen the same.

Similar Threads

  1. OSGi and Class Loaders
    By nim123 in forum Advanced Java
    Replies: 0
    Last Post: 04-15-2010, 01:26 AM
  2. Swing
    By tmotse in forum AWT / Swing
    Replies: 0
    Last Post: 03-31-2010, 10:18 AM
  3. jSpellCorrect 0.4-osgi
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-26-2008, 08:35 PM
  4. AWT or Swing
    By bugger in forum AWT / Swing
    Replies: 4
    Last Post: 11-22-2007, 10:44 AM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts