Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Spring Custom DataSource ConnectionPreparer to set CLIENT_IDENTIFIER for audit purposes with JNDI Da

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a same requirement as specified in post to pass user id as client identifier for audit purposes. webpage

I have followed the same approach as mentioned in 8.2.Configuration of a Custom DataSource Connection Preparer http://docs.spring.io/spring-data/jdbc/docs/current/reference/html/orcl.connection.html

Below is the piece of code which I have :


I have configured aop autoaspect proxy as shown below.


I am deploying my web service in websphere server. Everything is working fine If I configure data source using apache dbcp BasicDataSource:


Code is working fine with the above configuration. Once connection is returned, I am able to set value to client identifier and able to retrieve it from syscontext with audit trigger.

But We have actual data source configuration as shown below:


I cannot change this configuration as it is used by multiple applications and I have to follow the same. With the above configuration While deploying I am getting null pointer exception while creating data source bean. Below is the exception that I am getting:


has anyone followed this approach before. It would be helpful if some one can provide instructions on how to proceed further to to resolve this error. is there any other recommended way to follow this approach. Thanks in advance!
 
Sheriff
Posts: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem due to the Aspect you are trying to apply are you sure of that? If you don't apply the ClientIdentifierConnectionPreparer you don't get this Exception?
 
Amarrender reddy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No without aspect its working fine. When I try to do with aspect its throwing an exception with JNDI data source configuration and working fine with aspect If I use other data source configurations as specified in question.
 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!