Results 1 to 3 of 3

Thread: Spring + Hibernate + Zk : java.lang.ClassNotFoundException: org.springframework.conte

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unhappy Spring + Hibernate + Zk : java.lang.ClassNotFoundException: org.springframework.conte

    Hello,

    I'm trying to do a web app using : Spring 2.5/Hibernate 3.0 (hbm.xml... and .cgf.xml) / and Zk (http://www.zkoss.org
    framework.

    but when i create an event to call my bean :

    Code:
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("AppContext.xml");
    BusinessLayer business = (BusinessLayer) ctx.getBean("business");
    I have this exception.
    I have spring.jar, spring-context.jar,...and alle spring 2.5.6 jars referenced in my buildpath
    Code:
    >>java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
    >>java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
    >>	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    >>	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    >>	at com.projet.uicontroller.RegPersController.onEvent(RegPersController.java:43)
    >>	at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:197)
    >>	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:141)
    >>	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:519)
    >>...

    i didn't found a solution to my problème

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

    Default

    The fact that they are on your BUILD path doesn't automatically mean that they are also on your RUNTIME path!...

    i suggest something like maven, ant/ivy or gradle to manage your dependencies and build your app...

    Next to that you shouldn't create an applicationcontext to retrieve a bean!!! Well unless you want to end up with a poorly performing app, running out of resources, memory issues etc. etc....
    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
    Nov 2010
    Posts
    2

    Talking

    You were right

    I configured the dependecies from : "Properties/ Java JEE Module Dependencies"
    and checked the librairies.

    i had an other problem the "Appcontext.xml" and "hibernate.cfg.xml" were in a wrong directory.... !


    I use this to call the bean :

    BusinessLayer business = (BusinessLayer ) springutil.getBean("business ");

    now it works

    thank you very much
    Last edited by abdelmonaem; Dec 2nd, 2010 at 05:18 AM. Reason: RESOLVED

Tags for this Thread

Posting Permissions

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