引起:java.util.NoSuchElementException:null

时间:2017-11-03 18:12:25

标签: java spring hibernate maven spring-mvc

我参加了有关Java Web Programming的考试。我正在使用Spring MVC和Hibernate来创建电子商务Web应用程序。不幸的是,我两天都得到同样的错误。我可以说我已阅读有关此错误的所有文章但仍然我的项目无效。我正在尝试构建一个公司管理员可以执行基本CRUD事务的项目,并且我还有一个向客户显示产品的页面。在服务器上第一次运行项目时,我收到此错误。我很抱歉长篇大论。我希望一切都清楚。

我的控制器类

package com.bilgeadam.webexam.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.bilgeadam.webexam.model.DatabaseService;
import com.bilgeadam.webexam.model.entity.impl.Address;
import com.bilgeadam.webexam.model.entity.impl.Customer;
import com.bilgeadam.webexam.model.entity.impl.Product;
import com.bilgeadam.webexam.model.entity.impl.ShoppingCart;

/**
 * @author Fatih Taşdemir Oct 30, 2017
 */

@Controller
@RequestMapping({ "/", "home" })
public class CustomerPanelController {

    @Autowired
    DatabaseService databaseService;

    @GetMapping
    public String home(Model model) {
        model.addAttribute("products", databaseService.getProductService().findAll());
        return "products";
    }


}

数据库服务类

package com.bilgeadam.webexam.model;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bilgeadam.webexam.model.service.AddressService;
import com.bilgeadam.webexam.model.service.CustomerService;
import com.bilgeadam.webexam.model.service.OrderService;
import com.bilgeadam.webexam.model.service.ProductDetailService;
import com.bilgeadam.webexam.model.service.ProductService;
import com.bilgeadam.webexam.model.service.ShoppingCartService;
import com.bilgeadam.webexam.model.service.UserService;

@Component
public class DatabaseService {

    @Autowired
    private AddressService addressService;
    @Autowired
    private CustomerService customerService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private ProductDetailService productDetailService;
    @Autowired
    private ProductService productService;
    @Autowired
    private ShoppingCartService shoppingCartService;
    @Autowired
    private UserService userService;

    public AddressService getAddressService() {
        return addressService;
    }

    public CustomerService getCustomerService() {
        return customerService;
    }

    public OrderService getOrderService() {
        return orderService;
    }

    public ProductDetailService getProductDetailService() {
        return productDetailService;
    }

    public ProductService getProductService() {
        return productService;
    }

    public ShoppingCartService getShoppingCartService() {
        return shoppingCartService;
    }

    public UserService getUserService() {
        return userService;
    }

}

HibernateDAO类

package com.bilgeadam.webexam.model.dao;

import java.lang.reflect.ParameterizedType;

import java.util.Date;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;

import com.bilgeadam.webexam.model.entity.GenericEntity;

/**
 * @author Fatih Taşdemir Oct 29, 2017
 */

public abstract class HibernateDAO<E extends GenericEntity> implements GenericDAO<E> {

    @Autowired
    private SessionFactory sessionFactory;

    private Class<E> entityClass;

    @SuppressWarnings("unchecked")
    public HibernateDAO() {
        this.entityClass = (Class<E>) ((ParameterizedType) getClass().getGenericSuperclass())
                .getActualTypeArguments()[0];
    }

    @Override
    public void save(E entity) {
        entity.setDeleted(false);
        entity.setCreatedDate(new Date());
        entity.setUpdatedDate(new Date());
        sessionFactory.getCurrentSession().save(entity);
    }

    @Override
    public void update(E entity) {
        entity.setUpdatedDate(new Date());
        sessionFactory.getCurrentSession().update(entity);
    }

    @Override
    public void delete(E entity) {
        E e = findById(entity.getId());
        e.setDeleted(true);
        update(e);
    }

    @SuppressWarnings("unchecked")
    @Override
    public E findById(Integer id) {
        Criteria criteria = sessionFactory.getCurrentSession().createCriteria(entityClass);
        criteria.add(Restrictions.eq("id", id));
        criteria.add(Restrictions.eq("deleted", false));
        return (E) criteria.uniqueResult();
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<E> findAll() {
        Criteria criteria = sessionFactory.getCurrentSession().createCriteria(entityClass);
        criteria.add(Restrictions.eq("deleted", false));
        return criteria.list();
    }

}

GenericDAO类

package com.bilgeadam.webexam.model.dao;

import java.util.List;

import com.bilgeadam.webexam.model.entity.GenericEntity;

/**
 * @author Fatih Taşdemir Oct 29, 2017
 */

public interface GenericDAO<E extends GenericEntity> {

    public abstract void save(E entity);

    public abstract void update(E entity);

    public abstract void delete(E entity);

    public abstract E findById(Integer id);

    public abstract List<E> findAll();

}

AbstractService类

package com.bilgeadam.webexam.model.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.bilgeadam.webexam.model.entity.GenericEntity;
import com.bilgeadam.webexam.model.dao.GenericDAO;

/**
 * @author Fatih Taşdemir Oct 29, 2017
 */

@Transactional
public class AbstractService<E extends GenericEntity> implements GenericService<E> {

    protected final GenericDAO<E> genericDAO;

    public AbstractService(GenericDAO<E> genericDAO) {
        this.genericDAO = genericDAO;
    }

    @Override
    public void save(E entity) {
        genericDAO.save(entity);
    }

    @Override
    public void update(E entity) {
        genericDAO.update(entity);
    }

    @Override
    public void delete(E entity) {
        genericDAO.delete(entity);
    }

    @Override
    public E findById(Integer id) {
        return genericDAO.findById(id);
    }

    @Override
    public List<E> findAll() {
        return genericDAO.findAll();
    }
}

ProductDAOImpl class

package com.bilgeadam.webexam.model.dao.impl;

import org.springframework.stereotype.Repository;

import com.bilgeadam.webexam.model.dao.HibernateDAO;
import com.bilgeadam.webexam.model.dao.ProductDAO;
import com.bilgeadam.webexam.model.entity.impl.Product;

/**
 * @author Fatih Taşdemir Oct 29, 2017
 */

@Repository
public class ProductDAOImpl extends HibernateDAO<Product> implements ProductDAO {

}

ProductServiceImpl class

package com.bilgeadam.webexam.model.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bilgeadam.webexam.model.dao.ProductDAO;
import com.bilgeadam.webexam.model.entity.impl.Product;
import com.bilgeadam.webexam.model.service.AbstractService;
import com.bilgeadam.webexam.model.service.ProductService;

/**
 * @author Fatih Taşdemir Oct 29, 2017
 */

@Service
public class ProductServiceImpl extends AbstractService<Product> implements ProductService {

    @Autowired
    public ProductServiceImpl(ProductDAO productDAO) {
        super(productDAO);
    }

}

产品类

package com.bilgeadam.webexam.model.entity.impl;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;

import org.springframework.web.multipart.MultipartFile;

import com.bilgeadam.webexam.model.entity.AbstractEntity;

/**
 * @author Fatih Taşdemir Oct 28, 2017
 */

@Entity
@Table(name = "PRODUCT")
public class Product extends AbstractEntity {

    private static final long serialVersionUID = 1L;
    private String name;
    private String brand;
    private String model;
    private String barcode;
    private double price;
    private String productCategory;
    private Integer producedYear;
    private Integer availableStock;
    private ProductDetail productDetail;
    private MultipartFile productImage;
    private String productImageUrl;
    private Integer unitsInOrder;

    getter and setters

Spring bean配置文件

<?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" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:security="http://www.springframework.org/schema/security"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd">

    <!-- MVC configurations -->
    <mvc:annotation-driven enable-matrix-variables="true"
        validator="validator" />
    <context:component-scan base-package="com.bilgeadam.webexam" />
    <mvc:resources mapping="/resources/**" location="/resources/" />
    <!-- Properties files -->
    <context:property-placeholder location="classpath:application.properties"
        ignore-unresolvable="true" />

    <!-- Spring MVC Interceptor Beans -->
    <mvc:interceptors>
        <bean
            class="com.bilgeadam.webexam.interceptor.PerformanceMonitorInterceptor" />
        <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="language" />
        </bean>
        <bean class="com.bilgeadam.webexam.interceptor.AuditingInterceptor" />
    </mvc:interceptors>

    <!-- Spring MVC Internationalization -->
    <bean id="localeResolver"
        class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
        <property name="defaultLocale" value="en" />
    </bean>

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

    <!-- Spring MVC LocalValidatorFactoryBean -->
    <bean id="validator"
        class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
        <property name="validationMessageSource" ref="messageSource" />
    </bean>

    <!-- Transaction definition -->
    <tx:annotation-driven transaction-manager="transactionManager"
        proxy-target-class="true" />

    <!-- Spring MVC CommonMultiPartResolver -->
    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize" value="10240000" />
    </bean>



    <!-- Datasource Bean definition -->
    <jee:jndi-lookup id="dataSource" jndi-name="${jndi.datasource}"
        expected-type="javax.sql.DataSource" />

    <!-- Hibernate 5 SessionFactory Bean definition -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan">
            <array>
                <value>com.bilgeadam.webexam.model.entity.impl</value>
            </array>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.default_schema">${hibernate.default_schema}</prop>
                <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="hibernate.connection.CharSet">${hibernate.connection.CharSet}</prop>
                <prop key="hibernate.connection.characterEncoding">${hibernate.connection.characterEncoding}</prop>
                <prop key="hibernate.connection.useUnicode">${hibernate.connection.useUnicode}</prop>
                <prop key="hibernate.hbm2ddl.import_files_sql_extractor">${hibernate.multiline.sql}</prop>
            </props>
        </property>
    </bean>

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

    <bean id="persistenceExceptionTranslationPostProcessor"
        class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

    <!-- Spring MessageSource -->
    <bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="messages" />
    </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>com.webexam</groupId>
    <artifactId>WebExam</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <!-- JRE version -->
        <maven.compiler.target>1.8</maven.compiler.target>
        <!-- JDK version -->
        <maven.compiler.source>1.8</maven.compiler.source>
        <!-- Spring framework version -->
        <spring-framework.version>4.3.7.RELEASE</spring-framework.version>
        <!-- Spring security version -->
        <spring-security.version>4.2.3.RELEASE</spring-security.version>
        <!-- Servlet version -->
        <servlet.version>3.1.0</servlet.version>
        <!-- JSP version -->
        <jsp.version>2.3.1</jsp.version>
        <!-- JSTL version -->
        <jstl.version>1.2</jstl.version>
        <!-- MySQL version -->
        <mysql.version>5.1.39</mysql.version>
        <!-- Hibernate version -->
        <hibernate.version>5.1.3.Final</hibernate.version>
        <!-- DBCP version -->
        <dbcp.version>1.4</dbcp.version>
        <!-- SLF4J version -->
        <slf4j.version>1.7.5</slf4j.version>
        <!-- LogBack version -->
        <logback.version>1.0.13</logback.version>
        <!-- Apache Tiles version -->
        <apache.tiles.version>3.0.7</apache.tiles.version>
        <!-- Jackson version -->
        <jackson.version>2.8.8</jackson.version>
        <!-- Apache Commons FileUpload -->
        <file.upload.version>1.3.1</file.upload.version>
        <!-- Apache Commons IO -->
        <common.io.version>2.4</common.io.version>
    </properties>

    <dependencies>
        <!-- Spring Framework API -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <!-- Servlet + JSP + JSTL API -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>${jsp.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl.version}</version>
        </dependency>
        <!-- MySQL JDBC API -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>
        <!-- Hibernate Core API -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <!-- DBCP API -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>${dbcp.version}</version>
        </dependency>
        <!-- SLF4J API -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <!-- Logback API -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <!-- Apache Tiles API -->
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>${apache.tiles.version}</version>
        </dependency>
        <!-- Jackson API -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <!-- Apache Commons FileUpload -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>${file.upload.version}</version>
        </dependency>
        <!-- Apache Commons IO -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${common.io.version}</version>
        </dependency>
    </dependencies>
</project>

的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"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">
    <display-name>WebExam</display-name>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/security-context.xml</param-value>
    </context-param>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/config.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>DispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/config.xml</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>DispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <!-- Filter Declerations -->
    <filter>
        <filter-name>encoding-filter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <!-- Filter Mappings -->
    <filter-mapping>
        <filter-name>encoding-filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>

和堆栈跟踪:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring/config.xml]: Invocation of init method failed; nested exception is java.util.NoSuchElementException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    ... 85 common frames omitted
Caused by: java.util.NoSuchElementException: null
    at java.util.ArrayList$Itr.next(ArrayList.java:860) ~[na:1.8.0_151]
    at org.hibernate.cfg.annotations.TableBinder.linkJoinColumnWithValueOverridingNameIfImplicit(TableBinder.java:724) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.cfg.PkDrivenByDefaultMapsIdSecondPass.doSecondPass(PkDrivenByDefaultMapsIdSecondPass.java:37) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1621) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1578) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:278) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:727) ~[hibernate-core-5.1.3.Final.jar:5.1.3.Final]
    at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:511) ~[spring-orm-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:495) ~[spring-orm-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    ... 95 common frames omitted

0 个答案:

没有答案