We are using Weblogic Server Datasource and Spring Hibernate for web application.
We are also using JMS Server which is configured in different remote Weblogic Server.
When web application send a message to particular JMS queue after that we are updating a particular table record into the database using Weblogic datasource then it is throwing below error.
Should we check first what is UserContext.getCredentialsForCurrentThread();
and let on the basis of current credential decide which factory require?
or
should we use UserCredentialsDataSourceAdapter ds = (UserCredentialsDataSourceAdapter) context.getBean("dataSource);
ds.setCredentialsForCurrentThread(user, password);

Exception:
Caused by: java.sql.SQLException: Internal error: Cannot obtain XAConnection java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[jms_prtleurja1, Monitors, IntegrationMonitors, AdminChannelUsers, Operators, IntegrationOperators, AdminChannelUsers]
at weblogic.security.service.SecurityServiceManager.s eal(SecurityServiceManager.java:835)
at weblogic.security.service.IdentityUtility.authenti catedSubjectToIdentity(IdentityUtility.java:30)
at weblogic.security.service.RoleManager.getRoles(Rol eManager.java:183)
at weblogic.security.service.AuthorizationManager.isA ccessAllowed(AuthorizationManager.java:375)
at weblogic.jdbc.common.internal.JDBCUtil.checkPermis sion(JDBCUtil.java:230)
at weblogic.jdbc.common.internal.ConnectionPool.reser ve(ConnectionPool.java:354)
at weblogic.jdbc.common.internal.ConnectionPool.reser ve(ConnectionPool.java:316)
at weblogic.jdbc.common.internal.ConnectionPoolManage r.reserve(ConnectionPoolManager.java:93)