You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Rice Yeh <ri...@gmail.com> on 2007/02/06 09:55:33 UTC
Error creating bean with name 'javax.servlet.http.HttpServletRequest/callstack'
Hi,
Running the latest code from trunk, I get an error as the title described.
The following is the exception stack:
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creati
ng bean with name 'javax.servlet.http.HttpServletRequest/callstack':
Initializat
ion of bean failed; nested exception is
org.springframework.aop.framework.AopCon
figException: Couldn't generate CGLIB subclass of class [interface
javax.servlet
.http.HttpServletRequest]: Common causes of this problem include using a
final c
lass or a non-visible class; nested exception is
net.sf.cglib.core.CodeGeneratio
nException: java.lang.reflect.InvocationTargetException-->null
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:452)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:250)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:141)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:247)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:161)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:270)
at
org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:346)
at
org.springframework.web.context.support.AbstractRefreshableWebApplica
tionContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
at
org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:246)
at
org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:184)
at
org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:49)
at org.apache.cocoon.servlet.ReloadingListener.invoke
(ReloadingListener.
java:148)
... 38 more
Caused by: org.springframework.aop.framework.AopConfigException: Couldn't
genera
te CGLIB subclass of class [interface javax.servlet.http.HttpServletRequest]:
Co
mmon causes of this problem include using a final class or a non-visible
class;
nested exception is net.sf.cglib.core.CodeGenerationException:
java.lang.reflect
.InvocationTargetException-->null
at org.springframework.aop.framework.Cglib2AopProxy.getProxy
(Cglib2AopPr
oxy.java:206)
at org.springframework.aop.framework.Cglib2AopProxy.getProxy
(Cglib2AopPr
oxy.java:145)
at org.springframework.aop.framework.ProxyFactory.getProxy
(ProxyFactory.
java:72)
at
org.springframework.aop.scope.ScopedProxyFactoryBean.setBeanFactory(S
copedProxyFactoryBean.java:103)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1076)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:429)
... 49 more
Caused by: net.sf.cglib.core.CodeGenerationException:
java.lang.reflect.Invocati
onTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create
(AbstractClassGenerato
r.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.springframework.aop.framework.Cglib2AopProxy.getProxy
(Cglib2AopPr
oxy.java:200)
... 54 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
at net.sf.cglib.core.AbstractClassGenerator.create
(AbstractClassGenerato
r.java:219)
... 57 more
Caused by: java.lang.NoClassDefFoundError:
org/springframework/aop/scope/ScopedO
bject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
... 63 more
Rice
Re: Error creating bean with name 'javax.servlet.http.HttpServletRequest/callstack'
Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Ok. In the trunk version of Spring framework, one can also use ordinary
Java (interface based) proxies, so I guess it is better to wait with
this functionality until the next minor version of Spring is released. I
turned it off in our trunk.
In Cocoon we use a call stack for handling some environment data (like
the current sitemap and servlet context, request and response). There is
such a call stack both in Cocoon core and in the servlet service
framework. These call stacks are currently used through calling static
functions - EnvironmentHelper.getCurrentEnvironment() in core and
CallStack.getCurrentFrame() in the servlet service fw. The drawback with
this is that it is much harder to reuse components that depend on static
calls outside Cocoon. It is also harder to follow the code and to do
unit testing.
What I work on now is to create a custom "call scope" for Spring (see
http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes)
that makes it possible to mark beans as having call scope. These beans
are like ordinary beans and can be dependency injected, but internally
they use the current call stack. The scoped proxy make sure that a user
always gets the current value of the bean.
If it works well we could use a the same stack for both th sitemap and
for the servlet services and replace all the static calls in the code
with ordinary dependency injection.
I'll continue to develop the stuff but it seem like we need to wait for
the next Spring release before we can turn it on in Cocoon.
/Daniel
Rice Yeh skrev:
> No. But I think this is a bug in the method setBeanFactory(..) of
> class org.springframework.aop.scope.ScopedProxyFactoryBean in
> springframeowrk 2.0.2. In the last line of this method, it is
> this.proxy = pf.getProxy();
> ,where getProxy() is not passed a classloader. In the latest CVS
> version, the last line of the same method is
> this.proxy
> = pf.getProxy(cbf.getBeanClassLoader());
> , where classloader is passed.
>
> Regards,
> Rice
>
> On 2/6/07, *Daniel Fagerstrom* <danielf@nada.kth.se
> <ma...@nada.kth.se>> wrote:
>
> Any suggestion about what to do about it?
>
> /Daniel
>
> Rice Yeh skrev:
> > I do have cglib-2.1_3.jar in the WEB/lib directory. By tracing the
> > code, I find the classloader used in Enhancer is the classloder of
> > javax.servlet.http.HttpServletRequest, which is an instance of
> > org.codehaus.classworlds.RealmClassLoader . RealmClassLoader
> just include
> > class path used in jetty, not include path in WEB/lib. Hence, an
> > exception java.lang.NoClassDefFoundError:
> org/springframework/aop/scope
> > /ScopedObject is thrown.
> >
> > Rice
> >
> > On 2/6/07, *Daniel Fagerstrom* < danielf@nada.kth.se
> <ma...@nada.kth.se>
> > <mailto:danielf@nada.kth.se <ma...@nada.kth.se>>> wrote:
> >
> > It looks like you are lacking the cglib. It is (since yesterday)
> > part of
> > the dependencies for cocoon-servlet-service-impl. It should be
> > included
> > in your cocoon-webapp dependencies by transitive dependency
> > handling. It
> > works for me. It might be that you need to clean and rebuild
> your
> > cocoon-webapp or something.
> >
> > /Daniel
> >
> > Rice Yeh skrev:
> > > Hi,
> > > Running the latest code from trunk, I get an error as
> the title
> > > described.
> > > The following is the exception stack:
> > >
> > > Caused by:
> org.springframework.beans.factory.BeanCreationException:
> > > Error creati
> > > ng bean with name ' javax.servlet.http.HttpServletRequest
> > /callstack':
> > > Initializat
> > > ion of bean failed; nested exception is
> > > org.springframework.aop.framework.AopCon
> > > figException: Couldn't generate CGLIB subclass of class
> [interface
> > > javax.servlet
> > > .http.HttpServletRequest]: Common causes of this problem
> include
> > using
> > > a final c
> > > lass or a non-visible class; nested exception is
> > > net.sf.cglib.core.CodeGeneratio
> > > nException: java.lang.reflect.InvocationTargetException--
> >null
> > >
> > ...
> >
> >
>
>
Re: Error creating bean with name 'javax.servlet.http.HttpServletRequest/callstack'
Posted by Rice Yeh <ri...@gmail.com>.
No. But I think this is a bug in the method setBeanFactory(..) of class
org.springframework.aop.scope.ScopedProxyFactoryBean in springframeowrk
2.0.2. In the last line of this method, it is
this.proxy = pf.getProxy();
,where getProxy() is not passed a classloader. In the latest CVS version,
the last line of the same method is
this.proxy = pf.getProxy(cbf.getBeanClassLoader());
, where classloader is passed.
Regards,
Rice
On 2/6/07, Daniel Fagerstrom <da...@nada.kth.se> wrote:
>
> Any suggestion about what to do about it?
>
> /Daniel
>
> Rice Yeh skrev:
> > I do have cglib-2.1_3.jar in the WEB/lib directory. By tracing the
> > code, I find the classloader used in Enhancer is the classloder of
> > javax.servlet.http.HttpServletRequest, which is an instance of
> > org.codehaus.classworlds.RealmClassLoader . RealmClassLoader just
> include
> > class path used in jetty, not include path in WEB/lib. Hence, an
> > exception java.lang.NoClassDefFoundError: org/springframework/aop/scope
> > /ScopedObject is thrown.
> >
> > Rice
> >
> > On 2/6/07, *Daniel Fagerstrom* <danielf@nada.kth.se
> > <ma...@nada.kth.se>> wrote:
> >
> > It looks like you are lacking the cglib. It is (since yesterday)
> > part of
> > the dependencies for cocoon-servlet-service-impl. It should be
> > included
> > in your cocoon-webapp dependencies by transitive dependency
> > handling. It
> > works for me. It might be that you need to clean and rebuild your
> > cocoon-webapp or something.
> >
> > /Daniel
> >
> > Rice Yeh skrev:
> > > Hi,
> > > Running the latest code from trunk, I get an error as the title
> > > described.
> > > The following is the exception stack:
> > >
> > > Caused by: org.springframework.beans.factory.BeanCreationException
> :
> > > Error creati
> > > ng bean with name ' javax.servlet.http.HttpServletRequest
> > /callstack':
> > > Initializat
> > > ion of bean failed; nested exception is
> > > org.springframework.aop.framework.AopCon
> > > figException: Couldn't generate CGLIB subclass of class [interface
> > > javax.servlet
> > > .http.HttpServletRequest]: Common causes of this problem include
> > using
> > > a final c
> > > lass or a non-visible class; nested exception is
> > > net.sf.cglib.core.CodeGeneratio
> > > nException: java.lang.reflect.InvocationTargetException-- >null
> > >
> > ...
> >
> >
>
>
Re: Error creating bean with name 'javax.servlet.http.HttpServletRequest/callstack'
Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Any suggestion about what to do about it?
/Daniel
Rice Yeh skrev:
> I do have cglib-2.1_3.jar in the WEB/lib directory. By tracing the
> code, I find the classloader used in Enhancer is the classloder of
> javax.servlet.http.HttpServletRequest, which is an instance of
> org.codehaus.classworlds.RealmClassLoader . RealmClassLoader just include
> class path used in jetty, not include path in WEB/lib. Hence, an
> exception java.lang.NoClassDefFoundError: org/springframework/aop/scope
> /ScopedObject is thrown.
>
> Rice
>
> On 2/6/07, *Daniel Fagerstrom* <danielf@nada.kth.se
> <ma...@nada.kth.se>> wrote:
>
> It looks like you are lacking the cglib. It is (since yesterday)
> part of
> the dependencies for cocoon-servlet-service-impl. It should be
> included
> in your cocoon-webapp dependencies by transitive dependency
> handling. It
> works for me. It might be that you need to clean and rebuild your
> cocoon-webapp or something.
>
> /Daniel
>
> Rice Yeh skrev:
> > Hi,
> > Running the latest code from trunk, I get an error as the title
> > described.
> > The following is the exception stack:
> >
> > Caused by: org.springframework.beans.factory.BeanCreationException:
> > Error creati
> > ng bean with name ' javax.servlet.http.HttpServletRequest
> /callstack':
> > Initializat
> > ion of bean failed; nested exception is
> > org.springframework.aop.framework.AopCon
> > figException: Couldn't generate CGLIB subclass of class [interface
> > javax.servlet
> > .http.HttpServletRequest]: Common causes of this problem include
> using
> > a final c
> > lass or a non-visible class; nested exception is
> > net.sf.cglib.core.CodeGeneratio
> > nException: java.lang.reflect.InvocationTargetException-- >null
> >
> ...
>
>
Re: Error creating bean with name 'javax.servlet.http.HttpServletRequest/callstack'
Posted by Rice Yeh <ri...@gmail.com>.
I do have cglib-2.1_3.jar in the WEB/lib directory. By tracing the code, I
find the classloader used in Enhancer is the classloder of
javax.servlet.http.HttpServletRequest, which is an instance of
org.codehaus.classworlds.RealmClassLoader. RealmClassLoader just include
class path used in jetty, not include path in WEB/lib. Hence, an exception
java.lang.NoClassDefFoundError: org/springframework/aop/scope/ScopedObject
is thrown.
Rice
On 2/6/07, Daniel Fagerstrom <da...@nada.kth.se> wrote:
>
> It looks like you are lacking the cglib. It is (since yesterday) part of
> the dependencies for cocoon-servlet-service-impl. It should be included
> in your cocoon-webapp dependencies by transitive dependency handling. It
> works for me. It might be that you need to clean and rebuild your
> cocoon-webapp or something.
>
> /Daniel
>
> Rice Yeh skrev:
> > Hi,
> > Running the latest code from trunk, I get an error as the title
> > described.
> > The following is the exception stack:
> >
> > Caused by: org.springframework.beans.factory.BeanCreationException:
> > Error creati
> > ng bean with name ' javax.servlet.http.HttpServletRequest/callstack':
> > Initializat
> > ion of bean failed; nested exception is
> > org.springframework.aop.framework.AopCon
> > figException: Couldn't generate CGLIB subclass of class [interface
> > javax.servlet
> > .http.HttpServletRequest]: Common causes of this problem include using
> > a final c
> > lass or a non-visible class; nested exception is
> > net.sf.cglib.core.CodeGeneratio
> > nException: java.lang.reflect.InvocationTargetException-- >null
> >
> ...
>
Re: Error creating bean with name 'javax.servlet.http.HttpServletRequest/callstack'
Posted by Daniel Fagerstrom <da...@nada.kth.se>.
It looks like you are lacking the cglib. It is (since yesterday) part of
the dependencies for cocoon-servlet-service-impl. It should be included
in your cocoon-webapp dependencies by transitive dependency handling. It
works for me. It might be that you need to clean and rebuild your
cocoon-webapp or something.
/Daniel
Rice Yeh skrev:
> Hi,
> Running the latest code from trunk, I get an error as the title
> described.
> The following is the exception stack:
>
> Caused by: org.springframework.beans.factory.BeanCreationException:
> Error creati
> ng bean with name ' javax.servlet.http.HttpServletRequest/callstack':
> Initializat
> ion of bean failed; nested exception is
> org.springframework.aop.framework.AopCon
> figException: Couldn't generate CGLIB subclass of class [interface
> javax.servlet
> .http.HttpServletRequest]: Common causes of this problem include using
> a final c
> lass or a non-visible class; nested exception is
> net.sf.cglib.core.CodeGeneratio
> nException: java.lang.reflect.InvocationTargetException-- >null
>
...