[jboss-user] [JBoss OSGi Users] - Installing and running bundles on Jboss

PedroGomes do-not-reply at jboss.com
Sat Dec 5 20:36:28 EST 2009


I'm currently working on a project for a application deployed in Jboss where we can deploy bundles to implement a new functionality.
After some tests with with Felix and Equinox, I created a little EJB application that installs and runs bundles using some actions offered by them.  	

	
  |      public String doInstall() {
  |            
  |                 FrameworkIntegration inte =  new FrameworkIntegration();
  | 		inte.create();
  | 		//inte.start();
  | 		context =  inte.getBundleContext();
  |                 try{
  |                 context.installBundle("file:///Users/ped/Desktop/UCE15/PluginJars/libPlugin.jar");
  | 	        context.installBundle("file:///Users/ped/Desktop/UCE15/PluginJars/sensorPlugin.jar");
  |                  ...
  |                 }catch....
  | 
  | }
  | 
  | 
  | 	public String doAction() {
  | 		
  | 		if(context==null){
  | 			FrameworkIntegration inte =  new FrameworkIntegration();
  | 			inte.create();
  | 			inte.start();
  | 			context =  inte.getBundleContext();
  | 		}
  | 		
  | 		Bundle[] bds = context.getBundles();
  | 		for(Bundle b : bds){
  | 			System.out.println("BundleID: "+b.getBundleId()+ " Name: " + b.getSymbolicName() +" State: ");
  | 			try {
  | 				b.start();			
  | 			} catch (BundleException e) {
  | 			System.out.println("Exception on bundle start: "+e.getCause().toString());
  | 			}			
  | 		}
  |     	return "Run";
  | 	}
  | 

Now, the questions: 
      1) This experiment works on Felix, but on Equinox i get null pointers when I try to get the context and other. Why?
       2) When running on Felix, I can install and run the plugins, but i don't see the bundles installed by Jboss on start, the same ones I see on the configuration page for bundles. And vice-versa, i don't see my  bundles on the page. Did I start another Felix container (or something like that, I'm not a pro on OSGi sry)?. And can I get the Jboss container so I can see my bundles on the page, and install new ones from there?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269147#4269147

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269147



More information about the jboss-user mailing list