Reputation: 2793
I think i already know what is the problem. i keep getting this error
org.springframework.beans.factory.BeanCreationException:
Could not autowire method: public void proTurism.DAO.AbstractDAO.setSession(org.hibernate.SessionFactory); nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
The problem shoulb be of 2 uncompatible ASM versions one using spring and one hibernate. i have hibernate ASM(unknown version packed in netbeans 7.1) and spring ASM(3.0.6). but i havent found any solution on how to get one asm or anything to get it working in glassfish with netbeans.
my applicationcontext.xml
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="proTurism"/>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
Upvotes: 0
Views: 1000
Reputation: 597234
That's a tough dependency problem. You can only solve it if your two libraries (hibernate and spring) depend either on the same version of ASM, or on non-conflicting versions of ASM in terms of the functionality used. If that is not the case, upgrade/downgrade spring/hibernate until it works.
If using Maven, it will automatically show you which artifact requires which versions of its dependencies and it will be easier to trace and play with. Even if not using maven, you can still check the pom definitions of hibernate and spring to see which versions of asm they work with.
Upvotes: 3