Spring Framework and class not found error

Hi , i have written a small application using Spring framework, i am getting the following error while parsing the springapp-servlet.xml,

<Apr 7, 2006 3:26:02 PM IST> <Error> <HTTP> <BEA-101216> <Servlet: "springapp" f
ailed to preload on startup in Web application: "springapp".
javax.servlet.ServletException: Error registering bean with name 'springappContr
oller' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Bean
 class [com.SpringappController] not found; nested exception is java.lang.ClassN
otFoundException: com.SpringappController


-------------------------------------------------------------------------------------------------------------------------------------------
springapp-servlet.xml :-

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><!--  - Application context definition for "springapp" DispatcherServlet.  -->
<beans>
      <bean id="springappController" class="com.SpringappController" />
      <bean id="urlMapping"
            class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                  <props>
                        <prop key="/hello.htm">springappController</prop>
                  </props>
            </property>
      </bean>
</beans>
-------------------------------------------------------------------------------------------------------------------------------------------

this is the controller code,

package com;
import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SpringappController implements Controller
{
      /** Logger for this class and subclasses */
      protected final Log logger = LogFactory.getLog(getClass());

      public ModelAndView handleRequest(HttpServletRequest request,
                  HttpServletResponse response) throws ServletException, IOException
      {
            logger.info("SpringappController - returning hello view");

            return new ModelAndView("hello.jsp");
      }
}


i have placed com package in the classes folder and springapp-servlet.xml in the WEB-INF folder.

I need urgent help.

LVL 3
javaoptimizerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
looks ok, there should be a file

WEB-INF/classes/com/SpringappController.class

are all the spring and other required jars in WEB-INF/lib
javaoptimizerAuthor Commented:
yes , the path is right, i have placed spring.jar and also the logging jars in the WEB-INF/lib folder.
any other jar related to spring is needed.
Mick BarryJava DeveloperCommented:
yes, you can download the dependencise here:
http://sourceforge.net/project/showfiles.php?group_id=73357&package_id=73406&release_id=396613

check your logs, there may well be more details or earlier statup errors there.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

javaoptimizerAuthor Commented:
Hi there are a lot of jars in the dependency , related to many other technologies, but currently what i am developing is an simple Spring application consisting of JSP , HTML and java classess and with logging.

My log file :-

