dev@glassfish.java.net

Re: reload gfv3 module

From: Richard S. Hall <heavy_at_ungoverned.org>
Date: Sat, 17 Jan 2009 11:56:43 -0500

Well, I don't know exactly how GF is processing the modules in the
modules directory, but the proper way to reload a bundle in OSGi is with
the "update" command. If the bundle you want to update is in the same
location from which it was originally installed with the same file name,
then you can just do:

    update <bundle-id>

If it is in a different location or file name, then you can do:

    update <bundle-id> <update-jar-url>

If your bundle does not export any packages, then this should be
sufficient. If it does, you will likely need to do a "refresh" after the
update.

-> richard


Claudio Miranda wrote:
> I want to reload a module I have copied to modules directory.
> glassfish is running.
> I open the felix shell, issue the ps command, locate the ID related to
> my module.
> I have tried 2 commands: stop/start and uninstall/install
> The stop/start command, has no effect.
> After uninstall, I need to install the module, so I do: install
> file:///opt/glassfishv3/glassfish/modules/console-certmanager.jar
> ps command, shows the module is active
> [ 127] [Active ] [ 1] Certificate Admin Console Plugin (3.0.0.SNAPSHOT)
>
> Then, I try to load the admin web console, it throws an exception
>
> PWC1406: Servlet.service() for servlet FacesServlet threw exception
> java.lang.RuntimeException:
> java.lang.reflect.InvocationTargetException while attempting to
> process a 'afterCreate' event for 'head'.
> at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:422)
> at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:394)
> at com.sun.jsftemplating.layout.descriptors.LayoutComponent.afterCreate(LayoutComponent.java:363)
> ......[exception cut]
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.GeneratedMethodAccessor579.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at com.sun.jsftemplating.layout.descriptors.handler.Handler.invoke(Handler.java:422)
> at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:420)
> ... 54 more
> Caused by: java.lang.IllegalStateException: The bundle is uninstalled.
> at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1362)
> at org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:187)
> at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$2.getResource(OSGiModuleImpl.java:367)
> at org.jvnet.hk2.osgiadapter.OSGiModulesRegistryImpl$1.findResource(OSGiModulesRegistryImpl.java:254)
> at java.lang.ClassLoader.getResource(ClassLoader.java:978)
> at org.glassfish.web.loader.WebappClassLoader.getResource(WebappClassLoader.java:1172)
> at java.lang.ClassLoader.getResource(ClassLoader.java:973)
> at com.sun.jsftemplating.util.FileUtil.searchForFile(FileUtil.java:170)
> at com.sun.jsftemplating.layout.xml.XMLLayoutDefinitionManager.accepts(XMLLayoutDefinitionManager.java:110)
> at com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefinitionManager(LayoutDefinitionManager.java:344)
> at com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefinition(LayoutDefinitionManager.java:150)
> at org.glassfish.admingui.handlers.PluginHandlers.includeIntegrationPoint(PluginHandlers.java:317)
>
> So, what is the correct way to reload a module ?
>
>