JPA 无法加载独立JAR包中实体映射文件 unkonwn entity

在实际的项目中,原先大的项目,需要按业务功能拆分成小功能,并且以服务的方式独立布署。

在此前提下,同时也为了应用各工程 ,使用同一代码,为了方便。单独以jar包方式,作为其他工程 引入,使用。

 

我们在独立的JAR包,设置了独立的数据源文件,映射实体。

 

但在项目整合的时候遇到不能加载配置文件跟实体映射。

我们在实体文件中全部使用JPA实体映射。@Entity

 

在具体使用中,抛出异常unkonwn entity xxxx

原因有二:

1 .web.xml 需要指定 classpath*:applicationContext-*.xml 特别是classpath* 这样才会扫描jar 包中的配置文件。否则只加载项目下的。

2.persistence.xml 文件中,需要指定JAR包的文件所在

在节点provider 同级下设置 jar-file 指定绝对目录或者文件。

 

具体请参考 http://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/configuration.html#d0e215

海康视觉脚本开发全流程解析 本文详细解析了海康机器视觉平台(VM)中脚本模块的开发全流程。从创建第一个脚本模块入手,深入讲解了输入参数、输出参数与内部变量的定义与区别,并提供了C#脚本编写、公用函数调用、代码结构组织以及编译调试的实用指南。旨在帮助开发者掌握海康视觉脚本开发的核心技巧,高效实现复杂的自定义视觉逻辑处理。 阅读详情

相关推荐

基于ESP32的摩托车蓝牙对讲系统开发实践

蓝牙音频传输技术在现代通信中扮演着重要角色,其核心原理是通过无线射频实现数字音频信号的双向传输。在工程实践中,蓝牙HFP协议常用于语音通信场景,而ESP32等嵌入式平台因其低成本和高集成度成为DIY项目的理想选择。本项目通过ESP32-WROOM-32D开发板结合PCM5102 DAC和INMP441数字麦克风等模块,构建了一套摩托车骑行专用的蓝牙对讲系统。该系统特别针对高速移动环境下的风噪抑制和连接稳定性进行了优化,采用数字信号处理技术实现实时降噪,并通过I2S接口确保音频质量。这种方案不仅成本控制在30

weixin_33239721的博客 414

idea Maven项目依赖出现unknown异常的处理方法

1、加上版本号 2、到报错依赖包的文件处将其删除,再下载

sky 4757

避坑指南:在Linux服务器上用Conda安装antiSMASH 5.2.0(解决Jinja2报错和Matplotlib权限问题)

本文详细介绍了在Linux服务器上使用Conda安装antiSMASH 5.2.0的避坑指南,重点解决了Jinja2报错和Matplotlib权限问题。通过创建专用conda环境、安装指定版本依赖包和配置缓存目录,帮助用户顺利完成antiSMASH的本地部署,适用于批量处理基因组分析任务。

weixin_26911099的博客 314

关于maven依赖显示unknown的问题解决方法

博主今天在编写springboot框架导入一个依赖时发现Maven Projects里的Plugins里飙红(如下图) 当时第一反应是点击刷新按钮,重新导入 发现问题没有得到解决 然后进入maven的本地仓库查看此文件的时候发现 org.springframework.boot里的spring-boot-maven文件是这样的,才开始思考是没找到这个依赖 接下来一个例子 大家仔细看注释和非...

zhanxiaozhangA的博客 3万+

告别C盘爆红!手把手教你将WSL2下的Ubuntu 22.04完整迁移到D盘(附清理指南)

本文详细指导如何将WSL2下的Ubuntu 22.04从C盘无损迁移到D盘,包括导出备份、注销原系统、导入新位置等关键步骤,并提供迁移后的优化配置、开发环境衔接及长期维护技巧,帮助用户彻底解决C盘空间不足问题。

weixin_28698059的博客 472

SEGGER Embedded Studio初体验

先楫HPM5E00EVK开发环境搭建

hywing's blog 1108

打jar包之后放入项目的lib下,结果无法找到entity

描述:          源码引用了外部jar,然后把源码打包成jar,放入其他项目中,结果报错Unknown entity 结果试了一下,在打包的时候,把“add directory entries ”选上,这时候打包出来的Jar,就没有问题了。 再结合其他人的解释,附上地址:http://blog.youkuaiyun.com/wangpeng047/article/details/

一只狮的专栏 856

1. 在 SAP ABAP 事物码 SEGW 里创建 SAP OData 项目

本文介绍如何在 SAP ABAP 事物码 SEGW 里创建 SEGW 项目,使用工具生成 Runtime 运行时需要的资源。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 5435

Jpa Unknown entity:

今天在做JPa练习时,发现一个错误。很是郁闷,搞了一下午。终于搞定。 java.lang.IllegalArgumentException:Unknownentity:com.entity.TestEntity atorg.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntity...

weixin_34007879的博客 627

前端技能树,面试复习第 54 天—— 手写代码:情景题

前端修罗场提供全网最专业的前端优质文章与社区服务,为应届生,初中级前端工程师提供全面、优质的面试服务、技能提升、职场解惑服务!内容包含:前端面试辅导,前端面试题,前端交流,前端答疑,前端基础知识,前端知识体系,技能树搭建,Javascript,CSS,CSS3,HTML,React,Vue,小程序,前端简历,职业交流,远程工作,英文交流,英文提升,外企,互联网,国企,大厂,牛客面试题,掘金面试题,面经,优质前端文章分享...

前端进阶之路 | 中大厂、外企、国企内推 | 面试培训 | 简历修改 986

Unet++改进33:添加ConvolutionalGLU(2024最新改进方法)|紧凑的网络结构和高效的运算

