Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException : org springframework web servlet DispatcherServlet

 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have included most of the jar files during build. Any one in particular which I have missed out?

Rgds,

Seetesh
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are all those spaces ?
You didn't write "org springframework web servlet DispatcherServlet" did you ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ddi you also add spring-webmvc.jar ? The DispatcherSerlvet is in there.
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have included spring.jar in the build.

Rgds,

seetesh
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant post a thread with 30 characters continued and thats why I had to break up these words.

Yes I have included all jar files including spring-webmvc.

I believe this class is in Srping.jar too

Rgds,

Seetesh
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using a web application, right ? Did you put the jars into WEB-INF/libs ?
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes all these jar files are in the lib folder
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the part where you are using the DispatcherServlet ? Maybe you've got an extra space somewhere or something
And post the complete error dump too.
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No where in the SpringappController.java is DispatcherServlet used.

springapp-servlet.xml has
<beans>
<bean id="springappController" class="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>

Stack Trace
===========

15:31:53,546 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable to a "org.apache.log4j.spi.ErrorHandler" variable.
15:31:53,546 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by
15:31:53,546 ERROR [STDERR] log4j:ERROR [WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
java.net.FactoryURLClassLoader@1c3e3fb
] whereas object of type
15:31:53,546 ERROR [STDERR] log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@1833955].


Rgds,

Seetesh
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show me your web.xml and the directory structure of your application.
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I reconfigured the path settings of log4j.xml and now there are no ERROR's displayed.

I use Jboss 4.0.4 GA App Server and the war file created is put in the deploy folder.

web.xml
=======

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
<web-app>
<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp
</welcome-file>
</welcome-file-list>

</web-app>

Structure is as follows

AProjSpring
===========
build.xml
build.properties
src
SpringappController.java
war
index.jsp
WEB-INF
index.jsp
springapp-servlet.xml
web.xml
classes
log4j.properties
SpringappController.class
lib
commons-logging.jar
spring.jar
log4j-1.2.13.jar
etc all other jar files

Not able to run the index.jsp page. 404 Error.

Rgds,

Seetesh
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AProjSpring
===========
build.xml
build.properties
----src
-------SpringappController.java
----war
-------index.jsp
----WEB-INF
-------index.jsp
-------springapp-servlet.xml
-------web.xml
-------classes
-----------log4j.properties
-----------SpringappController.class
-------lib
-----------commons-logging.jar
-----------spring.jar
-----------log4j-1.2.13.jar
-----------etc all other jar files
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Its working now.
Slight change in springapp-servlet.xml and now it works.

Thks,

Seetesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic