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

Issues with Glassfish #11

Closed
daust opened this issue Sep 30, 2018 · 4 comments
Closed

Issues with Glassfish #11

daust opened this issue Sep 30, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@daust
Copy link
Owner

daust commented Sep 30, 2018

David mentioned some issues with JRI on Glassfish, see his comment for details:
http://dietmaraust.com/jasperreportsintegration-2-4-0-released#comment-1911

I have fixed the password issue for 2.5.0.1 and also updated the application.properties file to reflect his comments:

#====================================================================
# Application properties (global)
#====================================================================
[application]
configFileVersion=2.3.0
# set the jndiPrefix, this is different for different
# containers, e.g. 
# for Glassfish: jndiPrefix=jdbc/
# for Tomcat   : jndiPrefix=java:comp/env/jdbc/
jndiPrefix=java:comp/env/jdbc/
# infoPageIsEnabled will show the initial start page of the j2ee application
# including testing and the environment settings
infoPageIsEnabled=true
@daust daust added the bug label Sep 30, 2018
@daust daust added this to the Release 2.5.0 milestone Sep 30, 2018
@daust daust self-assigned this Sep 30, 2018
@daust daust closed this as completed Sep 30, 2018
@dvht
Copy link

dvht commented Apr 14, 2021

Hi Dietmar

I don't see any commit here, and I don't understand what exactly in your application.properties reflects to this issue. But we got this issue also, and it is caused by line 327 in AppConfig which always expects a password, otherwise null will be passed to decrypt, causing the NPE.
If you omit the definition entirely, you get an error because of line 90 in ConnectionUtility first needs type before trying JNDI.

Regards,
Dirk

@daust
Copy link
Owner Author

daust commented Apr 14, 2021

Hi @dvht / Dirk,

I don't see any commit here

well, I moved the actual source code to GitHub with release 2.6.0. Before, I only put the binaries here.

I don't understand what exactly in your application.properties reflects to this issue

I added the note regarding the different jndi-prefix (Glassfish vs. Tomcat) to the application.properties file:

# set the jndiPrefix, this is different for different
# containers, e.g. 
# for Glassfish: jndiPrefix=jdbc/
# for Tomcat   : jndiPrefix=java:comp/env/jdbc/
jndiPrefix=java:comp/env/jdbc/
  • Can you please post your configuration, the contents of the application.properties file and your jndi configuration in Glassfish?
  • Please also post the actual error stack you are getting.
  • Which version of JRI are you using exactly?
  • Which version of Glassfish are you using?

Thank you

@dvht
Copy link

dvht commented May 14, 2021

Hi Dietmar,

Excuse me for having lost track of your response so long. This issue is not about the different glassfish jndi prefix, but an NPE in decryptPWD when you omit the password.
I was told by my colleagues that they were using the latest version. I got convinced this was true, because in the latest source, if type=jndi, then a password is still read and decrypted. But, I didn't notice that decryptPWD can hande nulls now

Since we had to add a dummy password to get rid of the NPE in decryptPWD, it is impossible that they were on the latest version. Sorry for that.

Regards,
Dirk

@dvht
Copy link

dvht commented May 14, 2021

As a side note, when I need a jdbc source in a java web application, I always use this construction so the user has no worries:

try {
   dataSource = (javax.sql.DataSource) namingContext.lookup("jdbc/" + datasourceName);
} catch (javax.naming.NameNotFoundException e) {
   try {
      dataSource = (javax.sql.DataSource) namingContext.lookup("java:comp/env/jdbc/" + datasourceName);
   } catch (javax.naming.NameNotFoundException e2) {
      error handling
   }
}   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants