Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with the SpringHibernateDMI sample project

    I'm attempting to evaluate SmartGWT EE, but I'm having problems with the SpringHibernateDMI sample project.

    I'm running the nightly build from 4-4-11 on a new Eclipse Helios EE installation with GWT 2.2. I've followed the instructions to import the sample project into an Eclipse project.

    Without making any modifications, I have been attempting to run the project as a Web Application, but keep getting this message:

    Code:
    javax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'supplyItemDaoTarget' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'hibernateSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateSessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    	at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:437)
    	at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616)
    	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
    	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    	at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:461)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    	at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    	at org.mortbay.jetty.Server.doStart(Server.java:222)
    	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    	at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:565)
    	at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:494)
    	at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1058)
    	at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:800)
    	at com.google.gwt.dev.DevMode.main(DevMode.java:304)
    ...
    Basically, it's telling me that it can't find a class definition for the org.slf4j.LoggerFactory class. I've checked the project build path to make sure that the slf4j-api-1.5.6.jar file is on it and I've checked this jar file to make sure that it contains the org.slf4j.LoggerFactory.

    I'm at a loss as to why this is happening and it's putting me in a difficult spot. I'd be extremely grateful if someone could explain what I'm doing incorrectly that is having this fail right out of the gate.

    Thanks for your time,
    Steve Erdman

    #2
    Java is notoriously bad at reporting true causes for class loading issues. Probably, the LoggerFactory class is not actually missing, but just one of it's dependencies. Use the shotgun approach of copying every single .jar provided in the SDK into your build path and verify this fixes the problem (you may want to restart the IDE or re-import the project to clear out any bad state). Once you've verified this is working, then you can trim off unneeded .jars.

    Comment


      #3
      Thanks for your response.

      I removed all of the imports from the SGWTEE_HOME and then directly went to my installation lib directory (in this case c:/smartgwtee-2.5/lib) and added every jar in it to my build path. I'm still getting the same error.

      I appear to be able to compile without an error, but I can't run it from Eclipse using the Run As -> Web Application command to get it onto the hosted browser.

      I'm wondering if this may be some bug in the GWT SDK 2.2, but I can't find anything on this behavior, plus I would have expected it to come up to you guys very frequently were that the case. But I'm downloading and installing GWT SDK 2.1 to see if that works.

      ---

      edit: No change. I still get the same error.
      Last edited by MrSquicky; 4 Apr 2011, 10:00.

      Comment


        #4
        The problem is related to how GWT development mode loads classes. You basically need to add a jetty-web.xml file to your WEB-INF to promote slf4j to Jetty system classes. This should fix all your org/slf4j/LoggerFactory problems without having to dump all the libs into your WEB-INF/lib folder.

        See:

        https://groups.google.com/group/google-web-toolkit/msg/74f8cf4628f84eda?hl=kyJf8cf4628f84eda

        http://code.google.com/p/google-web-toolkit/issues/detail?id=3496

        Comment

        Working...
        X