2006-04-07 12:05:25,901 INFO [org.springframework.web.servlet.DispatcherServlet] - Initializing servlet 'springapp'
2006-04-07 12:05:26,118 INFO [org.springframework.core.CollectionFactory] - JDK 1.4+ collections available
2006-04-07 12:05:26,134 INFO [org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'springapp': initialization started
2006-04-07 12:05:26,382 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from ServletContext resource [/WEB-INF/springapp-servlet.xml]
2006-04-07 12:05:26,584 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'springappController' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Bean class [SpringappController] not found; nested exception is java.lang.ClassNotFoundException: SpringappController
java.lang.ClassNotFoundException: SpringappController
      at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Ljava.lang.Class;(Unknown Source)
      at org.springframework.util.ClassUtils.forName(Ljava.lang.String;Ljava.lang.ClassLoader;)Ljava.lang.Class;(ClassUtils.java:109)
      at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(Ljava.lang.String;Ljava.lang.String;Lorg.springframework.beans.factory.config.ConstructorArgumentValues;Lorg.springframework.beans.MutablePropertyValues;Ljava.lang.ClassLoader;)Lorg.springframework.beans.factory.support.AbstractBeanDefinition;(BeanDefinitionReaderUtils.java:65)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(Lorg.w3c.dom.Element;Ljava.lang.String;)Lorg.springframework.beans.factory.config.BeanDefinition;(DefaultXmlBeanDefinitionParser.java:466)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(Lorg.w3c.dom.Element;Z)Lorg.springframework.beans.factory.config.BeanDefinitionHolder;(DefaultXmlBeanDefinitionParser.java:432)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitions(Lorg.w3c.dom.Element;)I(DefaultXmlBeanDefinitionParser.java:347)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.registerBeanDefinitions(Lorg.springframework.beans.factory.support.BeanDefinitionReader;Lorg.w3c.dom.Document;Lorg.springframework.core.io.Resource;)I(DefaultXmlBeanDefinitionParser.java:197)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(Lorg.w3c.dom.Document;Lorg.springframework.core.io.Resource;)I(XmlBeanDefinitionReader.java:295)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(Lorg.xml.sax.InputSource;Lorg.springframework.core.io.Resource;)I(XmlBeanDefinitionReader.java:223)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(Lorg.springframework.core.io.support.EncodedResource;)I(XmlBeanDefinitionReader.java:173)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(Lorg.springframework.core.io.Resource;)I(XmlBeanDefinitionReader.java:148)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions([Lorg.springframework.core.io.Resource;)I(AbstractBeanDefinitionReader.java:128)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(Ljava.lang.String;)I(AbstractBeanDefinitionReader.java:144)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(Lorg.springframework.beans.factory.xml.XmlBeanDefinitionReader;)V(XmlWebApplicationContext.java:126)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(Lorg.springframework.beans.factory.support.DefaultListableBeanFactory;)V(XmlWebApplicationContext.java:94)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory()V(AbstractRefreshableApplicationContext.java:89)
      at org.springframework.context.support.AbstractApplicationContext.refresh()V(AbstractApplicationContext.java:262)
      at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh()V(AbstractRefreshableWebApplicationContext.java:139)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(Lorg.springframework.web.context.WebApplicationContext;)Lorg.springframework.web.context.WebApplicationContext;(FrameworkServlet.java:306)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext()Lorg.springframework.web.context.WebApplicationContext;(FrameworkServlet.java:251)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean()V(FrameworkServlet.java:220)
      at org.springframework.web.servlet.HttpServletBean.init()V(HttpServletBean.java:112)
      at javax.servlet.GenericServlet.init(Ljavax.servlet.ServletConfig;)V(GenericServlet.java:258)
      at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run()Ljava.lang.Object;(ServletStubImpl.java:1028)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:121)
      at weblogic.servlet.internal.ServletStubImpl.createServlet()Ljavax.servlet.Servlet;(ServletStubImpl.java:904)
      at weblogic.servlet.internal.ServletStubImpl.createInstances()V(ServletStubImpl.java:883)
      at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Lweblogic.servlet.internal.RequestCallback;)V(ServletStubImpl.java:822)
      at weblogic.servlet.internal.WebAppServletContext.preloadServlet(Ljava.lang.String;)V(WebAppServletContext.java:3333)
      at weblogic.servlet.internal.WebAppServletContext.preloadServlets()V(WebAppServletContext.java:3278)
      at weblogic.servlet.internal.WebAppServletContext.preloadResources()V(WebAppServletContext.java:3259)
Mick BarryJava DeveloperCommented:
> java.lang.ClassNotFoundException: SpringappController

that suggests u haven't specified the packge. check your config and restart container
javaoptimizerAuthor Commented:
sorry, i tried without a package, hence the log i posted was a previous one, the one given below is the right one,

2006-04-07 16:18:40,527 INFO [org.springframework.web.servlet.DispatcherServlet] - Initializing servlet 'springapp'
2006-04-07 16:18:40,605 INFO [org.springframework.core.CollectionFactory] - JDK 1.4+ collections available
2006-04-07 16:18:40,620 INFO [org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'springapp': initialization started
2006-04-07 16:18:40,714 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from ServletContext resource [/WEB-INF/springapp-servlet.xml]
2006-04-07 16:18:40,776 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'springappController' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Bean class [com.SpringappController] not found; nested exception is java.lang.ClassNotFoundException: com.SpringappController
java.lang.ClassNotFoundException: com.SpringappController
      at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Ljava.lang.Class;(Unknown Source)
      at org.springframework.util.ClassUtils.forName(Ljava.lang.String;Ljava.lang.ClassLoader;)Ljava.lang.Class;(ClassUtils.java:109)
      at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(Ljava.lang.String;Ljava.lang.String;Lorg.springframework.beans.factory.config.ConstructorArgumentValues;Lorg.springframework.beans.MutablePropertyValues;Ljava.lang.ClassLoader;)Lorg.springframework.beans.factory.support.AbstractBeanDefinition;(BeanDefinitionReaderUtils.java:65)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(Lorg.w3c.dom.Element;Ljava.lang.String;)Lorg.springframework.beans.factory.config.BeanDefinition;(DefaultXmlBeanDefinitionParser.java:466)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(Lorg.w3c.dom.Element;Z)Lorg.springframework.beans.factory.config.BeanDefinitionHolder;(DefaultXmlBeanDefinitionParser.java:432)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitions(Lorg.w3c.dom.Element;)I(DefaultXmlBeanDefinitionParser.java:347)
      at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.registerBeanDefinitions(Lorg.springframework.beans.factory.support.BeanDefinitionReader;Lorg.w3c.dom.Document;Lorg.springframework.core.io.Resource;)I(DefaultXmlBeanDefinitionParser.java:197)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(Lorg.w3c.dom.Document;Lorg.springframework.core.io.Resource;)I(XmlBeanDefinitionReader.java:295)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(Lorg.xml.sax.InputSource;Lorg.springframework.core.io.Resource;)I(XmlBeanDefinitionReader.java:223)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(Lorg.springframework.core.io.support.EncodedResource;)I(XmlBeanDefinitionReader.java:173)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(Lorg.springframework.core.io.Resource;)I(XmlBeanDefinitionReader.java:148)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions([Lorg.springframework.core.io.Resource;)I(AbstractBeanDefinitionReader.java:128)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(Ljava.lang.String;)I(AbstractBeanDefinitionReader.java:144)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(Lorg.springframework.beans.factory.xml.XmlBeanDefinitionReader;)V(XmlWebApplicationContext.java:126)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(Lorg.springframework.beans.factory.support.DefaultListableBeanFactory;)V(XmlWebApplicationContext.java:94)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory()V(AbstractRefreshableApplicationContext.java:89)
      at org.springframework.context.support.AbstractApplicationContext.refresh()V(AbstractApplicationContext.java:262)
      at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh()V(AbstractRefreshableWebApplicationContext.java:139)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(Lorg.springframework.web.context.WebApplicationContext;)Lorg.springframework.web.context.WebApplicationContext;(FrameworkServlet.java:306)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext()Lorg.springframework.web.context.WebApplicationContext;(FrameworkServlet.java:251)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean()V(FrameworkServlet.java:220)
      at org.springframework.web.servlet.HttpServletBean.init()V(HttpServletBean.java:112)
      at javax.servlet.GenericServlet.init(Ljavax.servlet.ServletConfig;)V(GenericServlet.java:258)
      at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run()Ljava.lang.Object;(ServletStubImpl.java:1028)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:121)
      at weblogic.servlet.internal.ServletStubImpl.createServlet()Ljavax.servlet.Servlet;(ServletStubImpl.java:904)
      at weblogic.servlet.internal.ServletStubImpl.createInstances()V(ServletStubImpl.java:883)
      at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Lweblogic.servlet.internal.RequestCallback;)V(ServletStubImpl.java:822)
      at weblogic.servlet.internal.WebAppServletContext.preloadServlet(Ljava.lang.String;)V(WebAppServletContext.java:3333)
      at weblogic.servlet.internal.WebAppServletContext.preloadServlets()V(WebAppServletContext.java:3278)
      at weblogic.servlet.internal.WebAppServletContext.preloadResources()V(WebAppServletContext.java:3259)
Mick BarryJava DeveloperCommented:
not sure what the problem is, from what you've said everything is where it should be.
javaoptimizerAuthor Commented:
Hi objects,

i deployed the same war in the tomcat server, its working fine, i dont know what went wrong in weblogic.

Spring is supported in Weblogic 8.1 or not.

I need to know the problem, since the app server to be used is web logic.
Mick BarryJava DeveloperCommented:
it is supported by wl, no idea whats going on there

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fargoCommented:
javaoptimizerAuthor Commented:
Hi, i tried on my colleagues machine, i deployed the same war file on weblogic , its working fine.
I think there is some configuration problem in my system. Thanks a lot for all your contribution.
Mick BarryJava DeveloperCommented:
no worries :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.