geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevan Miller (JIRA)" <...@geronimo.apache.org>
Subject [jira] Reopened: (GERONIMO-1064) WebConnector portlet results in CodeGenerationException when G is configured for tomcat
Date Tue, 22 Nov 2005 15:10:42 GMT
     [ http://issues.apache.org/jira/browse/GERONIMO-1064?page=all ]
     
Kevan Miller reopened GERONIMO-1064:
------------------------------------

     Assign To: Dain Sundstrom  (was: Aaron Mulder)

I can make the changes if you guys want.

-dain
- Hide quoted text -

On Nov 17, 2005, at 12:55 PM, Kevan Miller wrote:

> Dain,
> This is regarding a fix for http://issues.apache.org/jira/browse/
> GERONIMO-1064
>
> The problem, which Aaron diagnosed, is that CGLIB will use the
> ClassLoader of the first class/interface that we pass it (unless we
> explicitly set the ClassLoader). If one of the subsequent
> interfaces is not loadable using this ClassLoader, the enhancer
> will fail.
>
> Aaron's fix addressed this problem by searching for a ClassLoader
> which could load all of the classes.
>
> I don't have much experience with BasicProxyManager, but your
> proposal seems much cleaner than either Aaron's or my fix for the
> problem and I think it addresses shortcomings in the current
> interface...
>
> --kevan
>
> On 11/17/05, Dain Sundstrom <dain@iq80.com> wrote: I'm confused why
> we are trying guess the parent most class loader....
>
> When we are creating a proxy to a service, our goal is to create a
> class that the caller can interact with.  This mean that no matter
> what interfaces we would like the proxy to implement, all of those
> interfaces must be loaded from the caller's class loader.  Since the
> caller knows its own class loader, why not require the the caller
> pass in its class loader?
>
> I think we should always use this form of createProxy:
>
>      public Object createProxy(ObjectName target, ClassLoader loader);
>
> or a new form like this, which would grab the thread context
> classloader
>
>      public Object createProxy(ObjectName target);
>
> and we deprecate the others.  This version is much cleaner because it
> load all interface class directly from the specified class loader
> which eliminates the possibility of having a class from the wrong
> class loader.
>
> The other problem with BasicProxyManager is the method
> createProxyFactory does not accept a target class loader.  This
> should be a mandatory argument to the method.
>
> -dain
>
> On Nov 16, 2005, at 8:54 AM, Aaron Mulder wrote:
>
> > On 11/16/05, Kevan Miller <kevan.miller@gmail.com> wrote:
> >> Aaron,
> >>  Nice work getting to the bottom of this issue. However, I'm not
> >> sure that
> >> I'm happy with your fix. I'm confident that your fix will find a
> >> ClassLoaders which can load all of the classes/interfaces.
> >> However, there
> >> can be multiple of these and there's no guarantee that you're
> >> finding the
> >> most appropriate ClassLoader. For example imagine an application
> >> classloader
> >> with inverseClassLoading set to true. You're technique might find
> >> a parent
> >> ClassLoader, when the desired ClassLoader is the application
> >> classloader.
> >
> > For my part, I don't really care which class loader is "ideal" so
> long
> > as we try to get one that can load all the classes.  I'm not too
> > concerned that parent and child may be using different
> definitions of
> > the same class such that a different "master" CL might result in
> using
> > a different definition.  We're only talking about GBean interfaces
> > here, and I think unlikely to have different versions in use by
> > different CLs (at present).  Can you think of a specific use case in
> > Geronimo where we might run into a problem?  I know David J is
> working
> > on fully versioned configurations, which might make a difference.
> >
> >>  I have an alternate fix which calculates a child ClassLoader from
> >> the
> >> potential list of ClassLoaders (my fix assumes that there is one
> >> ClassLoader
> >> to which all other ClassLoaders are ancestors). I've tested
> >> against Joe's
> >> test case. It too fixes the problem...
> >>
> >>  As I'm typing this, I'm wondering if we have an even larger
> >> problem. Is
> >> there a guarantee that the list of ClassLoaders available to the
> >> BasicProxyManager constructor contains a single ClassLoader which
> >> is capable
> >> of loading <all> of the given classes? Seems pretty easy to
> >> construct a
> >> scenario in which this is not true. I'd be interested in hearing
> >> what you or
> >> others might think...
> >
> > Right, there's no guarantee this will solve all possible problems.
> > Right now it just falls through if it can't identify a "master"
> CL.  I
> > suppose we could create a new multi-parent CL on the spot if we
> needed
> > to.
> >
> > Aaron
> >
> >>  A problematic scenario would look like this:
> >>
> >>         System ClassLoader
> >>              /      |     \
> >>             A     B     C
> >>               \     |     /
> >>            My ClassLoader
> >>
> >>  Assume that ClassLoader A is the loader for class a, etc. If the
> >> classes a,
> >> b, and c are passed to the BasicProxyManager constructor, it will
> >> not be
> >> able to determine a ClassLoader capable of loading a, b, <and> c.
> >> Is this an
> >> invalid use case? Neither of our fixes will work in this case...
> >>
> >>  --kevan
> >>
> >>
> >> On 11/15/05, ammulder@apache.org <ammulder@apache.org> wrote:
> >>> Author: ammulder
> >>> Date: Tue Nov 15 18:32:31 2005
> >>> New Revision: 344848
> >>>
> >>> URL: http://svn.apache.org/viewcvs?rev=344848&view=rev
> >>> Log:
> >>> Pick the best ClassLoader for the provided set of interfaces
> >>>   (Fixes GERONIMO-1064)
> >>>
> >>> Modified:
> >>>
> >> geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
> >> basic/BasicProxyManager.java
> >>>
> >>> Modified:
> >> geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
> >> basic/BasicProxyManager.java
> >>> URL:
> >> http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/
> >> java/org/apache/geronimo/kernel/basic/BasicProxyManager.java?
> >> rev=344848&r1=344847&r2=344848&view=diff
> >>>
> >>
> =====================================================================
> >> =========
> >>> ---
> >> geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
> >> basic/BasicProxyManager.java
> >> (original)
> >>> +++
> >> geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
> >> basic/BasicProxyManager.java
> >> Tue Nov 15 18:32:31 2005
> >>> @@ -207,6 +207,24 @@
> >>>              } else if(type.length == 1) { // Unlikely (as a
> >>> result of
> >> GeronimoManagedBean)
> >>>                  enhancer.setSuperclass(type[0]);
> >>>              } else {
> >>> +                ClassLoader best = null;
> >>> +                outer:
> >>> +                for (int i = 0; i < type.length; i++) {
> >>> +                    ClassLoader test =
> >> type[i].getClassLoader();
> >>> +                    for (int j = 0; j < type.length; j++) {
> >>> +                        String className = type[j].getName();
> >>> +                        try {
> >>> +                            test.loadClass(className);
> >>> +                        } catch (ClassNotFoundException e) {
> >>> +                            continue outer;
> >>> +                        }
> >>> +                    }
> >>> +                    best = test;
> >>> +                    break;
> >>> +                }
> >>> +                if(best != null) {
> >>> +                    enhancer.setClassLoader(best);
> >>> +                }
> >>>                  if(type[0].isInterface()) {
> >>>                      enhancer.setSuperclass(Object.class);
> >>>                      enhancer.setInterfaces(type);
> >>>
> >>>
> >>>
> >>
> >>
>
>

> WebConnector portlet results in CodeGenerationException when G is configured for tomcat
> ---------------------------------------------------------------------------------------
>
>          Key: GERONIMO-1064
>          URL: http://issues.apache.org/jira/browse/GERONIMO-1064
>      Project: Geronimo
>         Type: Bug
>   Components: console, management
>     Versions: 1.0-M5
>  Environment: all
>     Reporter: Joe Bohn
>     Assignee: Dain Sundstrom
>      Fix For: 1.0
>  Attachments: TomcatHttpsConnector.patch
>
> To recreate this problem simply choose the configuration for tomcat only and then, from
the web console select the Web Server function.  This is supposed to list all of the connections
but instead fails with this exception.
> 09:21:09,300 ERROR [KernelManagementHelper] Unable to look up related GBean
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetExc
> eption-->null
>         at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerato
> r.java:236)
>         at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
>         at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
>         at org.apache.geronimo.kernel.basic.BasicProxyManager$ManagedProxyFactor
> y.<init>(BasicProxyManager.java:223)
>         at org.apache.geronimo.kernel.basic.BasicProxyManager.createProxyFactory
> (BasicProxyManager.java:93)
>         at org.apache.geronimo.kernel.basic.BasicProxyManager.createProxy(BasicP
> roxyManager.java:120)
>         at org.apache.geronimo.kernel.basic.BasicProxyManager.createProxies(Basi
> cProxyManager.java:157)
>         at org.apache.geronimo.console.util.KernelManagementHelper.getWebConnect
> ors(KernelManagementHelper.java:339)
>         at org.apache.geronimo.console.util.PortletManager.getWebConnectors(Port
> letManager.java:150)
>         at org.apache.geronimo.console.webmanager.ConnectorPortlet.doList(Connec
> torPortlet.java:375)
>         at org.apache.geronimo.console.webmanager.ConnectorPortlet.doView(Connec
> torPortlet.java:360)
>         at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:247)
>         at javax.portlet.GenericPortlet.render(GenericPortlet.java:175)
>         at org.apache.pluto.core.PortletServlet.dispatch(PortletServlet.java:218
> )
>         at org.apache.pluto.core.PortletServlet.doGet(PortletServlet.java:158)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.pluto.core.PortletServlet.service(PortletServlet.java:153)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:173)
>         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
> atcher.java:672)
>         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
> ispatcher.java:574)
>         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
> patcher.java:499)
>         at org.apache.pluto.invoker.impl.PortletInvokerImpl.invoke(PortletInvoke
> rImpl.java:120)
>         at org.apache.pluto.invoker.impl.PortletInvokerImpl.render(PortletInvoke
> rImpl.java:73)
>         at org.apache.pluto.PortletContainerImpl.renderPortlet(PortletContainerI
> mpl.java:119)
>         at org.apache.pluto.portalImpl.core.PortletContainerWrapperImpl.renderPo
> rtlet(PortletContainerWrapperImpl.java:70)
>         at org.apache.pluto.portalImpl.aggregation.PortletFragment.service(Portl
> etFragment.java:168)
>         at org.apache.jsp.WEB_002dINF.aggregation.ColumnFragment_jsp._jspService
> (org.apache.jsp.WEB_002dINF.aggregation.ColumnFragment_jsp:65)
>         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
> .java:322)
>         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
> 91)
>         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:173)
>         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
> atcher.java:672)
>         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
> ispatcher.java:574)
>         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
> patcher.java:499)
>         at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(Abst
> ractFragment.java:112)
>         at org.apache.jsp.WEB_002dINF.aggregation.RowFragment_jsp._jspService(or
> g.apache.jsp.WEB_002dINF.aggregation.RowFragment_jsp:64)
>         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
> .java:322)
>         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
> 91)
>         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:173)
>         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
> atcher.java:672)
>         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
> ispatcher.java:574)
>         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
> patcher.java:499)
>         at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(Abst
> ractFragment.java:112)
>         at org.apache.jsp.WEB_002dINF.aggregation.PageFragment_jsp._jspService(o
> rg.apache.jsp.WEB_002dINF.aggregation.PageFragment_jsp:67)
>         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
> .java:322)
>         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
> 91)
>         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:173)
>         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
> atcher.java:672)
>         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
> ispatcher.java:574)
>         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
> patcher.java:499)
>         at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(Abst
> ractFragment.java:112)
>         at org.apache.jsp.WEB_002dINF.aggregation.PageFragment_jsp._jspService(o
> rg.apache.jsp.WEB_002dINF.aggregation.PageFragment_jsp:67)
>         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
> .java:322)
>         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
> 91)
>         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:173)
>         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
> atcher.java:672)
>         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
> ispatcher.java:574)
>         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
> patcher.java:499)
>         at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(Abst
> ractFragment.java:112)
>         at org.apache.jsp.WEB_002dINF.aggregation.RootFragment_jsp._jspService(o
> rg.apache.jsp.WEB_002dINF.aggregation.RootFragment_jsp:170)
>         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
> .java:322)
>         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
> 91)
>         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:173)
>         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
> atcher.java:672)
>         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
> ispatcher.java:574)
>         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
> patcher.java:499)
>         at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(Abst
> ractFragment.java:112)
>         at org.apache.pluto.portalImpl.Servlet.doGet(Servlet.java:254)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:173)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> alve.java:213)
>         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> alve.java:178)
>         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
> torBase.java:482)
>         at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSu
> bjectValve.java:46)
>         at org.apache.geronimo.tomcat.valve.PolicyContextValve.invoke(PolicyCont
> extValve.java:50)
>         at org.apache.geronimo.tomcat.valve.TransactionContextValve.invoke(Trans
> actionContextValve.java:53)
>         at org.apache.geronimo.tomcat.valve.ComponentContextValve.invoke(Compone
> ntContextValve.java:47)
>         at org.apache.geronimo.tomcat.valve.InstanceContextValve.invoke(Instance
> ContextValve.java:60)
>         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> ava:126)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> ava:105)
>         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> ve.java:107)
>         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
> 526)
>         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> a:148)
>         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> :856)
>         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> ssConnection(Http11Protocol.java:744)
>         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
> int.java:527)
>         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
> lowerWorkerThread.java:80)
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
> ool.java:684)
>         at java.lang.Thread.run(Thread.java:534)
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
>         at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerato
> r.java:218)
>         ... 116 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/geronimo/tomcat/TomcatWebC
> onnector
>         at java.lang.ClassLoader.defineClass0(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
>         ... 121 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message