Unable to build-up jasper report on Glassfish
Hi, hope you can help me.
I installed the JRI in a Glassfish server. The war file is deployed automatically in the server, so I did not run the file startup.cmd, which seems to set up the root directory in the OC_JASPER_CONFIG_HOME variable .
After installing, I was able to run the test.jasper report (report to test, that comes in installation package) through the http:
But, when I try to generate the report from Apex I get this error.
StandardWrapperValve[ReportWrapper]: Servlet.service() for servlet ReportWrapper threw exception
java.lang.RuntimeException: Class not found when loading object from file: C:\......
One thing I noted is that the path in the error message is referring a local path and not to the server path
Can anyone help me with this?
Thanks in advance.
Hi, you have two options here:
- set it using an enviroment variable (either in the system itself or in the script that will start Glassfish I guess): https://github.com/daust/JasperReportsIntegration/blob/main/src/doc/github/installation-full.md#21-configure-the-server-environment-using-an-operating-system-environment-variable
- set it by setting a parameter in the jri.war file similar to how ords.war is configured: https://github.com/daust/JasperReportsIntegration/blob/main/src/doc/github/installation-full.md#22-configure-the-setting-in-the-webxml-file-of-the-jriwar-file
Good luck
Thank you very much for your quick response.
Could you please clarify me, exactly why this error occurs?, because I have checked the path and it seems to be ok, c:\somefolders\WEB-INF\conf\application.properties so I should not have to set the directory in the OC_JASPER_CONFIG_HOME variable.
thanks!
Would have to troubleshoot this. But not really worth the effort. Typically, setting NO path explicitly is typically not used.
There might be a bug ... but using the configuration and reports in the deployed web application is not a good idea anyway, for security purposes and for practical reasons. E.g. when you redeploy the application as part of an upgrade, you might lose the configuration.
Separation of directories is advised here.
Hi, the error persist. Any suggestion please?
As I have pointed out before ... the documented and supported way to use it is one of the two options:
-
set it using an enviroment variable (either in the system itself or in the script that will start Glassfish I guess): https://github.com/daust/JasperReportsIntegration/blob/main/src/doc/github/installation-full.md#21-configure-the-server-environment-using-an-operating-system-environment-variable
-
set it by setting a parameter in the jri.war file similar to how ords.war is configured: https://github.com/daust/JasperReportsIntegration/blob/main/src/doc/github/installation-full.md#22-configure-the-setting-in-the-webxml-file-of-the-jriwar-file
Good luck
Hi, I created the environment variable and the error persist.
First I did set the variable with the path where the reports are located like OC_JASPER_CONFIG_HOME=c:\Mydirectory\JasperReportsIntegration Then I try to run the report with the URL http://mydomain:myport/JasperReportsIntegration/report?_repName=myReport&...... And it did not work, the same error is generated.
Then I changed the path in the variable, set it to the path where the libraries are located and it didn't work either. OC_JASPER_CONFIG_HOME=c:\Mydirectory\applications\JasperReportsIntegration\WEB-INF And it did not work
Is there any possibility that the error is generated by the incompatible version of Glassfish, or is there a library required?, because the test.jasper report works fine.
Thanks for your support.
Ok, here is something quick you can try.
Make sure you set the environment in the SYSTEM environment, NOT THE USER ENVIRONMENT!

I assume you will be running it as a service, thus, the environment for the system account needs to be set.
Not everything is being picked up by the startup scripts. But you didn't give me enough details to make a distinction here.
BTW, provide more meaningful details:
- operating system and version
- Glassfish version
- How you run it ... as service or via batch scripts
Thank you, Dietmar.
Hi, thanks for keeping in contact
Variable was created as an environment variable , not as user environment. (as shown in the image)
- Windows server 2008 R2 Standard
- GlassFish Server Open Source Edition 4.1
- Glassfish runs as a service. You mean Glassfish, right?
Question. Where do I get the path where the JAR libraries are located, since the environment variable is only set with the path where the files reside. If I preview the report in the JasperStudio application, the report is displayed without errors and with all the data. But if I run it through the URL, this error is generated.
btw. Now I understand what you mean it is better to create a system variable than to modify the web.xml file by running the setConfigDir.cmd file, because I ran it and I had to reconfigure the application.properties file.
This is the full error message in Glassfish

Thanks
Something is off. The error message says "class not found" and not "file not found". This is weird.
Variable was created as an environment variable , not as user environment. (as shown in the image) You did restart the machine, though? Else the changed path will not be picked up.
I will download Glassfish and give it a try.
And you are using the latest integration, at least 2.10.0, right?
I'm using this version JasperReportsIntegration-2.4.0.0 . So, should I upgrade the version? is it worth it?
bdw. I let you know the version of JasperStudio I'm using TIBCO Jaspersoft® Studio 6.20.0 - Many thanks.
is it worth it?
Only if you want it working without error ;).
Yes, a ton of new features. Also, the reports you compile with current tibco studio cannot run because the integrated engine in 2.4.0 is way too old.
I just downloaded Glassfish 4.1 and used it on Win10 with JDK 8 without any issues. Picked up the environment variable immediately. Didn't run it as a service, though.

My batch file to start the server:
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_333
set PATH=%JAVA_HOME%\bin;%PATH%
java -version
javac -version
cd /d C:\Programme-Manuell\glassfish-4.1\glassfish4\glassfish\bin
call startserv.bat
cmd /k
Works right off the bat.
Thanks a lot for taking the time to try with Glassfish.
So, I'm going to re-install JRI with the latest version.
Please confirm if these are the steps you did to Install JRI with glassfish. Most probably, I'm doing something wrong
-
Download the latest JRI version 2.10.0
-
Copy the jri.war in the c:\glassfish4\glassfish\domains\domain1\autodeploy
-
Then it going to deploy automatically and create the follow structure in this path c:\glassfish4\glassfish\domains\domain1\applications

-
Then modify the file application.properties with the database connection information
-
Re-start the glassfish server
Question. About the system variable. I have to do it at the first step? and if is so. Can you tell me how exactly you did this? because I'm sure that I'm doing something wrong here. Have you created a system variable or have you modified the web.xml file?
And, Another thing is not clear for me is the path for the glassfish part and the path where the reports will be located, So, I have to create a different folder for the reports? , because It is not good to use the same path that was created in the above point 3?, that means glassfish, right? And then, I have to set the OC_JASPER_CONFIG_HOME variable with this new path where the reports are going to be located, right?
btw.
I don't have a problem loading the website.

The problem is generated when the report is generated through PLSQL objects, e.g. XLIB_HTTP, XLIB_JASPERREPORTS packages. Then it returns an error from glassfish.
The problem is generated when the report is generated through PLSQL objects, e.g. XLIB_HTTP, XLIB_JASPERREPORTS packages. Then it returns an error from glassfish.
This is the process From Apex we call the JasperIntegration procedures, we build the URL based on the parameters that the report requires, domain, port, path where the reports are located, and what the XLIB_JASPERREPORTS.get_report procedure returns is an error from glassfish and not the PDF report that we then store in a table.
Thanks!!!
Just follow the installation instructions, it is all there: https://github.com/daust/JasperReportsIntegration/blob/main/src/doc/github/installation-full.md#install.installation.installJ2EE.1
If you want to use the System environment instead of changing the jri.war file through the provided scripts (which also works fine):
- Define
OC_JASPER_CONFIG_HOMEin the System environment as discussed above - Restart the machine
Then follow the installation process.
Good luck, many others have succeeded before you ;). But compiling reports with a new version of JasperSoft Studio and running it on an older engine doesn't work. This is the reason why the test.jasper works ... it is compiled for the old version.
Ok. I'll try. Thank you very much.
Hi, not successful :(
I did all steps which are in the documentation and now not even I can deploy the jri.war.
This is the error in the glassfish
[2023-02-05T15:31:51.185+0100] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-02036] [javax.enterprise.system.tools.deployment.autodeploy] [tid: _ThreadID=100 _ThreadName=AutoDeployer] [timeMillis: 1675607511185] [levelValue: 900] [[ Error occurred during deployment: Exception while deploying the app [jri] : org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 4; Deployment descriptor file WEB-INF/web.xml in archive [jri]. The element type "description" must be terminated by the matching end-tag "".. Please see server.log for more details.]]
[2023-02-05T15:31:51.185+0100] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-02036] [javax.enterprise.system.tools.deployment.autodeploy] [tid: _ThreadID=100 _ThreadName=AutoDeployer] [timeMillis: 1675607511185] [levelValue: 900] [[ [AutoDeploy] Autodeploy failed C:\myFolder\glassfish4\glassfish\domains\domain1\autodeploy\jri.war.]]
I don't know. Can you please tell me exactly how you did it?, I must be something wrong.
Maybe, I can use the version 2.4 of JRI and under the JasperStudio version. Which version of JasperStudio can I use with JRI 2.4?
Thanks.
Many errors like this one in the server.log of glassfish
[2023-02-05T16:12:04.249+0100] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=81 _ThreadName=deployment-jar-scanner] [timeMillis: 1675609924249] [levelValue: 1000] [[
Exception while visiting META-INF/versions/9/org/bouncycastle/math/ec/custom/sec/SecP160R2Curve.class of size 4140
java.lang.IllegalArgumentException
at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.
Yeah, I am now seeing those Java errors as well.
Those first ones I cannot reproduce:
Error occurred during deployment: Exception while deploying the app [jri] : org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 4; Deployment descriptor file WEB-INF/web.xml in archive [jri]. The element type "description" must be terminated by the matching end-tag "".. Please see server.log for more details.]]
I did come across those before ... but if I remember correctly, this was due to a messed up zip file. When I copied it again (in binary mode) it worked fine.
The other Java errors are strange ... will have a look.
You are being difficult, my friend ;) ... or at least non-standard.
- The XML "description" error you shouldn't get. Could be a binary copy issue ... or if you used the script to manipulate the .war file to set the environment, perhaps better to use the environment variable.
- The PWC6351 warning I could eliminate in a new build by removing the automatically generated classpath in the META-INF/MANIFEST.MF file. But you should be able to ignore those messages.
- The last issue with META-INF/versions/9 seems to be a Glassfish issue, not sure what I should do about it. It shouldn't even look at these files from my understanding so far: https://stackoverflow.com/questions/63876361/glassfish4-exceptions-because-of-java9-module-info-class-in-web-inf-lib-jackson
Hi, I have been able to deploy it and I can access the web http://myhost:myport/jri/ but I wanted to test the connection to the database before continuing with the rest of the installation and I got an error
With the other version of JRI the connection was working fine. I have the same configuration as before in the application.properties file.
I can see the different name created after deploying it before it was "JasperReportsIntegration" , now it is "jri", maybe ACL issue?.
This is what the JRI log shows
11:09:44 [INFO] jasper.webapp.Test.doGet - *** servlet /test START 11:09:44 [INFO] oc.servlet.ServletUtilities.logRequestParameters - Request parameters: 11:09:44 [INFO] oc.servlet.ServletUtilities.logRequestParameters - _dataSource: default 11:09:45 [ERROR] oc.utils.Utils.throwRuntimeException - Could not connect via JDBC: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.lang.NoSuchMethodError: oracle.jdbc.pool.OracleDataSource.createConnectionBuilder()Loracle/jdbc/datasource/impl/OracleConnectionBuilderImpl; 11:09:45 [ERROR] oc.utils.Utils.throwRuntimeException - Other Error: Could not connect via JDBC: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.lang.NoSuchMethodError: oracle.jdbc.pool.OracleDataSource.createConnectionBuilder()Loracle/jdbc/datasource/impl/OracleConnectionBuilderImpl;
Thanks!
You are taking up too much of my time. Drop me an email at dietmar.aust at gmail.com. Then we schedule a zoom call or teamviewer session to fix it.
really?, oh that's super.
Sorry!!!
Thanks :)