我已经编写了使用spring + hibernate + maven + Mysql添加,删除,编辑和搜索的程序.
我只使用一个表,表名是员工.看表结构.
CREATE TABLE Employee( EMPID INT NOT NULL AUTO_INCREMENT,
EMPNAME VARCHAR(20) NOT NULL, EMPAGE INT NOT NULL, SALARY
BIGINT NOT NULL, ADDRESS VARCHAR(20) NOT NULL PRIMARY KEY
(EMPID) );
我编写了控制器,服务接口,服务实现,DAO接口和DAO实现,并编写了配置文件.代码中没有错误.当我部署代码时,我得到以下代码.
当我使用spring + hibernate部署另一个应用程序时,那个时候我也得到同样的错误.
我错过了任何jar文件吗?请让我知道我做错了什么.如果你愿意,我会附上.war文件.**
Oct 02, 2014 3:29:55 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'sdnext'
Oct 02, 2014 3:29:55 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable java.lang.NoClassDefFoundError: org/springframework/core/OrderComparator$OrderSourceProvider
at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:200)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:126)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543) …Run Code Online (Sandbox Code Playgroud) 我将我的模型类保存在com.anand.model.Employee.java中,正确地我在sdnext-servlet.xml中提到了annotatedClasses.但我仍然得到错误.请帮我解决这个问题.
sdnext-servlet.xml中
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.anand.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>
Run Code Online (Sandbox Code Playgroud)
模型类:Employee.java
package com.anand.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author Anand Gopalan
*
*/
@Entity
@Table(name="Employee")
public class Employee implements Serializable{
private static final long serialVersionUID = -723583058586873479L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "empid")
private Integer empId;
@Column(name="empname")
private String empName;
@Column(name="empaddress")
private String …Run Code Online (Sandbox Code Playgroud)