我正在将一个大型的J2EE应用程序(下面称为AEAPP)从EJB2转换为EJB3(使用Glassfish2.1.1的全无状态会话bean),并且没有任何想法。
我转换的第一个EJB(我们称之为foo)运行时没有出现重大问题(它是EJB模块中唯一的一个,我可以用注释完全替换部署描述符),应用程序运行良好。但是在转换第二个(我们称之为bar,它是不同EJB模块中的几个模块之一)之后,出现了一个奇怪的问题组合:
-
AEAPP部署没有错误(日志中也没有任何错误)。在日志中,我得到了foo和bar的初始化消息,但是关于方法权限和JNDI名称的更多消息只针对foo:
[#|2010-05-10T12:26:13.234+0200|FINE|sun-appserver2.1|javax.enterprise.system.core.security|_ThreadID=25;_ThreadName=Thread-2821;ClassName=com.sun.enterprise.security.application.EJBSecurityManager;MethodName=initialize;_RequestID=1801c4ff-90fe-4406-aaac-219c669be8c1;|Codebase (module id for ejb Foo) = null|#]
[#|2010-05-10T12:26:11.625+0200|FINE|sun-appserver2.1|javax.enterprise.system.core.security|_ThreadID=25;_ThreadName=Thread-2821;ClassName=com.sun.enterprise.security.application.EJBSecurityManager;MethodName=initialize;_RequestID=1801c4ff-90fe-4406-aaac-219c669be8c1;|Codebase (module id for ejb Bar) = null|#]
[#|2010-05-10T12:26:13.234+0200|FINE|sun-appserver2.1|javax.enterprise.system.core.security|_ThreadID=25;_ThreadName=Thread-2821;ClassName=com.sun.enterprise.security.application.EJBSecurityManager;MethodName=fooMethod;_RequestID=1801c4ff-90fe-4406-aaac-219c669be8c1;|JACC DD conversion: EJBMethodPermission ->(Foo fooMethod,Remote,java.lang.Long,java.util.Locale)protected by role -> FOOUSER|#]
[#|2010-05-10T12:26:19.312+0200|INFO|sun-appserver2.1|javax.enterprise.system.container.ejb|_ThreadID=17;_ThreadName=httpWorkerThread-14848-1;|**RemoteBusinessJndiName: com.example.Foo; remoteBusIntf: com.example.Foo|#]
-
通过JNDI查找栏时出错
-
在GlassFish管理控制台中查看JNDI树时,根本不存在BAR。
-
同一模块中的其他EJB确实会出现,FOO也会出现。
-
关于foo的日志中有一些例外,但是在foo仍在工作时就已经出现了。
有什么可能导致这种情况或如何进一步诊断的想法吗?豆子很简单:
@Stateless(name = "Foo")
@RolesAllowed("FOOUSER")
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class FooImpl extends BaseBean implements Foo {
我对bar的部署描述符也有一些问题:我想消除它,但是Glassfish似乎不喜欢让bean只出现在sun-ejb-jar.xml中,或者让一些bean出现在描述符中声明的模块中,而其他的只使用注释。
编辑:
耳朵的结构如下:
AeApp.ear
AeApp.war
Foo.jar (Foo.class and FooImpl.class present here)
Bar.jar (Bar.class and BarImpl.class present here, also BaseBean.class)
(some more EJB module JARs)
(lots of library JARs)
aeapp.ear没有(而且afaik也从未有过,即使在工作时)META-INF/manifest.mf。其application.xml如下所示:
<application>
<description>AE EAR</description>
<display-name>AE EAR</display-name>
<module><ejb>Foo.jar</ejb></module>
<module><ejb>Bar.jar</ejb></module>
<module><ejb>Baz.jar</ejb></module>
<module><ejb>Doh.jar</ejb></module>
<module><web>
<web-uri>AeApp.war</web-uri>
<context-root>/</context-root>
</web></module>
</application>