geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anil Chawla <acha...@us.ibm.com>
Subject Re: Unable to classload servlet class using SharedLib GBean
Date Thu, 16 Sep 2010 15:38:27 GMT

Ivan,
Thanks for your response - this sounds like a good option. I tried creating
a geronimo-service.xml according to some instructions I found (
http://www.chariotsolutions.com/geronimo/geronimo-1.1/gbeans-modules.html#id2646361)
 but I'm getting the following error:

Deployment Failed
Cannot deploy the requested application module because no deployer is able
to handle it.  This can happen if you have omitted the J2EE deployment
descriptor, disabled a deployer module, or if, for example, you are trying
to deploy an EJB module on a minimal Geronimo server that does not have EJB
support installed.

I used the following geronimo-service.xml and tried installing it directly
(without a JAR) and also packaging it in under META-INF in an empty JAR:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://geronimo.apache.org/xml/ns/j2ee/deployment-1.2">
	<environment>
		<moduleId>
			<groupId>MyApp</groupId>
			<artifactId>ClassPath</artifactId>
			<version>1.0</version>
			<type>jar</type>
		</moduleId>
		<dependencies>
			<dependency>
				<groupId>org.apache.geronimo.configs
				</groupId>
				<artifactId>system-database</artifactId>
				<version>2.1.5</version>
				<type>car</type>
			</dependency>
		</dependencies>
		<non-overridable-classes>
			<filter>
org.apache.derby.jdbc.EmbeddedDataSource</filter>
		</non-overridable-classes>
		<inverse-classloading/>
	</environment>
	<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>
</module>

Am I going about this the right way? I appreciate any guidance you can
provide.


|------------>
| From:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |Ivan <xhhsld@gmail.com>                                                         
                                                       |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |user@geronimo.apache.org                                                              
                                                 |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |09/15/2010 09:16 PM                                                                   
                                                 |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |Re: Unable to classload servlet class using SharedLib GBean                           
                                                 |
  >----------------------------------------------------------------------------------------------------------------------------------------|





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


Mime
View raw message