由于残差连接的深度退化效应,许多依赖堆叠层进行信息交换的高效视觉变形模型往往不能形成足够的信息混合,导致视觉感知不自然。为了解决这个问题,在本文中,我们提出了聚合注意力,这是一种基于仿生设计的令牌混合器,它模拟生物中央凹视觉和连续眼运动,同时使特征映射上的每个令牌具有全局感知。此外,我们结合了可学习的令牌,与传统的查询和键交互,这进一步多样化了亲和矩阵的生成,而不仅仅依赖于查询和键之间的相似性。我们的方法不依赖于堆叠进行信息交换,从而有效地避免了深度退化,实现了自然的视觉感知。

AIcurator的博客 683

开发常见小问题

1.在html页面使用elementUI的时候,分页插件显示小方框 解决:我这个是因为elementUI的字体库有问题

Apple South的博客 316

电磁场仿真软件:Sonnet_(1).Sonnet软件概述

根据特定需求自定义仿真流程,如多频率点仿真、多边界条件仿真等。

kkchenjj的博客 1447

Jar或Jboss里无法读取配置文件

以前是通过这种方式加载配置文件: private static void init() {         URL url = PropertyUtil.class.getClassLoader().getResource(                 "ApplicationResources.properties");         String file = url.

grhlove123的专栏 2779

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

JPA 不在 persistence.xml 文件中配置每个Entity实体类的2种解决办法

原文地址:http://www.cnblogs.com/taven/p/3351841.html JPA 不在 persistence.xml 文件中配置每个Entity实体类的2种解决办法 在Spring 集成 Hibernate 的JPA方式中,需要在persistence配置文件中定义每一个实体类,这样非常地不方便,远哥目前找到了2种方法。   这2种方式都可以实现不用persist...

weixin_34107955的博客 257

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

【已解决】persistence.xml和entity类不在同一jar包,导致找不到实体

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34327223的博客 271

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Hibernate 元数据模型(MetaModel)提示类没有找到错误

在进行一次编译的时候,提示下面的错误信息:正在上传…重新上传取消如果你对 Hibernate 的元数据还是不非常了解的话,请参考文章: JPA 的 Metamodel 中的内容。有关元数据生成器中的内容,请参看官方的:JPA Static Metamodel Generator这里有几种使用方法:我们使用了第一种的 Maven 配置方法: 在我们的项目中和 lombok 的插件编译方法冲突了。需要将上面的配置方法通过 来进行配置。修改后的配置如下: 然后再次编译和运行项目,上面的错误就解决了。通常

HONEY MOOSE 597

[Eclipse] The type XXX cannot be resolved. It is indirectly referenced from required .class files错误....

在Eclipse中遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....,查找的解决办法如下: 一: It is indirectly referenced from required .class file 原因:你正要使用的类调用了另一个类,而这个类又调...

web开发自学 1460

spring 子工程引入jar包版本unknown解决方法之一

spring 子工程引入jar包版本unknown解决方法之一 ​ ​ 配置不正确的可以参考https://blog.youkuaiyun.com/qq_41262903/article/details/90146203写的很详细 如果使用本地仓库: ​ 父工程制定了正确的版本号,其他 配置也正确,但是子工程相关springcloud相关的jar包版本号显示unknown,可以看看是不是本...

weixin_44313428的博客 2159

关于ssh整合jbpm4.4 无法获取processEngine的问题

先说环境 我的环境是 struts2.1.8+spring2.5.6+hibernate3.5.0+tomcat7.0 错误提示如下 org.hibernate.MappingException: Unknown entity: org.jbpm.pvm.internal.id.PropertyImpl at org.hibernate.impl.SessionFactoryImpl.get

d342784178的专栏 1572

org.hibernate.MappingException: Unknown entity: com.pojo.Dept

未知实体。出现这种情况可能有如下原因:1.没有写Mapping映射文件。2.映射文件中的class类名路径写错了,不是实体类的全路径3.没有在hibernate.cfg.xml的&lt;session-factory&gt;中加载映射文件,注意&lt;mapping&gt;节点出现的位置在&lt;property&gt;之后&lt;mapping resource="com/pojo/Dept.h...

专治八阿哥的孟老师 954

当全注解开发遇到org.hibernate.MappingException: Unknown entity:错误

在进行全注解开发的时候,网上的文章都讲到要用到hibernate-annotations的jar包。我实际中没有用到,关于这个排错,用了我进2天的时间。。。天啊,终于让我发现了。 关于这个错误的可能: 1.import org.hibernate.annotations.Entity; 注解实体类时,引入包错误,应该是import javax.persistence.Entity;

NeoMc的技术博 1万+

Maven导入依赖时jar包出现unknown

今天在一个项目中添加jar包依赖后导入发现jar包下边出现红色波浪线,而且jar包的版本显示unknown,显示错误:Cannot resolve com.alibaba.spring:spring-context-support:unknown 解决 在maven的本地仓库中,将出现unknown的文件夹和后缀有lastUpdated的文件全部删掉,再重新导入jar包后就成功了 ...

qq_44209563的博客 6518

jpa打包jar后,运行的问题

v/:* {behavior:url(#default#VML);}o/:* {behavior:url(#default#VML);}w/:* {behavior:url(#default#VML);}.shape {behavior:url(#default#VML);} Normal 0 false

Fish1112的专栏 1357
上一篇: chrome 来自服务器的响应包含重复标头。此问题通常是由于网站或代理配置不正确导致的。只有网站或代理管理员才能解决此问题...
下一篇: eclipse.ini 参数优化
茄子煸土豆
博客等级 码龄19年 0粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值