我正在将一个大的J2EE应用程序(以下称为AeApp)从EJB 2转换为EJB 3(所有无状态会话bean,使用glassfish 2.1.1)并且用完了想法。glassfish中的JNDI/Classpath问题
我转换的第一个EJB(我们称之为Foo)运行时没有大问题(它是ejb-module中的唯一一个,我可以用注释完全替换部署描述符)并且应用程序运行良好。但是,将在第二个之后(我们称之为酒吧,其中一数不同的EJB模块中)存在的问题,一个奇怪的组合:
AeApp部署没有错误(没有在日志其一)。在日志中,我只得到了富初始化两个Foo和酒吧的消息,但有关方法的权限和JNDI名称进一步的消息:
[#|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完全不存在。
- 与Foo一样,同一模块中的其他EJB也会出现。
- 有关Foo的日志中有例外情况,但是它们在工作时已经出现。
任何想法可能会导致这种情况或如何进一步诊断?豆子是非常简单的:
@Stateless(name = "Foo")
@RolesAllowed("FOOUSER")
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class FooImpl extends BaseBean implements Foo {
我也有一些问题与酒吧部署描述符:我想消灭它,但GlassFish的似乎并不喜欢有一个bean只有在阳光下出现-ejb-jar.xml,或者在描述符中声明的模块中包含一些bean,而其他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不(据我所知,并从未有过的,甚至当它工作),一个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>
你能告诉你的耳朵的结构?据报道,XXX类失踪的地方在哪里?你能否提供允许重现的EAR的匿名版本? – 2010-05-09 12:44:06
@Pascal:我添加了一些关于EAR结构的信息。 XXX是一个匿名化的神器,它的意思是Foo,它出现在JAR中。我不认为我可以发布EAR,因为这是一个非常大的商业开发的应用程序 - 匿名它,而保留所有可能相关的东西将或多或少是不可能的。 – 2010-05-10 09:36:55
FooImpl扩展了BaseBean。如何将BaseBean.class添加到Foo的Classpath中? – 2010-05-10 11:06:19