IIRC, the SharedLib only takes affect on the runtime.
One workaround is that first deploy a geronimo service module which contains the sharedlib gbean, and then add it as a dependency for your ear application, it should work.

2010/9/15 Anil Chawla <achawla@us.ibm.com>

Hi,
We're trying to use the SharedLib GBean to classload *all* of the libraries for our application. This is because the libraries used by our applications in Geronimo are also needed by our stand-alone Java processes. We obviously don't want to duplicate the libraries for maintenance reasons. We have an EAR containing two WAR files (each requiring the same set of libraries), and we've defined the SharedLib reference within the EAR's geronimo-application.xml. The SharedLib works fine for all of our libraries except that it fails to classload the servlet file referenced in the web.xml of the two WARs. The only way we've been able to get it to work is to package the library containing our servlet class inside the EAR. Why can't the SharedLib load the servlet class?

Here is the SharedLib entry in geronimo-application.xml:

<gbean name="SharedLib" class="org.apache.geronimo.system.sharedlib.SharedLib">
<attribute name="libDirs">
/data/support,/data/MyApp/lib,/data/MyApp/libext
</attribute>
<attribute name="classesDirs">
/data/support/conf,/data/MyApp/database,/data/MyApp/conf
</attribute>
<reference name="ServerInfo">
<name>ServerInfo</name>
</reference>
</gbean>

And the servlet definition in web.xml:

<servlet>
<servlet-name>front_controller</servlet-name>
<servlet-class>org.myapp.controller.FrontController</servlet-class>
</servlet>

The "FrontController" class is defined in /data/MyApp/libext/myapp.jar. When we deploy the EAR, we get the following exception:

Caused by: java.lang.ClassNotFoundException: org.myapp.controller.FrontController in classloader MyApp/application_frontend.war/1.0/car
at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:447)
at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:281)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.apache.geronimo.jaxws.builder.AdvancedWARWebServiceFinder.getPortInfo(AdvancedWARWebServiceFinder.java:142)
... 22 more

Thanks for your help.

Anil Chawla




--
Ivan