Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
When starting tomee with openejb.offline=true, the openejb application fails to deploy since it can not find a singleton container - even if one is defined in tomee.xml.
Stack Trace
INFO - Configuring Service(id=MyStatelessContainer, type=Container, provider-id=Default Stateless Container) INFO - Configuring Service(id=MyStatefulContainer, type=Container, provider-id=Default Stateful Container) INFO - Configuring Service(id=MySingletonContainer, type=Container, provider-id=Default Singleton Container) INFO - Configuring Service(id=MyManagedContainer, type=Container, provider-id=Default Managed Container) INFO - Using 'openejb.system.apps=true' SEVERE - FATAL ERROR: Unknown error in Assembler. Please send the following stack trace and this message to users@tomee.apache.org : java.lang.IllegalStateException: system application (openejb) needs a singleton container. Noone is defined and container is in offline mode. Please define one in tomee.xml. at org.apache.openejb.config.SystemAppInfo.findSingletonContainer(SystemAppInfo.java:134) at org.apache.openejb.config.SystemAppInfo.preComputedInfo(SystemAppInfo.java:43) at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:559) at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:627) at org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:500) at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:479) at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150) at org.apache.openejb.OpenEJB.init(OpenEJB.java:307) at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:266) at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:168) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:115) at org.apache.catalina.startup.Catalina.load(Catalina.java:606) at org.apache.catalina.startup.Catalina.load(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Possible fix
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/SystemAppInfo.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/SystemAppInfo.java @@ -126,7 +126,7 @@ public final class SystemAppInfo { // simplified logic compared to AutoConfig private static String findSingletonContainer(final ConfigurationFactory configFactory) throws OpenEJBException { for (final ContainerInfo containerInfo : configFactory.getContainerInfos()) { - if (SingletonSessionContainerInfo.class.isInstance(configFactory)) { + if (SingletonSessionContainerInfo.class.isInstance(containerInfo)) { return containerInfo.id; } }