Results 1 to 7 of 7

Thread: Where is DispatcherServlet class ?

  1. #1
    Join Date
    Mar 2010
    Posts
    10

    Default Where is DispatcherServlet class ?

    Hi everybody.
    I built a browsable operator interface by means of the following:
    on server side, Hibernate 3 to access an Oracle database, and BlazeDS to remote some objects (developed with JDK 1.6);
    on client side, a single SWF file developed by Flex 3.2.
    The client talks to remote objects, which in turn call Hibernate beans.

    I put the application (which consists of a single WAR) under Spring 2.5.6.SEC01 control.

    The web and app server is Tomcat 6.

    The operating system is Windows, both XP and 7, professional.

    I declare DispatcherServlet in web.xml:
    Code:
    <servlet>
       <servlet-name>flex</servlet-name>
       <servlet-class>org.springframework.web.servlet.DispatcherServlet
       </servlet-class>
       <load-on-startup>1</load-on-startup>
    </servlet>
    My application needs the following JAR list:
    backport-util-concurrent,
    commons-collections,
    commons-dbcp,
    commons-logging,
    commons-pool,
    dom4j-1.6.1,
    flex-messaging-common,
    flex-messaging-core,
    flex-messaging-opt,
    hibernate-annotations,
    hibernate-commons-annotations,
    hibernate3,
    javassist-3.4.GA,
    jta,
    ojdbc6,
    org.springframework.flex-1.0.2.RELEASE,
    persistence,
    slf4j-api-1.5.0,
    slf4j-simple-1.5.0,
    spring-beans,
    spring-context,
    spring-core,
    spring-jdbc,
    spring-orm,
    spring-tx,
    spring-web

    Beside these JARs, there are only Tomcat/lib JARs (catalina.jar etc) and JRE 1.6 runtime.

    Now, DispatcherServlet class belongs to spring-webmvc jar.
    But I don't include it !
    I've thoroughly controlled classpath application: there are no clues about spring-webmvc inclusion !

    Nonetheless, my application works fine.
    My question is: HOW can it be ?

    William

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    I suggest checking your FULL classpath (also tomcat lib etc) I suspect either a spring-webmvc.jar OR a spring.jar somewhere.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Mar 2010
    Posts
    10

    Default Classpath

    Marten, I understand it sounds preposterous.

    Tomcat/lib hosts only the following JARs:
    annotations-api, catalina, catalina-ant, catalina-ha, catalina-tribes,
    el-api, jasper, jasper-el, jasper-jdt, jsp-api, servlet-api,
    tomcat-coyote, tomcat-dbcp, tomcat-i18n-es, tomcat-dbcp, tomcat-i18n-fr,
    tomcat-dbcp, tomcat-i18n-ja.

    None of them contains the DispatcherServlet class.

    I don't include spring.jar; by the way, spring.jar doesn't contain DispatcherServlet (I've opened it with UltimateZip).

    You said it could be classpath...
    but I haven't set any particular classpath.
    Just a question (I apologize for my ignorance): how can I know the classpath of my application ?
    I developed it with Eclipse Galileo, using a Dynamic Web project.
    Isn't the classpath visible into "Java Build Path" view, tab Libraries ?
    If so, I only see Tomcat JARs, JRE runtime JARs, and my explicitly included JARs.

    If you can suggest a better way to access classpath, I'd really appreciate it, 'cause I'm not able to.

    Thanks in advance
    William

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    The fact that it isn't on the build classpath doesn't mean it isn't on the runtime classpath.

    Spring.jar does contain the DispatcherServlet it just depends on the version, prior to 2.5 it is included after that it isn't.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Mar 2010
    Posts
    10

    Default runtime classpath

    I'm using Spring 2.5.6 and I've inspected spring.jar: it doesn't contain any DispatcherServlet class. Moreover, I don't include spring.jar.
    But you gave me a good clue: to check my app's runtime classpath.
    So, I've add this code into my app:
    Code:
    System.out.println("classpath=" + System.getProperty("java.class.path"));
    it's executed when the app has reached its stable condition at runtime.

    Here the result:
    C:\Programmi\Apache Software Foundation\Tomcat 6.0\bin\bootstrap.jar

    no more than that.

    Perhaps my method to evaluate runtime classpath is wrong.
    If so, please tell me the correct way

    William

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Sigh..

    1) Read... Spring < 2.5 DispatcherServlet is in spring.jar >= 2.5 no DispatcherServlet in spring.jar

    Your runtime classpath is made up out of.

    - java classpath
    - server classpath
    - container classpath
    - web app classpath

    all those are combined into the runtime classpath.

    I suggest a simple search for spring-webmvc.jar and/or spring.jar (or search in archives for DispatcherServlet) and you will find the cullprit.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  7. #7
    Join Date
    Mar 2010
    Posts
    10

    Default Problem solved !

    Marten, I'm sorry I wasted your time (and mine) but the solution stayed into Tomcat log files, all time !
    Unfornately I didn't have any access to those log files, so I couldn't inspect them, even if I wanted to.

    At last our administrator granted me full rights, so I saw an error as great as a house into localhost.log file:
    ClassNotFound: DispatcherServlet.

    My application had been working all time, yes, but not under full Spring control, I guess.

    Then I included spring-webmvc and the error disappeared (I had to include jackson-core-asl-1.0.0, spring-aop and some other JARs too, to avoid other ClassNotFound errors).

    Well, at least I've found really useful your explanation about runtime classpath, very exhaustive.
    Thank you a lot
    William
    Last edited by Williamarc; May 19th, 2010 at 04:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •