Announcement Announcement Module
Collapse
No announcement yet.
NoSuchMethodError Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoSuchMethodError

    Hi,

    I've written some very simple AOP code to test springs AOP support. However, I can't get the program to start. I'm using 2.0.6 and the error I'm getting is

    ====================
    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'helloService' defined in class path resource [spring-config.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.isPresent(Ljav a/lang/String;Ljava/lang/ClassLoaderZ
    Caused by: java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.isPresent(Ljav a/lang/String;Ljava/lang/ClassLoaderZ
    at org.springframework.aop.framework.DefaultAopProxyF actory.<clinit>(DefaultAopProxyFactory.java:50)
    ====================

    The application context is configured as follows

    ====================
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd">

    <aop:aspectj-autoproxy />

    <bean id="helloService" class="micke.test.HelloServiceImpl" />
    <bean id="AspectHello" class="micke.test.AspectHello" />

    </beans>
    ====================

    And main( String[] args ) is

    ====================
    ApplicationContext context = new ClassPathXmlApplicationContext( "spring-config.xml" );

    HelloService service = (HelloService) context.getBean( "helloService" );
    service.mike();
    ====================

    I ran into this the same "NoSuchMethodError" trying to configure Spring's transaction manager yesterday. It's still unresolved. This is probably a lib version error or something so I'm guessing that others have been having this problem as well but I can't find much about it on the net.

    Thanks.

    Mike

  • #2
    Any chance you've got duplicate JARs or different versions on the classpath? I'd make sure you've only got the one most upto date one and try it again.

    Comment


    • #3
      I finally managed to find a second spring.jar file that got automatically included to the classpath.

      NoMethodFoundError -> Classpath Trouble

      Thanks.

      Mike

      Comment


      • #4
        Originally posted by mikelitton View Post
        I finally managed to find a second spring.jar file that got automatically included to the classpath.

        NoMethodFoundError -> Classpath Trouble

        Thanks.

        Mike
        I had the same exception, resolved it by using a more recent spring version. Thanks for the hint.

        Comment

        Working...
        X