Announcement Announcement Module
No announcement yet.
Spring + Hibernate + Zk : java.lang.ClassNotFoundException: org.springframework.conte Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

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


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

    but when i create an event to call my bean :

    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
    >>java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
    >>java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
    >>	at org.apache.catalina.loader.WebappClassLoader.loadClass(
    >>	at org.apache.catalina.loader.WebappClassLoader.loadClass(
    >>	at com.projet.uicontroller.RegPersController.onEvent(
    >>	at org.zkoss.zk.ui.impl.EventProcessor.process0(
    >>	at org.zkoss.zk.ui.impl.EventProcessor.process(
    >>	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(

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

  • #2
    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....


    • #3
      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, 06:18 AM. Reason: RESOLVED