Yeah, they have different classloaders :( Well, one "easy" way out was to move resources/www to the WAR/WEB-INF/classes
It now does load the OSLApplication.html, problem is the other resources... like <script type="text/javascript" language="javascript" src="org.openspotlight.OSLApplication.nocache.js"></script> </head> not counting the images and other static resources. Do you need to register each one of them? Regards On Tue, Feb 3, 2009 at 3:09 PM, Stuart McCulloch <[email protected]> wrote: > 2009/2/4 Vinicius Carvalho <[email protected]> > > > Hello there! Rob following your instructions when we try to load a > > resource: > > > > > httpService.registerResource("/OSLApplication.html","/OSLApplication.html", > > webcontext); //This is the GWT entry-point > > > > And when the method from webcontext is finally called when the user > points > > to localhost:8080/myapp/OSLApplication.html: > > > > public URL getResource(String name) { > > // TODO Auto-generated method stub > > return > GWTService.class.getResource("/resources/www/"+baseURI+name); > > } > > > > We are always getting null > > > > We tried: > > > > "resources/www/"+baseURI+name > > > > And also did not work > > > > We tried using > > GWTService.class.getClassLoader.getResource... > > even > > Thread.currentThread().getContextClassLoader().getResource > > > > Hi Vinicius, > > have you tried printing out: > > GWTService.class.getClassLoader() and > Thread.currentThread().getContextClassLoader() > > to see if these match the classloader of the bundle with the resource? > ( most OSGi frameworks put the bundle id in the classloader name ) > > if you're using the same classloader as the bundle with the resource > then it should find it (just like a normal jar) - otherwise there are OSGi > APIs that can load resources from Bundle instances, for situations > where you don't know what the bundle classloader is but you know > the Bundle (note that you can't get the classloader instance directly > from the Bundle, as that would be too tempting!) > > if you want to share a resource with other bundles then you need to add > exports and imports, just as with classes - if you have several bundles > providing resources in the same package then you might want to look > at the extender pattern, rather than attempt to merge these packages > together (because by default OSGi doesn't merge package contents - > instead it picks one bundle to be the 'exporter' and uses the package > contents from this bundle - to merge package contents you need to > use advanced techniques like Require-Bundle...) > > [ http://www.osgi.org/blog/2007/02/osgi-extender-model.html ] > > HTH > > It always returns null. > > > > The jar is packaged: > > > > org/ > > resources/ > > META-INF > > > > But it seems that resources/ is not being loaded by the class loader, do > we > > need any special directive on the MANIFEST? > > > > Regards > > > > > > > -- > Cheers, Stuart >

