Skip to content
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

MBean registration / Ignore existing #5670

Closed
wants to merge 6 commits into from
Closed

Conversation

fxprunayre
Copy link
Member

@fxprunayre fxprunayre commented May 7, 2021

When running multiple GeoNetwork on same Jetty, the following error will happen on startup

2021-05-04 14:30:51,431 ERROR [jeeves] - JeevesContextLoaderListener:
Error creating bean with name 'org.fao.geonet.camelPeriodicProducer.MessageProducerFactory#0': 
Invocation of init method failed; nested exception is org.quartz.SchedulerException: 
Unable to register scheduler with MBeanServer. [See nested exception: javax.management.InstanceAlreadyExistsException:
 quartz:type=QuartzScheduler,name=DefaultQuartzScheduler-harvest-wfs,instance=NON_CLUSTERED]

and one of the web app will not be available.

Using IGNORE_EXISTING registration policy seems to solve the issue but is maybe not the perfect fix ?

It looks like progress status are mixed up between apps. So maybe some progress indicator ids should contain webapp name or node uuid ?

image

@cmangeat any experience on this ?

@fxprunayre fxprunayre added this to the 4.0.5 milestone May 7, 2021
@fxprunayre fxprunayre modified the milestones: 4.0.5, 4.0.6 Jun 18, 2021
@fxprunayre
Copy link
Member Author

fxprunayre commented Jun 30, 2021

Looks to also happen on Links API even with one webapp

Error creating bean with name 'linksApi': Invocation of init method failed;
 nested exception is org.springframework.jmx.export.UnableToRegisterMBeanException: 
Unable to register MBean [org.fao.geonet.api.links.EmptySlot@5185dd60] 
with object name [geonetwork:name=url-check,idx=empty-slot-0]; nested exception is 
javax.management.InstanceAlreadyExistsException: geonetwork:name=url-check,idx=empty-slot-0

Not sure why ?

When running multiple GeoNetwork on same Jetty, the following error will happen on startup
```
2021-05-04 14:30:51,431 ERROR [jeeves] - JeevesContextLoaderListener: Error creating bean with name 'org.fao.geonet.camelPeriodicProducer.MessageProducerFactory#0': Invocation of init method failed; nested exception is org.quartz.SchedulerException: Unable to register scheduler with MBeanServer. [See nested exception: javax.management.InstanceAlreadyExistsException: quartz:type=QuartzScheduler,name=DefaultQuartzScheduler-harvest-wfs,instance=NON_CLUSTERED]
```
and one of the web app will not be available.

Using IGNORE_EXISTING registration policy seems to solve the issue but is maybe not the perfect fix ?
…n't make it work. In debug mode evaluating servletContext.getContextPath works fine even on the MockServletContext, so not sure why the exception is triggered.
…irectly, let spring autowire beans properly.
@juanluisrp
Copy link
Contributor

juanluisrp commented Nov 9, 2021

It happened to me running just one GeoNetwork 4 instance using mvn jetty:run and going to the Swagger document geonetwork/srv/api/doc. It seems that Swagger tries to create again a new LinksApi bean and the PostConstruct method is executed again

@PostConstruct
public void iniMBeansSlidingWindowWithEmptySlot() {
for (int i = 0; i < NUMBER_OF_SUBSEQUENT_PROCESS_MBEAN_TO_KEEP; i++) {
EmptySlot emptySlot = new EmptySlot(i);
mAnalyseProcesses.addFirst(emptySlot);
try {
mBeanExporter.registerManagedResource(emptySlot, emptySlot.getObjectName());
} catch (MalformedObjectNameException e) {
e.printStackTrace();
}
}
}
and a javax.management.InstanceAlreadyExistsException: geonetwork:name=url-check,idx=empty-slot-0 is thrown.

@jahow jahow modified the milestones: 4.0.6, 4.0.7 Feb 2, 2022
@fxprunayre
Copy link
Member Author

Added with #6188

@fxprunayre fxprunayre closed this Mar 31, 2022
@fxprunayre fxprunayre deleted the 405-mbean-registration branch May 4, 2022 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants