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

Unable to build-up jasper report on Glassfish #129

Open
nmuller000 opened this issue Feb 1, 2023 · 22 comments
Open

Unable to build-up jasper report on Glassfish #129

nmuller000 opened this issue Feb 1, 2023 · 22 comments

Comments

@nmuller000
Copy link

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:/JasperReportsIntegration/) and also I could test successful the database connection.

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.

@daust
Copy link
Owner

daust commented Feb 1, 2023

Hi, you have two options here:

Good luck

@nmuller000
Copy link
Author

nmuller000 commented Feb 1, 2023

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!

@daust
Copy link
Owner

daust commented Feb 1, 2023

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.

@nmuller000
Copy link
Author

Hi, the error persist. Any suggestion please?

@daust
Copy link
Owner

daust commented Feb 2, 2023

As I have pointed out before ... the documented and supported way to use it is one of the two options:

Good luck

@nmuller000
Copy link
Author

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.

@daust
Copy link
Owner

daust commented Feb 3, 2023

Ok, here is something quick you can try.

Make sure you set the environment in the SYSTEM environment, NOT THE USER ENVIRONMENT!

image

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.

@nmuller000
Copy link
Author

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
image

Thanks

@daust
Copy link
Owner

daust commented Feb 3, 2023

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.

@daust
Copy link
Owner

daust commented Feb 3, 2023

And you are using the latest integration, at least 2.10.0, right?

@nmuller000
Copy link
Author

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.

@daust
Copy link
Owner

daust commented Feb 3, 2023

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.

image

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.

@nmuller000
Copy link
Author

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

  1. Download the latest JRI version 2.10.0

  2. Copy the jri.war in the c:\glassfish4\glassfish\domains\domain1\autodeploy

  3. Then it going to deploy automatically and create the follow structure in this path c:\glassfish4\glassfish\domains\domain1\applications
    image

  4. Then modify the file application.properties with the database connection information

  5. 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.
image

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!!!

@daust
Copy link
Owner

daust commented Feb 3, 2023

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_HOME in 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.

@nmuller000
Copy link
Author

Ok. I'll try.
Thank you very much.

@nmuller000
Copy link
Author

nmuller000 commented Feb 5, 2023

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.

@nmuller000
Copy link
Author

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.(ClassReader.java:170)
at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.(ClassReader.java:153)
at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.(ClassReader.java:424)
at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:358)
at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:165)
at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:127)
at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:344)
at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:67)
at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:303)
at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
]]

@daust
Copy link
Owner

daust commented Feb 5, 2023

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.

@daust
Copy link
Owner

daust commented Feb 5, 2023

You are being difficult, my friend ;) ... or at least non-standard.

  1. 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.
  2. 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.
  3. 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

@nmuller000
Copy link
Author

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!

@daust
Copy link
Owner

daust commented Feb 6, 2023

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.

@nmuller000
Copy link
Author

nmuller000 commented Feb 6, 2023

really?, oh that's super.

Sorry!!!

Thanks :)

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

No branches or pull requests

2 participants