java.lang.NoClassDefFoundError: org/datanucleus/exceptions/NucleusException

java.lang.NoClassDefFoundError: org/datanucleus/exceptions/NucleusException

我遇到了这个错误

java.lang.NoClassDefFoundError: org/datanucleus/exceptions/NucleusException

我的文件: UserDAOImpl.java

public class UserDAOImpl implements UserDAO{
static Logger log = Logger.getLogger(UserDAOImpl.class.getName());

@Autowired
private DataSource dataSource;
private PersistenceManagerFactory persistenceManagerFactory;
HttpServletRequest request;

@Override
public User getUser(String user_name, String user_password) {
    PersistenceManager pm = this.persistenceManagerFactory.getPersistenceManager();
    try {
        Query query = pm.newQuery(User.class);
        query.setFilter("userName == userNameParam && userPassword==userPasswordParam");
        query.declareParameters("String lastNameParam, String userPasswordParam");
        User user = (User) query.execute(user_name,user_password);
        log.info(user.getUserEmail()+"..........."+user.getUserProfileName());
        return user;
    }
    finally {
        pm.close();
    } 
}

调度员-servlet.xml

<!-- declare mvc to be annotation driven -->
<mvc:annotation-driven/>
<!-- provide Your Base package to scan annotations for components -->
<context:component-scan base-package="com.titas.controller"></context:component-scan>
<mvc:resources location="static/" mapping="static/**"/>

<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
<!--
Most controllers will use the ControllerClassNameHandlerMapping above, but
for the index controller we are using ParameterizableViewController, so we must
define an explicit mapping for it.
-->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <props>
            <prop key="index">indexController</prop>
        </props>
    </property>
</bean>

<bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"
      p:prefix="/WEB-INF/jsp/"
      p:suffix=".jsp" />

<!--
The index controller.
-->
<bean name="indexController"
      class="org.springframework.web.servlet.mvc.ParameterizableViewController"
      p:viewName="index" />

<bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="com.mysql.jdbc.Driver"
    p:url="jdbc:mysql://localhost:3306/login"
    p:username="root"
    p:password="" />

<bean id="myPmf" class="org.datanucleus.api.jdo.JDOPersistenceManagerFactory" destroy-method="close">
  <property name="connectionFactory" ref="dataSource"/>
  <property name="nontransactionalRead" value="true"/>
</bean>

<bean id="userDAO" class="com.titas.dao.UserDAOImpl" >
</bean>

User.java

     @PersistenceCapable
        public class User {
             @PrimaryKey
             @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
             private Integer userId=0;
             @Persistent
             private String userProfileName=null;  
             @Persistent
             private String userEmail=null;
             @Persistent
             private String userContact=null;
             @Persistent
             private String userName=null;
             @Persistent
             private String userPassword=null;
             @Persistent
             private Integer userRoleId=0;
             @Persistent
             private String role=null;

MyController.java

@Controller
//@RequestMapping(value = "/test")
public class MyController{

      static Logger log = Logger.getLogger(MyController.class.getName());
      @Autowired
      private UserDAO userDAO;
      List<User> allUser = new ArrayList<User>();

我用过像这样的罐子: mysql-connector-java-5.1.6, ojdbc14, jdo-api-3.0.1, aopalliance-1.0, maven-datanucleus-plugin-3.1.0-release, datanucleus- api-jdo-3.0.0-release.

我是 JDO 的新手。 请帮忙!!

您需要将 datanucleus-core-3.1.1.jar jar 添加到类路径中。