开发者

Can you package an ejb interceptor in a library?

开发者 https://www.devze.com 2023-02-10 00:39 出处:网络
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 f开发者_Python百科ixed the depen

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 f开发者_Python百科ixed 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: 


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消