Reputation: 21
In my build.xml, I set the attribute scr.dir
:
<property name="src.dir" value="${backend.dir}/java-src/catw/src"/>
My dispatcher-servlet.xml:
<bean name="/welcome.htm" class="com.bamboo.catW3.business.impl.WelcomeController"/>
My view WEB-INF/jsp:
welcome.jsp
My controller:
com.bamboo.catW3.business.impl.WelcomeController.java
I run the project and show me this message:
org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [com.bamboo.catW3.business.impl.WelcomeController] for bean
with name '/welcome.htm' defined in ServletContext resource
[/WEB-INF/branch_try_htmlModulo-servlet.xml]; nested exception is
java.lang.ClassNotFoundException: com.bamboo.catW3.business.impl.WelcomeController
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1076)
I don't know how to fix this error, can anyone help me please?
Upvotes: 1
Views: 2909
Reputation: 21
May be many of u r getting problem with springhelloworld project.I have recently faced that problem as from eclipse when i am running it,it's working fine..but from browser it is showing error like class not found exception.So,I have found solution for that...it is a problem of class file....
Solution:
Just put your classes folder from build/classes to your WEB-INF directory...and your problem will be solved...
I hope this will help you...
Upvotes: 0
Reputation: 8502
In your build, your output directory is not pointing to the correct location (as specified by the destdir
attribute. A ClassNotFoundException
means that the application looks for the compiled WelcomeController, but cannot find it. Usually web application expects compiled class files to be under:
/WEB-INF/classes
So make sure that you build output points to this directory. After a successful build, you should see:
/WEB-INF/classes/com/bamboo/catW3/business/impl/WelcomeController.class
Upvotes: 1
Reputation: 1009
Double check that the destdir attribute of your tag (or tag) in your ant build script is set to the correct class directory for your application server (ie: Tomcat). You could also just look for the class file in your build directory.
Upvotes: 0