[GLASSFISH-18320] [Regression] Addition of AdminConsoleStartupService broke EJB embedded Container Created: 03/Feb/12  Updated: 23/Apr/15

Status: Reopened
Project: glassfish
Component/s: admin
Affects Version/s: 4.0
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: marina vatkina Assignee: sirajg
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: javaee_ri_target


EJB embeddable container suppresses services that won't be necessary for regular testing of local EJBs. One of such services is a Web container. We do it by modifying domain.xml on the fly and using that temporary version during the run.

02/03/2012 hudson build (http://hudson-sca.us.oracle.com/job/ejb-devtests-v3/623/) failed with

java.lang.IllegalStateException: Can't operate without at least one <network-listener>
[java] at com.sun.enterprise.config.util.ServerHelper.getAdminListener(ServerHelper.java:164)
[java] at com.sun.enterprise.config.serverbeans.Config$Duck.getAdminListener(Config.java:460)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.jvnet.hk2.config.Dom.invokeDuckMethod(Dom.java:961)
[java] at org.jvnet.hk2.config.Dom.invoke(Dom.java:914)
[java] at org.glassfish.config.support.TranslatedConfigView.invoke(TranslatedConfigView.java:131)
[java] at $Proxy30.getAdminListener(Unknown Source)
[java] at com.sun.enterprise.v3.admin.adapter.AdminEndpointDecider.setValues(AdminEndpointDecider.java:118)
[java] at com.sun.enterprise.v3.admin.adapter.AdminEndpointDecider.<init>(AdminEndpointDecider.java:84)
[java] at com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter.init(AdminConsoleAdapter.java:507)
[java] at com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter.postConstruct(AdminConsoleAdapter.java:465)

To reproduce (assuming v2/appserv-tests lib/ and config/ are checked out):
cd v2/appserv-tests/devtests/ejb/ejb31/embedded
ant all-report

Comment by Tom Mueller [ 07/Feb/12 ]

Do you know when this broke? The recent changes to AdminConsoleAdapter do not change this code that eventually calls ServerHelper.getAdminListener, and ServerHelper hasn't changed since last July.

Can you provide the details of the changes you make to domain.xml. From the exception, it appears as though the admin-listener network-listener has been removed.

Comment by Tom Mueller [ 07/Feb/12 ]

Masoud, this is actually a zero-config issue. Here, we have a situation where the embedded tests have removed the network listener named "admin-listener" and the server (in AdminConsoleAdapter) throws an exception because of it. I expect AdminAdapter would also have a problem here.

We need a design decision here as to whether some minimal configuration is required to have the admin interface (on port 4848) come up or whether it should come up by default if the config information isn't there. I would think that we would want to be able to configure a server that doesn't have an admin interface but this should be discussed.

Comment by marina vatkina [ 07/Feb/12 ]


The test started failing on 02/03/2012 (8am). So the change was made in the 24 hours prior to that.

Embedded EJB container is intended for testing EJBs so should start fast and have the least possible outside containers started (e.g. unless a WAR file is being deployed, the web container should not start). You can find all the transformations that are done in ejb/ejb-container/src/main/java/org/glassfish/ejb/embedded/DomainXmlTransformer.java. They were discussed back then with Jerome and Ken Saks.

Also note that there is no way to get currently to the GlassFish API when using embeddable EJB container (http://docs.oracle.com/javaee/6/api/javax/ejb/embeddable/EJBContainer.html).

Comment by Tom Mueller [ 08/Feb/12 ]

The root cause of this was the addition of the AdminConsoleStartupService which was added to the trunk on 2/2/12 in revision 52405.

Assigning to Siraj for an immediate fix since this is breaking the embedded EJB tests.

Siraj, the AdminConsoleStartupService must take into account a configuration where no admin-listener is configured. With the current implementation, AdminConsoleStartupService eventually causes a call to ServerHelper.getAdminListener which throws an exception if there is no admin listener configured. AdminConsoleStartupService needs to handle this exception.

This fix is needed on the trunk.

Comment by sirajg [ 09/Feb/12 ]

The test passes in 3.1.2. In the embedded case, the adapter code is not invoked in 3.1.2, but it is invoked on the trunk.

Comment by sirajg [ 13/Feb/12 ]

Handle the case when no network listeners are found. Revision 52563

Comment by marina vatkina [ 15/Mar/12 ]

The latest change to ServerHelper broke it again

Generated at Sun Jan 22 03:56:05 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.