简体   繁体   English

焊接,Tomcat:META-INF 中缺少“beans.xml”

[英]Weld, Tomcat: missing “beans.xml” in META-INF

I know many similar questions have already been asked (ex. this , this , etc.), but none of them could help me, so I decided to bring it up again - been struggling for hours and I've really run out of ideas.我知道已经问过很多类似的问题(例如thisthis等),但没有一个可以帮助我,所以我决定再次提出这个问题 - 已经挣扎了几个小时,我真的没有想法了.

I have a Java EE project, whith simple servlet that accepts data from HTML form, performs a few queries in external services (with REST and JAX-RS) and returns results.我有一个 Java EE 项目,它有一个简单的 servlet,它接受来自 HTML 表单的数据,在外部服务中执行一些查询(使用 Z50780F47F6839D47D60BC45RS55EE00C3FZ 和 JAX--)并返回结果。 My goal now is to deploy it on standalone Tomcat server.我现在的目标是将它部署在独立的 Tomcat 服务器上。 The way I'm trying to achieve it is by exporting WAR artifact and copying it to Tomcat's webapps directory.我试图实现它的方法是导出 WAR 工件并将其复制到 Tomcat 的webapps目录。

It works up to the moment of sending REST request with JAX-RS - then I always get the error:它一直有效到使用 JAX-RS 发送 REST 请求的那一刻 - 然后我总是得到错误:

WELD-ENV-000016: Missing beans.xml file in META-INF

I'm not using this file at all, but as I read, it must be there, even if empty... so I've tried to put it at any location I could think of/read about, including:我根本没有使用这个文件,但是当我读到它时,它必须在那里,即使是空的......所以我试图把它放在我能想到/读到的任何位置,包括:

/web/META-INF
/web/WEB-INF
/src/main/webapp/META-INF
/src/main/webapp/WEB-INF
/src/main/resources/META-INF
/src/main/resources/WEB-INF

When I check the output.war file or directories created by Tomcat after deployment, beans.xml is present in both META-INF and WEB-INF directories.当我在部署后检查 output.war 文件或 Tomcat 创建的目录时, beans.xml存在于 META-INF 和 WEB-INF 目录中

Initializing Weld and performing those queries works well in unit tests inside Intellij IDE - the only requirement here was to mark directory containing WEB-INF and META-INF as "Resources Root".初始化 Weld 并执行这些查询在 Intellij IDE 内的单元测试中效果很好——这里唯一的要求是将包含 WEB-INF 和 META-INF 的目录标记为“资源根”。

In my facet configuration, I mark directory containing WEB-INF and META-INF as "Web Resource Directory", and *'Web' facet resources' is included in my artifact.在我的构面配置中,我将包含 WEB-INF 和 META-INF 的目录标记为“Web 资源目录”,并且 *'Web' facet resources' 包含在我的工件中。

Any ideas?有任何想法吗? Am I fundamentally misunderstanding something, does this inner Weld here require different, separate META-INF or something?我是否从根本上误解了某些东西,这里的内部焊接是否需要不同的、单独的 META-INF 或其他东西?

As nobody answered, I'll at least share my conclusion - the simplest way is to switch to TomEE (if that is acceptable).由于没有人回答,我至少会分享我的结论 - 最简单的方法是切换到 TomEE(如果可以接受的话)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用src / test / META-INF / beans.xml中的替代生产者进行焊接 - Weld using alternative producer from src/test/META-INF/beans.xml 来自lib的jar中的META-INF中的CDI WELD Beans.xml阻止了项目的WEB-INF中的一个 - CDI WELD Beans.xml in META-INF from jar in lib blocking the one in WEB-INF of project 将bean.xml文件放入META-INF目录时的异常 - Exceptions when placing a beans.xml file into the META-INF dir WELD-001201:加载bean.xml + Tomcat 7.0.59时出错 - WELD-001201: Error loading beans.xml + Tomcat 7.0.59 焊接 - 从扫描/beans.xml 中排除应用程序范围的 bean - WELD - exclude application scoped bean from scanning / beans.xml Tomcat中context.xml的正确META-INF目录位置是什么? - What is the correct META-INF directory location for context.xml in Tomcat? 可以从某些属性文件中读取Tomcat中的Web / Meta-Inf / Context.xml - can Web/Meta-Inf/Context.xml read in Tomcat from some properties file 部署战争。 Tomcat 不考虑上下文。考虑到 META-INF 中的 xml - Deploying War. Tomcat not taking context.xml from META-INF in consideration Maven-为什么我的pom.xml没有删除META-INF / *。SF,META-INF / *。DSA和META-INF / *。RSA? - maven - why is my pom.xml NOT removing META-INF/*.SF, META-INF/*.DSA and META-INF/*.RSA? Beans.xml和SessionScoped - Beans.xml and SessionScoped
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM