JPA cannot load the entity ing file unkonwn entity in the independent JAR package

Source: Internet
Author: User

In actual projects, the original large projects need to be split into small functions based on business functions, and deployed independently in the form of services. On this premise, the same code is also used to apply various projects, for convenience. It is introduced as a jar package and used as another project. In an independent JAR package, we set an independent data source file to map objects. However, during project integration, the configuration file and object ing cannot be loaded. We use JPA object ing in all object files. @ Entity in specific use, the unkonwn entity xxxx exception is thrown for two reasons: 1. web. in xml, you must specify classpath *: applicationContext -*. xml, especially classpath *, scans the configuration file in the jar package. Otherwise, only the projects under the add-on directory are displayed. 2. In the persistence. xml file, you must specify that the file of the JAR package is located at the same level as the node provider. Set jar-file to specify an absolute directory or file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.