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

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

    Comment


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

      Comment

      Working...
      X