We’re using an EndTB release of Bahmni (I think version 0.89?) and are experiencing issues when running reports.
Whenever we run reports, we’re shown a ‘There was an unexpected issue on the server. Please try again. Error in scheduling report’ error message, and the reports fail to download. I’ve had a look at the JS console in Chrome, and it states that the request to
schedule returns a 500 error.
The GET request is as follows:
The response shows that a
org.springframework.beans.factory.UnsatisfiedDependencyException exception is thrown, with the following message:
Unsatisfied dependency expressed through field 'scheduler': Error creating bean with name 'scheduler' defined in class path resource [org/bahmni/reports/scheduler/QuartzConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.quartz.SchedulerFactoryBean]: Factory method 'scheduler' threw exception; nested exception is java.lang.RuntimeException: Cannot start scheduler:-; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in class path resource [org/bahmni/reports/scheduler/QuartzConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.quartz.SchedulerFactoryBean]: Factory method 'scheduler' threw exception; nested exception is java.lang.RuntimeException: Cannot start scheduler:
The stack trace is as follows:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘reportsScheduler’: Unsatisfied dependency expressed through field ‘scheduler’: Error creating bean with name ‘scheduler’ defined in class path resource [org/bahmni/reports/scheduler/QuartzConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.quartz.SchedulerFactoryBean]: Factory method ‘scheduler’ threw exception; nested exception is java.lang.RuntimeException: Cannot start scheduler:-; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘scheduler’ defined in class path resource [org/bahmni/reports/scheduler/QuartzConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.quartz.SchedulerFactoryBean]: Factory method ‘scheduler’ threw exception; nested exception is java.lang.RuntimeException: Cannot start scheduler:-
– Redacted due to space limitations –
I can’t add the whole stacktrace to this post, so I’ve added it to a pastebin: https://pastebin.com/Bygrvfh5
I’ve tried restarting the services in case it was just some random bug, but it hasn’t made any difference.
Is there anything I can do to resolve this? I don’t think we’ll be able to upgrade our Bahmni installation at this point.
Please let me know if there’s anything else I can provide.
Thanks in advance,
Bump. Does anyone have any ideas on what I can do to resolve this?
Any assistance would be greatly appreciated.
@judeniroshan Do you have any idea about this Report problem?
I haven’t worked with Bahmni distribution. But as for the exception trace, it is clear that some bean configuration has messed up. Please check with this particular class name bean has properly defined in the server module.
Error creating bean with name 'scheduler' defined in class path resource [org/bahmni/reports/scheduler/QuartzConfiguration.class]
Technically speaking, it means, a “Scheduler” instance is not being injected (by Spring) to ReportScheduler!
Now, this “Scheudler” instance should be automatically created by the creation of “SchedulerFactoryBean” at the very startup.
Can you stop the service, backup the old log file (/var/log/bahmni-reports/bahmni-reports.log) and start it again and pull up the entire log in a gist?
service bahmni-reports restart
Thanks so much for your responses, it is greatly appreciated.
Please find the gist here: https://gist.github.com/xtrasimplicity/6e88667de3d868f9006781d008d28a70
Looking at the logs, it looks like it is trying to access an SQL database named
bahmni_reports, and the only database that exists on the server is
openmrs, so it looks like there was an issue during installation and the database wasn’t created.
Given this site is in production, is there any recommended way to recreate just this database? Or is it best to bring the site offline, make a backup of the openmrs database, re-install and restore the SQL backup?
The database just keeps the scheduled report info.
Can you check the inventory file? (I am assuming that you are using the bahmni installer program, and not directly installing rpms)
Check whether there are any entry in the “bahmni-reports-db”. something like
I am guessing the entry is empty, and possibly explains why the database was not created.
If this is so, then you can modify the inventory file (local) and re run the bahmni installer program.
Now considering its production site, obviously you should take necessary precautions
@senthilrajar, can you please comment ?
I can think of
- Backup - all dbs, configs, logs, inventory and setup config files ( /etc/bahmni-installer/local, /etc/bahmni-installer/setup.yml). any additional modules etc.
- Do it only after work hours
- resintall reports
bahmni -i local --only bahmni-reports install
The above should install only the reports. @senthilrajar will this reinstall EMR component as well?
Also, when was the –only option introduced, is this available for v0.88?
- Try this out on your local setup first.
- If you active-passive setup in production, try this on passive first (remember to setup database sync once you install on active as well) - you can control this via the inventory and setup.yml file.
More info on advance installation here: https://bahmni.atlassian.net/wiki/pages/viewpage.action?pageId=35291242
Let us know if you need more help.
Yeah, the inventory file has the database server listed under the
We do have an Active/Passive setup, but it doesn’t look like uploaded files (i.e. for dcm4chee) are synchronised between the active and passive web servers, so I’m thinking it might be easiest to set up a new VM (alongside this one), install Bahmni from scratch all on the one VM, put the production site in maintenance mode and then restore the production SQL backup to the new VM. I’ll need to check with my colleagues to see whether they’re comfortable with me switching from Active/Passive clustering to a single VM, first, though.
I’ll keep you updated.
Thanks once again!
if I am right, you don’t use Dcm4Chee (PACS) for endTB.
If you just backup the listed items - dbs, configs, logs, inventory and setup config files and patient images directories etc, you should be ok to run upgrade or only rerun bahmni-reports installation.
Bahmni installer will keep all your settings and data intact during a reinstall and upgrade, but backups are
You can take the passive box, restore dbs and other files and rerun the installations. This will mean that the active is still usable by users.
Then make passive as active - change IP address, name controller changes (if you are using any). So now the passive becomes the active.
Then run upgrade on old active, if everything works, set this as passive - you will have to reset the position markers for the database syncs though.
Alternatively, your single VM is also fine, but you wouldn’t have automatic data replication in the passive. or redundancy in your setup.
NOTE: One of our implementations also use a blue-green deployment. I don’t know if makes sense for you to consider for future.
Thanks for that. I’m not 100% familiar with how this all works, so I appreciate the clarification re: Dcm4Chee.
I’ve been advised that we’re having this report issue on some non-HA vagrant VMs, too, so I’m currently setting up a new test environment from scratch to see whether I can replicate it.
Thanks once again!
I’ve just reinstalled Bahmni using
bahmni -i remote install but it doesn’t appear to have made any diference. I have another idea which I’ll try and will report back once I’ve tested it out.
Any further feedback you can provide in the mean time would be greatly appreciated, however.
Thanks once again!
I’ve had some strange issues with running
/usr/bin/bahmni-batch on Bahmni endTB 1.5.0 (Bahmni 0.85), and have ended up having to symlink
/etc/bahmni-installer/bahmni-emr-installer.conf to allow the final installation step to complete. I have been able to reproduce this error numerous times on multiple freshly-installed Vagrant VMs.
When I follow the historical version of the instructions, without symlinking
bahmni-emr-installer.conf, I get the following error:
[bahmni@bahmni01 root]$ /usr/bin/bahmni-batch
/usr/bin/bahmni-batch: line 3: /etc/bahmni-installer/bahmni-emr-installer.conf: No such file or directory
If I create the symlink,
/usr/bin/bahmni-batch works, but OpenMRS freezes at:
01-09-2017 11:37:30 [INFO ] HibernateSessionFactoryBean - Building new Hibernate SessionFactory
I’ve uploaded a gist for this, here.
It looks like it may be caused by an external dependency being updated, so I suppose upgrading to the latest version of endTB (or merging back into the Bahmni master branch, if the endTB branch has been merged) may resolve this?
If so, is it possible to restore endTB 1.5.0 SQL and patient data backups onto a fresh endTB 2.0 installation, or would I need to perform a manual upgrade from 1.5.0 to 1.5.1, and then to 2.0.3?
Would you like me to ask this in a new thread?
Thanks once again for all of your assistance so far.
I was able to resolve this issue, by creating the bahmni_reports database and adding the structure from a freshly-deployed Bahmni 0.85 vagrant box.
Step by step, I did the following:
- Retrieved my
reports SQL credentials from
- SSH’d into the database server, logged into MySQL using these credentials:
mysql -u reports_root_user -p
- Created the
bahmni_reports database, using:
create database `bahmni_reports`
- Exited the MySQL console, using
- Pasted the SQL dump for the DB structure into a file, say,
- Imported the dump into the
mysql -u reports_root_user -p bahmni_reports < bahmni_reports_structure.sql
- Restarted bahmni-reports:
sudo service bahmni-reports restart
This issue was also fairly helpful.