geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul McMahan" <paulmcma...@gmail.com>
Subject Re: NoClassDefFoundError deployment errors
Date Fri, 17 Mar 2006 21:41:04 GMT
There's an example of using the hidden-classes element here:
http://opensource3.atlassian.com/confluence/oss/display/GERONIMO/Spring#Spring-dCountries

Here's the relevant portion of the sample
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.0"
                configId="org/springframework/samples/countries">
  <!-- force the usage of the Spring jars deployed with the web application -->
    <hidden-classes>
      <filter>org.springframework</filter>
    </hidden-classes>
    <context-root>/countries</context-root>
    <context-priority-classloader>false</context-priority-classloader>
</web-app>


Best wishes,
Paul

On 3/17/06, Richard Wallace <rwallace@thewallacepack.net> wrote:
> David Jencks wrote:
> >
> > On Mar 17, 2006, at 9:23 AM, Richard Wallace wrote:
> >
> >> Greetings all,
> >>
> >> I'm new to Geronimo.  I'm trying to deploy one of my web applications
> >> that had previously just been deployed in a standalone tomcat
> >> container in Geronimo 1.0.  I've tried this with both the version
> >> with Jetty and with Tomcat bundled.  The web app uses a
> >> Hibernate/Spring/JSF framework stack.  The jars for each project are
> >> bundled in the war file in the WEB-INF/lib directory.
> >> But when I deploy the application I'm getting NoClassDefFoundErrors
> >> for javax/faces/el/VariableResolver and
> >> org/hibernate/HibernateException.
> >>
> >> Any ideas what I'm missing here?
> >
> > My first guess is that a copy of spring included in geronimo is
> > getting used in your web app instead of the copy you are trying to
> > use: when our copy tries to load the faces/hibernate classes it can't
> > find them.  If this is the problem you should be able to fix it by
> > adding spring and hibernate to the hidden classes list in your
> > geronimo plan for your application.
> >
> > I think the xml syntax would be (consult
> > modules/service-builder/src/schema/geronimo-config-1.0.xsd, this is
> > also somewhere in the distribution such as schema/....)
> >
> > <hidden-classes>
> >    <filter>javax.faces.el.</filter>
> > </hidden-classes>
> > <hidden-classes>
> >    <filter>org.hibernate.</filter>
> > </hidden-classes>
> >
> > I regard the need for multiple hidden-classes elements as a bug in the
> > schema, and it is fixed in 1.1 (which doesn't work right now) (but not
> > yet in 1.2, it will be fixed there when we merge in 1.1)
> >
> Ok, while trying that I saw the context-priority-classloader element
> which should load stuff from the web app classloader before any of the
> parent classloaders.  I set this to true and tried to deploy.  I don't
> get any messages about javax.faces or org.hibernate now, but I am
> getting this now:
>
> org.apache.commons.logging.LogConfigurationException: Invalid class
> loader hierarchy.  You have more than one version of
> 'org.apache.commons.logging.Log' visible, which is not allowed.
>
>
> So, I tried to hide the parent classloaders org.apache.commons.logging with
>
> <hidden-classes><filter>org.apache.commons.logging</filter></hidden-classes>
>
> But now Geronimo says there's a problem with my deployment descriptor:
>
>     Error: Unable to distribute mpl.war: xml problem
>
>         Invalid deployment descriptor: [error: cvc-complex-type.2.4a:
>     Expected elements
>     'host@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0
>     cross-context@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0
>     valve-chain@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0
>     tomcat-realm@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0
>     manager@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0
>     cluster@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0
>     gbean-ref@http://geronimo.apache.org/xml/ns/naming-1.0
>     ejb-ref@http://geronimo.apache.org/xml/ns/naming-1.0
>     ejb-local-ref@http://geronimo.apache.org/xml/ns/naming-1.0
>     service-ref@http://geronimo.apache.org/xml/ns/naming-1.0
>     resource-ref@http://geronimo.apache.org/xml/ns/naming-1.0
>     resource-env-ref@http://geronimo.apache.org/xml/ns/naming-1.0
>     message-destination@http://geronimo.apache.org/xml/ns/naming-1.0
>
> security-realm-name@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0
>     gbean@http://geronimo.apache.org/xml/ns/deployment-1.0' instead of
>     'hidden-classes@http://geronimo.apache.org/xml/ns/deployment-1.0'
>     here]
>
>     Descriptor: <xml-fragment configId="MPLCommon"
>     xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.0"
>     xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.0"
>     xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1"
>     xmlns:tom="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.0">
>
>       <tom:context-root>/mpl</tom:context-root>
>
>
>
> <tom:context-priority-classloader>true</tom:context-priority-classloader>
>
>       <sys:hidden-classes>
>
>         <sys:filter>org.apache.commons.logging</sys:filter>
>
>       </sys:hidden-classes>
>
>     </xml-fragment>
>
>  From what I can tell, according to the docs and the schema this should
> be alright.  So what am I missing now?
>
> Thanks,
> Rich
>

Mime
View raw message