Hi All and thanks in advance.
I'm new here, and since 3 days I tried to run a damned 3 level architecture web application! I try to describe my app:
core level: Java project, here I have spring 3.1 + Hibernate 3.1 libraries - DAO, session facade, services .java files.
model level: Java project, here I have *.hbm.xml file and the config file of hibernate - DTO(pojo) and VO .java files
web level: Dinamic Web Project, here I have Struts 2.1.8 libraries - action and businnes delegate .java files
Than... Struts 2 + Spring 3.1 without hibernate runs.... Spring 3.1 + Hibernate 3.1 without Struts 2 LIKE an application (with main method) runs... if I try to run everything together I have always a java.lang.classnotfound.exception
in the web.xml I have add:
An example of my DAO class:Code:... <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> ...
the relative spring beans are:Code:public class LoginDAO extends HibernateDaoSupport { public LoginDAO() {} public List<LoginDTO> findAll() { return getHibernateTemplate().find("from user"); } }
Removing this two bean and doing a simple Syso on the service class (the workflow is action->businnesDelegate->SessionFacade->Services) and adding the follow libraries in WebInf/lib, struts2 + Spring 3.1 works fine!! The jars are:Code:<bean id="DAO" class="it.almawave.crm.dao.LoginDAO"> <property name="sessionFactory" ref="SessionFactory"></property> </bean> <bean id="SessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <!-- <prop key="hibernate.show_sql">true</prop> --> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.connection.autocommit">true</prop> </props> </property> <property name="configLocation" value="classpath:hibernate.cfg.xml"></property> </bean>
antlr-2.7.2.jar
antlr-3.0.1.jar
commons-fileupload-1.2.1.jar
commons-logging-1.0.4.jar
commons-logging-api-1.1.jar
freemarker-2.3.15.jar
org.springframework.asm-3.1.0.RELEASE.jar
org.springframework.beans-3.0.0.M3.jar
org.springframework.context-3.0.0.M3.jar
org.springframework.core-3.0.0.M3.jar
org.springframework.expression-3.0.0.M3.jar
org.springframework.transaction-3.1.0.RELEASE.jar
org.springframework.web-3.0.0.M3.jar
struts2-core-2.1.8.jar
struts2-spring-plugin-2.1.8.jar
xwork-core-2.1.6.jar
Re-adding the two beans and running the all project like an application it's read and write on db correctly.
But if I try to run all on the server (Tomcat 6.0) nothing works! I try to add a lot of version of cglib.jar, cglib-nodep, a lot of version of asm, spring-orm, spring-hibernate, but every time appear a different java.lang.classNotFoundException... I'm really going mad.
Please help me.
Thank you all.


Reply With Quote