2
votes

My webapp fails to find org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean class despite having org.springframework.web-3.0.2.RELEASE.jar in the WEB-INF/lib directory. If I add an older version of spring.jar(2.5.6) to the webapp, then the class is found. Any ideas why this may be occurring and how I can fix it without reverting to spring-2.5.6 or keeping both versions of spring in the same webapp?

I am deploying on Tomcat 6.0.28.

Here's the error:

  • Caused by: java.lang.NoClassDefFoundError: org/springframework/remoting/httpinvoker/HttpInvokerProxyFactoryBean

Here are the spring jars in the classpath (WEB-INF/lib):

  • org.springframework.aop-3.0.2.RELEASE.jar
  • org.springframework.asm-3.0.2.RELEASE.jar
  • org.springframework.beans-3.0.2.RELEASE.jar
  • org.springframework.context-3.0.2.RELEASE.jar
  • org.springframework.core-3.0.2.RELEASE.jar
  • org.springframework.expression-3.0.2.RELEASE.jar
  • org.springframework.web-3.0.2.RELEASE.jar
  • org.springframework.web.servlet-3.0.2.RELEASE.jar

Possibly related questions:

1
Is the class present in these jars? - Thorbjørn Ravn Andersen
it is present in org.springframework.web-3.0.2.RELEASE.jar - Thimmayya
Could you post stack trace? NoClassDefFoundError isn't the same as ClassNotFoundException. It means the class definition used inside HttpInvokerProxyFactoryBean cannot be found, not the class itself. - gigadot
You may need aopalliance-1.0.jar - gigadot
Please try to add commons-httpclient.jar as well - danny.lesnik

1 Answers

3
votes

NoClassDefFoundError isn't the same as ClassNotFoundException. It means the class definition used inside HttpInvokerProxyFactoryBean cannot be found, not the class itself.

In other words, all the import classes of HttpInvokerProxyFactoryBean and of its superclasses must be found in your classpath.

Since the HttpInvokerProxyFactoryBean is a subclass of org.springframework.aop.framework.ProxyFactory and ProxyFactory depends on aopalliance-1.0.jar, you will need to include this in your classpath.