New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find autostart amx option in Glassfish 7 #24762
Comments
About the 8 times system out __defaultContextService, it is coming from:
the stack:
JmxMBeanServer just returns the InstanceAlreadyExistsException to glassfish code: Line 53 in 61f6b51
which does: Line 56 in 61f6b51
this could use some logger instead. AMXConfigImpl -> uses java.util.logging.Logger Not sure how this should be fixed. I would use the AMXConfigImpl approach in AMXConfigLoader as well. |
AMX in GF will need quite radical maintenance, it seems to me that the code is in a "prototype state" for some 20 years.
|
Hi, I'll answer the initial question whether AMX can be enabled on boot. GlassFish doesn't support the boot AMX at startup option. This was added to Payara but haven't been added back to GlassFish yet. You can boot AMX by accessing the JMX server remotely, then AMX starts automatically. If you connect to the JMX server locally, you also need to run the bootAMX action on a GlassFish JMX bean via the JMX connection, for example with this Java code:
|
Hi @escay , the "IllegalArgumentException: ResourceRef refers to non-existent resource: " message is logged because it seems there's an error in your domain.xml file. Some server in the P.S. I admit that the error message could be improved to explain what actually is wrong and how to fix it. And it should be logged as a Warning, not an INFO message. |
I tried a breakpoint at the "ResourceRef refers to non-existent resource" in org.glassfish.admin.amx.impl.j2ee.RegistrationSupport.processResourceRef(ResourceRef) but I could not figure out which resource was being looked at. I will have a look again with this knowledge. The manual startup in my code using the bootAMX invoke is working fine for last 2 weeks, it is a good workaround. I will make a pull request for solving the System out logging improvement. |
I can confirm the "IllegalArgumentException: ResourceRef refers to non-existent resource" was coming from an incorrect resource-ref: Changing the org.glassfish.config.support.GlassFishConfigBean code to list the attributes:
Makes the exception a bit more informative to log the ref="jdbc/sample" and maybe gives a hint this way to the domain.xml.
I do not know what the impact is of changing the GlassFishConfigBean toString method. |
…oggerInfo instead instead of System.out. Removed all debug System out methods to avoid using them in the future. No system.out used anymore in amx-core module.
…istent resource" exception by logging the attributes of the ResourceRef that was incorrect.
I created 2 commits.
Both do not solve or implement the autostart, they only improve the error messages I encountered. Both do not contain tests. Ideally I would have added a unit test for the 2nd item. But I could not figure out how to load a domain.xml in a unit test and perform the same code as AMX is doing in the stacktrace above. could not figure out how Junit5 extension org.glassfish.config.api.test.ConfigApiJunit5Extension was supposed to work, the code does not seem to be in use, but it seems a basis to load a domain.xml. Let me know if I should make pull requests for these two commits or not. |
You can put both commits into a single PR, they are both related and if we would create a PR for every commit, GlassFish would never move - any help is welcome. The PR will be checked by Jenkins and if it would not break any of existing thousands of tests and it would pass also manual review, we will merge it. I quickly looked over both commits and I think it is certainly a step forward, thank you! |
…oggerInfo instead instead of System.out. Removed all debug System out methods to avoid using them in the future. No system.out used anymore in amx-core module. Improves "ResourceRef refers to non-existent resource" exception by logging the attributes of the ResourceRef that was incorrect.
Fixes issue #24762 Use AMXLoggerInfo io System.out and add attribute info in toString method.
Environment Details
Problem Description
Coming from Payara 5 and 6 I can enable amx automatically on startup using
<amx-configuration enabled="true"></amx-configuration>
in domain.xml
However in Glassfish 7 I cannot seem to find such an option.
Via jconsole I can see the amx-support MBean and I can select the bootAMX() operation to start amx.
In the administration guide:
https://glassfish.org/docs/7.0.10/administration-guide.html#using-rest-interfaces-to-administer-glassfish-server
I can see a minimal mention of amx.
The goal I would like to achieve:
amx:pp=/domain/configs/config[server-config],type=transaction-service
for attributeTimeoutInSeconds
Steps to reproduce
Deploy ear file, call java.lang.management.ManagementFactory.getPlatformMBeanServer();
Perform query to "amx" object.
Object
amx:pp=/domain/configs/config[server-config],type=transaction-service
not found due to amx not being started.Workaround start amx from the ear file using MBeanServer like:
Impact of Issue
Main question really is:
-- But it adds quite some overhead to get some server information from within the ear file.
Logging issue
When starting AMX in a clean domain you get errors / exceptions in INFO messages:
IllegalArgumentException: ResourceRef refers to non-existent resource: GlassFishConfigBean.com.sun.enterprise.config.serverbeans.ResourceRef
however AMX Startup completed and amx MBeans are available and can be used.
Workaround to hide these messages is to change logging.properties to change existing line:
jakarta.enterprise.system.tools.amx.level=INFO
to
jakarta.enterprise.system.tools.amx.level=WARNING
but this will hide the
AMX Startup Service: AMX ready for use
message as well.
And I get some System.out log lines 8 times the same __defaultManagedThreadFactory already exists exception, which I would not expect:
Ideally these should be behind some log level.
The text was updated successfully, but these errors were encountered: