Announcement Announcement Module
Collapse
No announcement yet.
Wierd getBean behaviour under tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wierd getBean behaviour under tomcat

    Hi all...

    I'm using spring framework 1.2.8 release version and I encountered a very wierd behaviour when running the code under tomcat.
    (I just wanted to emphesis that I tested the code while not running under tomcat, and it works fine.)

    I am using the XmlBeanFactory getBean function in order to create a non-singleton bean instance.
    However, I'm getting a very wierd exception from Spring framework after the bean instance had been created and the constructor was run.

    After I attached the spring framework code to my project, I noticed the code fails in the constructor of class: CachedIntrospectionResults where this line of code executes: this.beanInfo = Introspector.getBeanInfo(clazz);

    Following is the stack trace:
    -----------------------------
    Thread [http-8080-1] (Suspended (breakpoint at line 87 in CachedIntrospectionResults))
    CachedIntrospectionResults.forClass(Class) line: 87
    BeanWrapperImpl.setIntrospectionClass(Class) line: 237
    BeanWrapperImpl.setWrappedInstance(Object, String, Object) line: 195
    BeanWrapperImpl.setWrappedInstance(Object) line: 179
    BeanWrapperImpl.<init>(Object) line: 132
    XmlBeanFactory(AbstractAutowireCapableBeanFactory) .instantiateBean(String, RootBeanDefinition) line: 487
    XmlBeanFactory(AbstractAutowireCapableBeanFactory) .createBean(String, RootBeanDefinition, Object[]) line: 362
    XmlBeanFactory(AbstractBeanFactory).getBean(String , Class, Object[]) line: 252
    XmlBeanFactory(AbstractBeanFactory).getBean(String ) line: 145
    MainAgentFactory.CreateInstance(String) line: 44
    BusinessServiceFactory.CreateInstance(BusinessServ iceMetadata) line: 46
    BusinessServicePoolFactory.makeObject() line: 36
    GenericObjectPool.borrowObject() line: 771
    EngineImpl.CreateServiceInstance(BusinessServiceDe scription) line: 355
    EngineClient.createBusinessServiceInstance(String) line: 47
    ResourcesManager.createBusinessServiceInstance(Abs tractPortType) line: 106
    POService.createResourceInstance(CreateDocument) line: 50
    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
    NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
    Method.invoke(Object, Object...) line: not available
    ResourceProvider(ResourceHandler).invokeServiceMet hod(Method, WsrfService, XmlObject, Class) line: 534
    ResourceProvider(ResourceHandler).handleRequest(Me ssageContext) line: 174
    ResourceProvider.invoke(MessageContext) line: 209
    InvocationStrategy.visit(Handler, MessageContext) line: 32
    SOAPService(SimpleChain).doVisiting(MessageContext , HandlerIterationStrategy) line: 118
    SOAPService(SimpleChain).invoke(MessageContext) line: 83
    SOAPService.invoke(MessageContext) line: 453
    AxisServer.invoke(MessageContext) line: 281
    AxisServlet.doPost(HttpServletRequest, HttpServletResponse) line: 699
    AxisServlet(HttpServlet).service(HttpServletReques t, HttpServletResponse) line: 709
    AxisServlet(AxisServletBase).service(HttpServletRe quest, HttpServletResponse) line: 327
    AxisServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 802
    ApplicationFilterChain.internalDoFilter(ServletReq uest, ServletResponse) line: 252
    ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 173
    StandardWrapperValve.invoke(Request, Response) line: 213
    StandardContextValve.invoke(Request, Response) line: 178
    StandardHostValve.invoke(Request, Response) line: 126
    ErrorReportValve.invoke(Request, Response) line: 105
    StandardEngineValve.invoke(Request, Response) line: 107
    CoyoteAdapter.service(Request, Response) line: 148
    Http11AprProcessor.process(long) line: 831
    Http11AprProtocol$Http11ConnectionHandler.process( long) line: 639
    AprEndpoint$Worker.run() line: 1196
    ThreadWithAttributes(Thread).run() line: not available


    ------------------------------------------------------
    The exception i'm getting from the java.beans.Introspector is:
    ------------------------------------------------------
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'businessServiceImpl' defined in resource loaded through InputStream: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/runtime/internal/AroundClosure
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:403)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:252)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
    at primagrid.optimus.agent.common.utilities.MainAgent Factory.CreateInstance(MainAgentFactory.java:52)
    ... 35 more
    Caused by: java.lang.NoClassDefFoundError: org/aspectj/runtime/internal/AroundClosure
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at java.beans.Introspector$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.beans.Introspector.getPublicDeclaredMethods(U nknown Source)
    at java.beans.Introspector.getTargetMethodInfo(Unknow n Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at org.springframework.beans.CachedIntrospectionResul ts.<init>(CachedIntrospectionResults.java:150)
    at org.springframework.beans.CachedIntrospectionResul ts.forClass(CachedIntrospectionResults.java:87)
    at org.springframework.beans.BeanWrapperImpl.setIntro spectionClass(BeanWrapperImpl.java:237)
    at org.springframework.beans.BeanWrapperImpl.setWrapp edInstance(BeanWrapperImpl.java:195)
    at org.springframework.beans.BeanWrapperImpl.setWrapp edInstance(BeanWrapperImpl.java:179)
    at org.springframework.beans.BeanWrapperImpl.<init>(B eanWrapperImpl.java:132)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:487)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:362)
    ... 38 more
    -----------------------------------------------------------

    Now, as I said the exception occures after the bean is instanciated (i can see the construction ends when going in step by step). I don't understand how can it be the Introspector fails even though the class instantiation didn't.

    I realy need help on this one...

    Thanks in advance

  • #2
    Do you have the aspectjrt.jar in your classpath? Are there possibly other versions of aspectj-jars in your tomcat classpath?

    Regards,
    Andreas

    Comment


    • #3
      aspectjrt.jar?

      Am i supposed to have aspectjrt.jar in the classpath?
      I currently have aspectj-1.5.0.jar in there...

      Comment


      • #4
        Well, your stacktrace indicates that org.aspectj.runtime.internal.AroundClosure is missing. As I see the class is inside the mentioned jar.

        Regards,
        Andreas

        Comment

        Working...
        X