facebook

Spring 2.5 with Hibernate 3.2 – can’t start web app

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #290312 Reply

    davout
    Participant

    I’m trying to build a simple prototype using MyEclipse 6.5 that employs ZK, Spring 2.5 and Hibernate 3.2

    When I launch the web app I get the following error…

    
    27-Oct-2008 15:54:25 org.apache.catalina.core.AprLifecycleListener init
    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\MyEclipse 6.0\bin;C:\Users\Ian\AppData\Local\MyEclipse 6.5\eclipse\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_6.5.0.zmyeclipse650200806\tomcat\bin
    27-Oct-2008 15:54:25 org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    27-Oct-2008 15:54:25 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 451 ms
    27-Oct-2008 15:54:25 org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    27-Oct-2008 15:54:25 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.13
    log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
    log4j:WARN Please initialize the log4j system properly.
    27-Oct-2008 15:54:28 org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    27-Oct-2008 15:54:31 org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
    

    The web.xml file is as follows…

    
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="skap" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <display-name>skap</display-name>
    
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /WEB-INF/classes/applicationContext.xml
            </param-value>
        </context-param>
        <listener>
            <listener-class>
                org.springframework.web.context.ContextLoaderListener
            </listener-class>
        </listener>
    
        <listener>
            <description>
                Used to cleanup when a session is destroyed
            </description>
            <display-name>ZK Session Cleaner</display-name>
            <listener-class>
                org.zkoss.zk.ui.http.HttpSessionListener
            </listener-class>
        </listener>
    
        <servlet>
            <description>The servlet loads the DSP pages.</description>
            <servlet-name>dspLoader</servlet-name>
            <servlet-class>
                org.zkoss.web.servlet.dsp.InterpreterServlet
            </servlet-class>
        </servlet>
        <servlet>
            <description>ZK loader for ZUML pages</description>
            <servlet-name>zkLoader</servlet-name>
            <servlet-class>
                org.zkoss.zk.ui.http.DHtmlLayoutServlet
            </servlet-class>
            <init-param>
                <param-name>update-uri</param-name>
                <param-value>/zkau</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet>
            <description>The asynchronous update engine for ZK</description>
            <servlet-name>auEngine</servlet-name>
            <servlet-class>
                org.zkoss.zk.au.http.DHtmlUpdateServlet
            </servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>dspLoader</servlet-name>
            <url-pattern>*.dsp</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>zkLoader</servlet-name>
            <url-pattern>*.zul</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>zkLoader</servlet-name>
            <url-pattern>*.zhtml</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>auEngine</servlet-name>
            <url-pattern>/zkau/*</url-pattern>
        </servlet-mapping>
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>default.html</welcome-file>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>default.jsp</welcome-file>
            <welcome-file>index.zul</welcome-file>
        </welcome-file-list>
    
    
    </web-app>
    

    The applicationContext.xml is as follows…

    
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
    
        <bean id="mySQLData"
            class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName"
                value="com.mysql.jdbc.Driver">
            </property>
            <property name="url"
                value="jdbc:mysql://localhost:3306/skap">
            </property>
            <property name="username" value="root"></property>
            <property name="password" value="root"></property>
        </bean>
    
        <bean id="hibernateSessionFactory"
            class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="dataSource">
                <ref bean="mySQLData" />
            </property>
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">
                        org.hibernate.dialect.MySQLDialect
                    </prop>
                </props>
            </property>
            <property name="mappingResources">
                <list>
                    <value>com/eis/user/SkapUser.hbm.xml</value></list>
            </property></bean>
    
        <bean id="HibernateDAOSupport" abstract="true"
            class="org.springframework.orm.hibernate3.support.HibernateDaoSupport">
            <property name="sessionFactory" ref="hibernateSessionFactory" />
        </bean>
        
        <bean id="UserManagerDAO" class="com.eis.user.UserManagerDAOImpl" parent="HibernateDAOSupport"/>
        
        <bean id="UserManager" name="UserManager" class="com.eis.user.UserManagerImpl">
            <property name="DAO">
                <ref bean="UserManagerDAO" />
            </property>
        </bean>
        
        
    </beans>
    

    Any ideas???

    #290316

    Riyad Kalla
    Member

    davout,

    Sorry for the inconvenience. The problem is that Hibernate 3.2 ships with the ASM 1.5 libs and Spring 2.5 ships with the 2.3 versions of the ASM libs, it’s a library conflict.

    I *believe* if you go to Window > Prefs > MyEclipse > Project Capabilities, and drill down to the Hibernate 3.2 library container that contains ASM that is in your project’s build path (I think it’s the AOP container), if you just remove it from there then remove your deployed and redeploy your project, Hibernate will then use the Spring ASM 2.3 library instead and work.

    If that doesn’t work, try it the other way around.

    #290321

    davout
    Participant

    Thanks….

    The solution is to remove the asm jar file from the ‘Spring 2.5 AOP’ bundle

    It now works!

    #290346

    Loyal Water
    Member

    Thank you for posting the solution.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Spring 2.5 with Hibernate 3.2 – can’t start web app

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in