Best approach for having Patient ID card in OpenMRS 2x and RefApp 2x

Check for the error in the tomcat logs.

@dkayiwa: when i click on edit or add button, only one line of log text is added to localhost_access_log.2017-03-02.

0:0:0:0:0:0:0:1 - - [02/Mar/2017:16:19:18 +0430] “GET null null” 400 -

Other log files are updated.

Without looking at the full contents of the logs, i cannot tell what is going on. May be someone else. :slight_smile:

here is the full log text of catalina.2017-03-02.log 02-Mar-2017 08:01:45.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/9.0.0.M17 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jan 10 2017 20:59:20 UTC 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 9.0.0.0 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jre1.8.0_121 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_121-b13 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Program Files\Apache Software Foundation\Tomcat 9.0 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 9.0 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 9.0 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\logging.properties 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m 02-Mar-2017 08:01:45.085 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\wamp64\bin\php\php5.6.25;C:\ProgramData\ComposerSetup\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;. 02-Mar-2017 08:01:45.959 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [“http-nio-8080”] 02-Mar-2017 08:01:46.568 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 02-Mar-2017 08:01:46.584 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [“ajp-nio-8009”] 02-Mar-2017 08:01:46.584 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 02-Mar-2017 08:01:46.584 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 3233 ms 02-Mar-2017 08:01:46.646 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina 02-Mar-2017 08:01:46.646 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.0.M17 02-Mar-2017 08:01:46.724 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\openmrs.war 02-Mar-2017 08:01:46.771 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property ‘antiJARLocking’ to ‘true’ did not find a matching property. 02-Mar-2017 08:02:08.817 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 02-Mar-2017 08:18:55.208 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\openmrs.war has finished in 1,028,468 ms 02-Mar-2017 08:18:55.224 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\docs 02-Mar-2017 08:18:55.755 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\docs has finished in 531 ms 02-Mar-2017 08:18:55.817 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\manager 02-Mar-2017 08:18:56.536 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\manager has finished in 719 ms 02-Mar-2017 08:18:56.536 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT 02-Mar-2017 08:18:56.692 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\ROOT has finished in 156 ms 02-Mar-2017 08:18:56.724 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [http-nio-8080] 02-Mar-2017 08:18:56.833 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-8009] 02-Mar-2017 08:18:56.849 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1030279 ms 02-Mar-2017 08:22:46.434 INFO [http-nio-8080-exec-4] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:458) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:377) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:767) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1347) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)

Can you just zip the entire logs folder and attach it here?

Ahhhh… it was an issue with tomcat version.

java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

Because there is | and ‘{‘, ‘}’ character or some other character which is not supported in URL query string by newer versions of Tomcat. Therefore, it throws above exception.

The URL had the pipe “|” character in query string which is causes this issue in new versions of tomcat.

I used Tomcat 9.0.0.M17, tomcat 8.5.11 and tomcat 7.0.75 , i faced same URL encoding issue. I used the lower version of tomcat (Tomcat 8.5.6) and now it is working fine.

Please share it with other developers to take care of this strict URL validation issue in newer versions of Tomcat.

Thank you, HPardess

1 Like

Very useful feedback! Thank you so much @hpardess for sharing the solution. Keep up the great spirit! :slight_smile:

@dkayiwa: Which version of tomcat do you use in test servers?

We use tomcat 7

@dkayiwa: what is the minor version?

I faced another issue with XReports

SEVERE [http-nio-8080-exec-9] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [module_servlet] in context with path [/openmrs] threw exception [Servlet execution threw an exception] with root cause java.lang.NoClassDefFoundError: org/openmrs/module/reporting/dataset/definition/DataExportDataSetDefinition

I checked your github commits (Fixing NoClassDefFoundError - DataExportDataSetDefinition) and I found that you have already fixed it in v1.6 but it is released in Modules.

I failed to log in at modulus. You can download it from jfrog at https://openmrs.jfrog.io/openmrs/modules/org/openmrs/module/xreports-omod/1.6/xreports-omod-1.6.jar

Remember to rename the downloaded file to xreports-1.6.omod before installing.

How can i have a dedicated link for ID card in Patient dashboard. When i click, it should directly open the Patient ID Card in PDF format and also i should have patient summary link which will print a report with detailed information about patient.

Go to the settings page as here: http://qa-refapp.openmrs.org/openmrs/admin/maintenance/settings.list?show=Xreports and set the value of the reportId for “Patient Summary Report Id” You can copy the reportId value from the url for the manage reports page as here: http://qa-refapp.openmrs.org/openmrs/xreports/report.page?reportId=5&groupId=&

I have also just uploaded the module to modulus. This time i was able to login.

Thank you @dkayiwa. With XReport v1.6, I can design the report without any problem.

If I set the reportId of any report for “Patient Summary Report Id”, then that report will be desplayed when i click on “Patient Summary”.

But I want to keep the existing “Patient Summary” as it is and add a new menu item/link for “Patient ID Card” just above the “Patient Summary”.

Do you want to print this for a group of patients? Or for one patient at a time?

For one patient at a time. So the link to print the ID should be in patient dashboard.

Here I have created a sample of Patient ID card (It may help another implementor to do less work to desing)

Data Set Definition (SQL Query)

SELECT GROUP_CONCAT(patient_identifier.identifier SEPARATOR ‘,’), (SELECT identifier FROM patient_identifier WHERE patient_identifier.patient_id = person.person_id AND identifier_type=1 AND voided=0 AND preferred=1) AS identifier1, (SELECT identifier FROM patient_identifier WHERE patient_identifier.patient_id = person.person_id AND identifier_type=2 AND voided=0 AND preferred=1) AS identifier2, (SELECT identifier FROM patient_identifier WHERE patient_identifier.patient_id = person.person_id AND identifier_type=3 AND voided=0 AND preferred=1) AS identifier3, DATE(person.date_created) AS register_date, given_name, family_name, birthdate, gender FROM person, person_name, patient_identifier WHERE person.person_id = 7 AND person.person_id=person_name.person_id AND person.person_id=patient_identifier.patient_id AND person.voided=0 AND person_name.voided=0 AND patient_identifier.voided=0 AND person_name.preferred=1 AND patient_identifier.preferred=1 AND patient_identifier.identifier_type=3 LIMIT 1;

XReport Patient-ID-Card.xml.txt (3.9 KB)

@hpardess i have updated the documentation at https://wiki.openmrs.org/display/docs/XReports+Module+User+Guide with how to add more custom reports to the patient dashboard. You can see it in action on this page http://qa-refapp.openmrs.org/openmrs/coreapps/clinicianfacing/patient.page?patientId=c117c842-9437-4d02-a9b8-74b76650eca8 where the Patient Summary report is different from the ID Card one.

You will need to use version 1.7 of the module which you can get from this download url: https://openmrs.jfrog.io/openmrs/modules/org/openmrs/module/xreports-omod/1.7/xreports-omod-1.7.jar

After downloading , you will need to rename the file “xreports-omod-1.7.jar” to “xreports-1.7.omod” before you can install it.

By the way, i like your desire to share what you have done with other implementers. Please keep it up. :smile:

Thank you so much @dkayiwa .

Thanks for a very useful thread. Have you considered including a barcode on the id card?