https://bz.apache.org/bugzilla/show_bug.cgi?id=61930

            Bug ID: 61930
           Summary: Classloader seems went wrong
           Product: Tomcat 9
           Version: 9.0.2
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: boreas...@gmail.com
  Target Milestone: -----

When I migrated my app from tomcat 7 to 9, I got stuck in a very strange
NoSuchMethodException since no code and dependencies had been changed.

After debugging, the exception can be reproduced like this:


// class in spring-context-support-4.3.10.RELEASE, no proxy or reflection
org.springframework.cache.ehcache.EhCacheManagerFactoryBean bean = new
EhCacheManagerFactoryBean();

// true aboviously
System.out.println(bean instanceof EhCacheManagerFactoryBean);

// true because EhCacheManagerFactoryBean implements FactoryBean
System.out.println(bean instance of FactoryBean);

// return null, expectedly
((FactoryBean) bean).getObject();

// Exception happend: java.lang.NoSuchMethodError:
org.springframework.cache.ehcache.EhCacheManagerFactoryBean.getObject()Lnet/sf/ehcache/CacheManager;
bean.getObject();
</code>

In this example, I cannot invoke method of class instance, but can invoke after
meaningless casting. So I guess there may be something wrong with ClassLoader.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to