java Weblogic EJB 部署:耳内 jar 中的类不可访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3659726/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Weblogic EJB deployement: classes in jar inside ear are not accessible
提问by Guillaume
I'm trying to deploy an ear containing an ejb application into a weblogic 9.2 server.
我正在尝试将包含 ejb 应用程序的耳朵部署到 weblogic 9.2 服务器中。
This ear is created using maven (itself using the ear ant task). Maven produces the following structure:
这个耳朵是使用 maven 创建的(它本身使用了 ear ant 任务)。Maven 产生以下结构:
myApp.ear
- META-INF
- application
- MANIFEST.MF
- dependency-1.jar
- dependency-2.jar
- ...
- dependency-n.jar
- myEjb.jar
The manifest contains a Class Path section that is looking good (all dependencies jar are listed)
清单包含一个看起来不错的类路径部分(列出了所有依赖项 jar)
When I try to deploy the ear I get a NoClassDefFoundError exception.
当我尝试部署耳朵时,出现 NoClassDefFoundError 异常。
If I put all my jars in the lib dir of my domain, the ear is successfully deployed.
如果我把我所有的 jars 放在我域的 lib 目录中,那么耳朵就成功部署了。
If I put all my jars in a dir called APP-INF/lib (the weblogic standard), the ear is successfully deployed too.
如果我将所有 jars 放在一个名为 APP-INF/lib(weblogic 标准)的目录中,那么耳朵也会成功部署。
myApp.ear
- META-INF
- application
- MANIFEST.MF
- APP-INF
- lib
- dependency-1.jar
- dependency-2.jar
- ...
- dependency-n.jar
- myEjb.jar
In the same project, I have others ears that does not use the APP-INF/lib dir that are working perfectly.
在同一个项目中,我有其他耳朵不使用运行良好的 APP-INF/lib 目录。
Does someone has an idea of why weblogic is not able to deploy my ear ?
有人知道为什么 weblogic 无法部署我的耳朵吗?
After some investigation I've found the problem source: it was the manifest class-path of the myEjb.jar module. See comment in accepted response.
经过一番调查,我找到了问题来源:它是 myEjb.jar 模块的清单类路径。请参阅已接受回复中的评论。
Thanks a lot.
非常感谢。
回答by JoseK
The standard approach for dependency jars within an EAR is to put them in the APP-INF/lib as given on the documentation
EAR 中依赖 jar 的标准方法是将它们放在文档中给出的 APP-INF/lib 中
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/programming/environment.html#1099434
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/programming/environment.html#1099434
I suspect the problem in your first EAR is in the actual classpath entries in your Manifest.mf
我怀疑您的第一个 EAR 中的问题出在您的 Manifest.mf 中的实际类路径条目中
see the Manifest Class-Pathsection on http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/classloading.html#wp1065667
请参阅http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/classloading.html#wp1065667上的 清单类路径部分
The manifest Class-Path entries refer to other archives relative to the current archive in which these entries are defined
清单类路径条目是指相对于定义这些条目的当前档案的其他档案
Are there any sub-directories or relative path incorrect?
是否有任何子目录或相对路径不正确?