struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Brown <Stephen.Br...@servador.com>
Subject RE: bean:write problem with struts 1.1
Date Wed, 09 Jul 2003 20:25:00 GMT
This is a problem with the class org.apache.struts.util.RequestUtils which
is currently setup in a way that doesn't work with anything  that loads
classes in a non-Tomcat way.  If you download the source for this class and
re-write the applicationClass method as I have it below, these problems will
disappear.  This is also a problem with the Netbeans-Tomcat plugin.  The
classForName code is courtesy of Hibernate, from what I read.  

The Struts developers know about this problem and fix, but don't like it, I
didn't really get why.

steve

----------------------------------------------------------------------------
------------------------------------
start
----------------------------------------------------------------------------
------------------------------------
    /**
     * Return the <code>Class</code> object for the specified fully
qualified
     * class name, from this web application's class loader.
     *
     * @param className Fully qualified class name to be loaded
     * @return Class object
     * @exception ClassNotFoundException if the class cannot be found
     */
    public static Class applicationClass(String className) throws
ClassNotFoundException {
        return classForName(className);
        // Look up the class loader to be used
        ///ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
        //if (classLoader == null) {
       //     classLoader = RequestUtils.class.getClassLoader();
       // }

        // Attempt to load the specified class
        //return (classLoader.loadClass(className));
//
    }
    
    static Class classForName(String name)
    throws ClassNotFoundException {
        ClassLoader ctxLoader = null;
        try {
            ctxLoader = Thread.currentThread().getContextClassLoader();
            return Class.forName(name, true, ctxLoader);
            
        } catch(ClassNotFoundException ex) {
            if(ctxLoader == null) { throw ex; }
        } catch(SecurityException ex) {
        }
        return Class.forName(name);
    }
----------------------------------------------------------------------------
------------------------------------
end
----------------------------------------------------------------------------
------------------------------------

> -----Original Message-----
> From: Linus Nikander [mailto:linus@nikander.net]
> Sent: July 9, 2003 5:08 AM
> To: struts-user@jakarta.apache.org
> Subject: Re: bean:write problem with struts 1.1
> 
> 
> I'm running Weblogic 6.1 and have experienced exactly the 
> same problem. It
> goes away if you change the returntype of the getter to a 
> String instead of
> whatever you are using. Not a solution to the problem though. 
> I sent in a
> post eariler to this group, but didn't get any replies that solved the
> issue.
> 
> //Linus Nikander - linus@nikander.net
> 
> "Nicolas Seinlet" <nicolas.seinlet@pioneer-software.be> wrote 
> in message
> news:23CD2397B3CB7B4CA228E056185A10F9065B9C@pisces.pioneer-sof
> tware.be...
> > I have the same problem. I solve it by deleting the 
> data-sources section
> and some Action in the struts config file.
> >
> > It's the only way I can solve the problem, but it's not a solution,
> because I need the data-sources and the actions.
> >
> > After reading the net, the problem can also be due to xml 
> parser, so I try
> to change the XML parser, but the problem is still present.
> >
> > So, I'm lost on the way to find to solve the problem.
> >
> > I will try with another Server, like jboss and see...
> >
> > -----Message d'origine-----
> > De : David Jiao [mailto:struts@landranger.com]
> > Envoyé : mardi 8 juillet 2003 17:09
> > À : Struts Users Mailing List
> > Objet : RE: bean:write problem with struts 1.1
> >
> >
> > But I didn't specify any <data-sources> from my 
> struts-config file. Do I
> > have to include it anyway?
> >
> > On Tue, 2003-07-08 at 09:59, Nicolas Seinlet wrote:
> > > >It kept throwing a
> > > message: "org.apache.jasper.JasperException: Cannot find message
> > > resources under key org.apache.struts.action.MESSAGE".
> > >
> > > It seems to be due to the the <data-sources>
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> struts-user-help@jakarta.apache.org
> > >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message