Results 1 to 3 of 3

Thread: NoSuchMethodError

  1. #1
    Join Date
    Oct 2007
    Posts
    2

    Default 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. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    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.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #3
    Join Date
    Oct 2007
    Posts
    2

    Default

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

    NoMethodFoundError -> Classpath Trouble

    Thanks.

    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •