-1

I'm trying to create scratch level project with spring mvc and hibernate. in that situation i downloaded all jar related to spring and hibernate. While running my project i'm getting below error.

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

But as my knowledge DipatcherServlet class will available in spring-webmvc.jar, i added this jar also. Please see the below code and Help me

web.xml


 <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        id="WebApp_ID" version="2.5">
        <display-name>Spring Hello World</display-name>
        <welcome-file-list>
            <welcome-file>/</welcome-file>
        </welcome-file-list>

        <servlet>
            <servlet-name>springDispatcher</servlet-name>
            <servlet-class>
                org.springframework.web.servlet.DispatcherServlet
            </servlet-class>
          <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/config/spring-context.xml</param-value>
            </init-param>        
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>springDispatcher</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>

        <context-param>
            <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
            <param-value>true</param-value>
        </context-param>
    </web-app>

spring-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:property-placeholder location="classpath:resources/database.properties" />
    <context:component-scan base-package="user.controller" />
    <mvc:annotation-driven />

    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/view/" />
        <property name="suffix" value=".jsp" />
    </bean>

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${database.driver}" />
        <property name="url" value="${database.url}" />
        <property name="username" value="${database.user}" />
        <property name="password" value="${database.password}" />
    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="annotatedClasses">
            <list>
                <value>user.model.Employee</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>             
            </props>
        </property>
    </bean>

    <bean id="hibernateTransactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

</beans>

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.myproject</groupId>
    <artifactId>addaroot</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>addaroot Maven Webapp</name>
    <url>http://maven.apache.org</url>

    <!-- <build>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build> -->

    <!-- <properties>
        <org.slf4j.version>1.6.4</org.slf4j.version>
        <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
    </properties> -->

    <properties>
        <spring.version>3.1.2.RELEASE</spring.version>
    </properties>


    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>javax.servlet.jsp.jstl</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>
        <!-- <dependency>
            <groupId>spring</groupId>
            <artifactId>spring</artifactId>
            <version>${spring.version}</version>
        </dependency> -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${spring.version}</version>
        </dependency> 
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-asm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <!-- <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.web.servlet</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency> -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
        </dependency>

        <!-- Hibernate dependencies. -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate</artifactId>
            <version>3.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.4.0.GA</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.6.8.Final</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.6</version>
        </dependency>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
          <id>maven2-repository.dev.java.net</id>
          <name>Java.net Repository for Maven</name>
          <url>http://download.java.net/maven/2/</url>
          <layout>default</layout>
        </repository>
        <!-- <repository>
            <id>maven-restlet</id>
            <name>Public online Restlet repository</name>
            <url>http://maven.restlet.org</url>
        </repository> -->
    </repositories>
    <build>
        <finalName>addaroot</finalName>
    </build> 
</project>

console

SEVERE: Servlet /addaroot threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:663)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1642)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

Feb 21, 2014 10:46:03 AM org.apache.catalina.startup.HostConfig deployDescriptor
Peshal
  • 1,508
  • 1
  • 12
  • 22
Srikanth
  • 163
  • 2
  • 3
  • 19
  • please check your WEB-INF/lib folder, whether it actually exists or not – Santosh Joshi Feb 21 '14 at 05:33
  • Where have you added the jar? – Rohit Feb 21 '14 at 05:33
  • Why is this dependency commented out? - org.springframework.web.servlet – Crickcoder Feb 21 '14 at 05:34
  • check DipatcherServlet is available on classpath by pressing ctrl+shift+t – Abhishek Nayak Feb 21 '14 at 05:36
  • And also check jars file are conflict in your classpath – 9ine Feb 21 '14 at 05:45
  • @Rembo I checked with ctrl+shift+t, DispatcherServlet is available – Srikanth Feb 21 '14 at 05:48
  • To ALL: Actually i'm adding jars with pom.xml file, but i dont know where that jars will store and i checked in "java build path" in that maven Dependencies contains all jars what ever i added in pom file. – Srikanth Feb 21 '14 at 05:50
  • Did you check the location santosh joshi mentioned in his comment? additional how do you create the war file? – Rohit Feb 21 '14 at 06:23
  • @SantoshJoshi Atcually i'm using maven, so maven storing jars in target folder. So in WEB-INF i did't added lib folder. Even if i add lib folder then also that jars are not coming into that lib. And war file creating automatically in target folder – Srikanth Feb 21 '14 at 06:27
  • @Srikanth, I was talking of the generated WEB/INF lib folder inside the target folder/directory – Santosh Joshi Feb 21 '14 at 06:28
  • How do you create the war file? – Rohit Feb 21 '14 at 06:29
  • @SantoshJoshi Yes that lib folder have all jars what even i added in pom file – Srikanth Feb 21 '14 at 06:30
  • @Rohit when i was converting my normal project to maven with configure option, i given generate the war file option. So I think by running my project automatically war file generating. – Srikanth Feb 21 '14 at 06:34
  • @Srikanth, If you are running your aap as an Internal Web module from eclipse , then probably your changes are not being published. Please check the folder where your changes are being deployed – Santosh Joshi Feb 21 '14 at 06:34
  • What option do you use o run the project? – Rohit Feb 21 '14 at 06:43
  • @SantoshJoshi I'm not getting you. As i understand i cleaned maven and did maven install, what ever i changed that changes are there in target folder also. But still same problem. – Srikanth Feb 21 '14 at 06:49
  • @Srikanth I guess you are using Eclipse WTP plugin ,so check for `http://blog.vogella.com/2009/04/08/eclipse-wtp-deployment-location-of-the-local-tomcat/` and `http://stackoverflow.com/questions/3515089/where-is-the-deployment-directory-in-eclipse` for the tomcat deployment directory as it is not using the target folder generated inside the eclipse but the folders mentioned by above posts – Santosh Joshi Feb 21 '14 at 07:19

9 Answers9

2

Can you modify your pom and spring-context.xml with these, I am sure it will help you

 <?xml  version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
    http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
     http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">



<context:annotation-config />
<context:component-scan base-package="your base package" />


    <bean id="Check" class="yourbase.check.ModelClassfile">
</bean>

<bean id="jspViewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/jsp/" />
    <property name="suffix" value=".jsp" />
</bean>

<bean id="propertyConfigurer"
                                                                                         class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
    p:location="/WEB-INF/jdbc.properties" />

  <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
    p:driverClassName="${jdbc.driverClassName}"
    p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
     />


  <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="configLocation">
        <value>classpath:hibernate.cfg.xml</value>
    </property>
    <property name="configurationClass">
        <value>org.hibernate.cfg.AnnotationConfiguration</value>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${jdbc.dialect}</prop>
            <prop key="hibernate.show_sql">true</prop>
        </props>
    </property>
</bean>





<tx:annotation-driven />

<bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>


</beans>

------pom.xml-----

                      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>school</groupId>
<artifactId>management</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
<build>
    <finalName>management</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.0.1</version>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>3.3.2.GA</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>

    <!-- dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> 
        <version>1.4.2</version> </dependency -->
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.10</version>
    </dependency>
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>20030825.184428</version>
    </dependency>
    <dependency>
        <groupId>commons-pool</groupId>
        <artifactId>commons-pool</artifactId>
        <version>20030825.183949</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.2.1.RELEASE</version>
    </dependency>
</dependencies>
<properties>
    <org.springframework.version>3.2.1.RELEASE</org.springframework.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

---------------------------Please modify your spring-context file as mentioned----- ---------and check location of your spring-context file you have given correctly in web.xml

                                      <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring-servlet.xml</param-value>
        </init-param>  
Monis Majeed
  • 1,358
  • 14
  • 21
  • Hi Monis Majeed, so far i don't have time to use try this, today i'm tring with your code, here i got one doubt. Actually i need to use hibernate with annotation but in spring.context for sessionFactory you are using LocalSessionFactoryBean class but i think we need to use AnnotationSessionFactoryBean. previously i tried with AnnotationSessionFactoryBean only, can you tell which one is correct? and one more, you configure for hibernate.cfg.xml also but i dont have that file – Srikanth Feb 24 '14 at 05:23
  • if my post seems to be useful for you so please vote/accept my post so that others can easily get the straight answer without going here and there – Monis Majeed Feb 26 '14 at 16:33
2

Check that your maven dependencies are added in deployment path.

for doing that follow the following steps. 1. Go to properties of your project. 2. click on deployement assembly. 3. click add button on right. 4. then goto java build path. 5. then it will show maven dependency add it. 6. try again to run your project.

Vivek Pal
  • 181
  • 1
  • 4
1

Might be you are missing viewClass try with this

   <bean id="jspViewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/jsp/" />
    <property name="suffix" value=".jsp" />
</bean>

and you can update spring dependency as

    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.2.1.RELEASE</version>
</dependency>

and check your jar files have been dowbloaded in your .m2 folder / check it in lib folder

Monis Majeed
  • 1,358
  • 14
  • 21
  • I added view class also but no change same error. Could you please tell me, where my jars will store (i know maven stores jars in .m2 fileder) in my project, means all are telling check the classpath any conflicts are there but where the classpath to my project in eclipse – Srikanth Feb 21 '14 at 06:22
1

In my case I used Ivy and I faced the same issue. You can do either of the two

  1. Either move your libraries to WEB-INF/lib . Because this is the folder from where Eclipse searches for corresponding jars. OR
  2. Let Eclipse know that it can search the jars from ivy library folder which is not same as WEB-INF/lib i.e Change java build path in Deployment Assembly via Project properties.

For 2nd approach you can refer to my personal blog post - details post with screenshots. Or you can also go through similar question I asked here.

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
1

I know this is very late but maybe someone face with it.

i had this problem too.

my project was not a maven project.

i solved this by :

1- right click on project and select "properties".

2- select "Deployment Assembly".

3- click add button.

4- select "Java Build Path Entries".

5- click next and select all jars.

6- Finish .

Sohbati
  • 53
  • 6
0

In case you have already added the jar, check the location where you have added it. The usual way is to have a lib folder and add all your jars inside the lib folder. A word of caution here, do not forget to add all the jars of lib into the build path of your class. You can probably do it from the project explorer window itself by selecting each jar or can import the folder and its contents using the following hierarchy: Project -> Prefrences -> Build Path.

Bhaskar
  • 337
  • 6
  • 21
  • Actually i'm adding jars with pom.xml file, but i dont know where that jars will store and i checked in "java build path" in that maven Dependencies contains all jars what ever i added in pom file. – Srikanth Feb 21 '14 at 05:51
  • In that case, as stated by 9ine in above comments check for any jar conflicts in the build path. Resolve them and try again. – Bhaskar Feb 21 '14 at 05:54
  • I checked for conflicts but there is no like that. – Srikanth Feb 21 '14 at 06:24
0

I solved it in a straightforward way:

  1. Go to Servers view.
  2. Select your server and right click on "Clean..."
  3. Rebuild application.
AndreFontaine
  • 2,334
  • 3
  • 17
  • 30
0

depending on the version of spring you are using, forinstance if its version 4X them avoid servlet-dispatcher declarations in your web.xml file!

-1

you can user very well localSessionFactory as there is no harm and can use sessionfactory like this
@Autowired private SessionFactory sessionFactory;

            @Override
            public void createSection(Section section) {
            sessionFactory.getCurrentSession().save(section);
            }              

            @Override
          public void deleteSection(Section section) {
             sessionFactory.getCurrentSession().delete(section);

             }

           @Override
           public Section findBySectionID(int id) {
            Query query = sessionFactory.getCurrentSession().createQuery("from Section                   
          where id = " + id);

            return (Section) query.list().get(0);

        }

And hibernate.cfg.xml.this is the xml to tell which and where are my model objects[java
model database mapping objects]

                 <?xml version='1.0' encoding='utf-8'?>
     <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate                
                   Configuration DTD//EN"
            "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">


   <hibernate-configuration>
<session-factory>
    <mapping class="something.packake.model.modelcalssName1" />
    <mapping class="something.packake.model.modelcalssName2" />
</session-factory>


        </hibernate-configuration>
Monis Majeed
  • 1,358
  • 14
  • 21