可以将 ejb 拦截器打包到库中吗?

发布于 2024-10-16 18:18:40 字数 399 浏览 9 评论 0原文

如果是这样,你会怎么做?

我有一个 ejb @javax.interceptor.AroundInvoke 拦截器,我喜欢将其移入库中以供重用。我将代码移动到一个库中,修复了 Maven 中的依赖关系,现在所有代码都编译得很好。仅在部署时我收到以下错误消息:

09.02.2011 14:19:48 com.sun.logging.LogDomains$1 log
SCHWERWIEGEND: Exception while invoking class org.glassfish.ejb.startup.EjbApplication start method
java.lang.RuntimeException: java.lang.ClassNotFoundException: 

And if so how do you do it?

I have got an ejb @javax.interceptor.AroundInvoke interceptor which I like to move into a library for reuse. I moved the code into a library fixed the dependencies in maven and all compiles well now. Only on deploy I get the following error message:

09.02.2011 14:19:48 com.sun.logging.LogDomains$1 log
SCHWERWIEGEND: Exception while invoking class org.glassfish.ejb.startup.EjbApplication start method
java.lang.RuntimeException: java.lang.ClassNotFoundException: 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如梦 2024-10-23 18:18:40

来自JSR 318:Enterprise JavaBeans,版本 3.1 - EJB 核心合同和要求

20.3 包装要求

ejb-jar 文件或 .war 文件必须
包含,通过包含或
参考
,各个的类文件
企业bean如下:

  • 企业 Bean 类。
  • 企业 Bean 业务接口、Web 服务端点
    接口、home 和组件
    接口。
  • 拦截器类。
  • 主键类(如果 bean 是实体 bean)。

我们说 .jar 文件“通过引用”包含第二个文件,如果
第二个文件在类路径中命名
Manifest 文件中的属性
引用 .jar 文件或包含
(通过包含或引用)
在另一个名为的 .jar 文件中
中的类路径属性
引用 .jar 的清单文件
文件。

所以我会说是的,您可以将拦截器类打包在库 .jar 文件中

检查:1) 库实际上已打包并与 ejb-jar 文件一起部署; 2) 如上所述,Manifest 文件中引用了库 .jar。

From JSR 318: Enterprise JavaBeans, Version 3.1 - EJB Core Contract and Requirements:

20.3 Packaging Requirements

The ejb-jar file or .war file must
contain, either by inclusion or by
reference
, the class files of each
enterprise bean as follows:

  • The enterprise bean class.
  • The enterprise bean business interfaces, web service endpoint
    interfaces, and home and com-ponent
    interfaces.
  • Interceptor classes.
  • The primary key class if the bean is an entity bean.

We say that a .jar file contains a second file “by reference” if the
second file is named in the Class-Path
attribute in the Manifest file of the
referencing .jar file or is contained
(either by inclusion or by reference)
in another .jar file that is named in
the Class-Path attribute in the
Manifest file of the referencing .jar
file.

So I'd say yes, you can package the interceptor class in a library .jar file.

Check that: 1) the library actually got packaged in and deployed with the ejb-jar file; and 2) the library .jar is referenced in the Manifest file as described above.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文