[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-user
Subject:    Re: [groovy-user] Experiments with Spring+Groovy - groovy wrapping wrong class?
From:       Hunter Kelly <retnuh () eircom ! net>
Date:       2004-08-16 17:21:30
Message-ID: 200408161821.30537.retnuh () eircom ! net
[Download RAW message or body]

If you could give me a few pointers about where to start, I'll take a look and 
see if this is something I could sort out, if (big if :( ) I get the time...

H

On Monday 16 August 2004 16:52, jastrachan@mac.com wrote:
> FWIW the quick workaround for this is to disable the reflectors & use
> reflection instead...
>
> groovy.lang.MetaClass.setUseReflection(true)
>
> before you invoke any Groovy operations.
>
> I think the real fix is probably gonna be to ensure the reflectors
> invoke methods through the interface on which the methods are defined,
> rather than on the class (since the class might not be visible)
>
> On 16 Aug 2004, at 13:10, Hunter Kelly wrote:
> > Hiya I've set up a small app with the groovy stuff from the Spring
> > sandbox in
> > it, to see how feasible it is to use Groovy in a Spring application.
> >
> > I set up the following script:
> >
> > import java.util.*;
> > import java.util.regex.*;
> >
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> >
> > import org.springframework.web.servlet.ModelAndView;
> > import org.springframework.web.servlet.mvc.AbstractController;
> >
> > class PostController extends AbstractController
> > {
> >
> >     public ModelAndView handleRequestInternal(HttpServletRequest
> > request,
> > HttpServletResponse response)
> >     {
> >     	response.sendError(401, "need authorization");
> >     	return null;
> >     }
> > }
> >
> >
> > Unfortunately, this blew up specatacularly with the following:
> >
> > java.lang.NoClassDefFoundError:
> > org/apache/catalina/connector/HttpResponseFacade
> >         at
> > gjdk.org.apache.catalina.connector.HttpResponseFacade_GroovyReflector.i
> > nvoke(HttpResponseFacade_GroovyReflector.java)
> >         at groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
> >         at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1372)
> >         at groovy.lang.MetaClass.invokeMethod(MetaClass.java:316)
> >         at
> > org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:143)
> >         at
> > org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.ja
> > va:106)
> >         at
> > com.newbay.atom.AtomPostController.handleRequestInternal(script10926561
> > 40214.groovy:17)
> >         at
> > org.springframework.web.servlet.mvc.AbstractController.handleRequest(Ab
> > stractController.java:121)
> >         at
> > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.hand
> > le(SimpleControllerHandlerAdapter.java:45)
> >         at
> > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherS
> > ervlet.java:496)
> >         at
> > org.springframework.web.servlet.FrameworkServlet.service(FrameworkServl
> > et.java:322)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
> > ationFilterChain.java:247)
> >         at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
> > terChain.java:193)
> >         at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
> > ve.java:256)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> > 480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >         at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal
> > ve.java:191)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve
> > .java:221)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:641)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> > 480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >         at
> > org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
> > 2415)
> >         at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav
> > a:180)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherV
> > alve.java:171)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:641)
> >         at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav
> > a:172)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:641)
> >         at
> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
> > 509)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:641)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> > 480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >         at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
> > .java:174)
> >         at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
> > invokeNext(StandardPipeline.java:643)
> >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> > 480)
> >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> >         at
> > org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.
> > java:1040)
> >         at
> > org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java
> >
> > :1151)
> >
> >         at java.lang.Thread.run(Thread.java:534)
> >
> >
> >
> >
> >
> >
> > My guess is that groovy is trying to create some form of wrapper for
> > org.apache.catalina.connector.HttpResponseFacade (the object's actual
> > class)
> > as opposed to
> > javax.servlet.http.HttpServletResponse (the declared class/interface).
> >
> > Unsurprisingly, the catalina classes aren't accessible from the webapp
> > classloaders...  Is there some way to get Groovy to try and wrap
> > HttpServletRequest instead of HttpServletResponse?
> >
> > H
>
> James
> -------
> http://radio.weblogs.com/0112098/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic