ASF Bugzilla – Attachment 35194 Details for
Bug 61366
"Unable to find [comp]" when attempting to use JNDI datasource for JDBCStore session store
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Set TCCL to the webapp classloader if localDataSource == true
JDBCStore.java.patch (text/plain), 2.31 KB, created by
Jonathan Horowitz
on 2017-08-01 17:39:55 UTC
(
hide
)
Description:
Set TCCL to the webapp classloader if localDataSource == true
Filename:
MIME Type:
Creator:
Jonathan Horowitz
Created:
2017-08-01 17:39:55 UTC
Size:
2.31 KB
patch
obsolete
>Index: java/org/apache/catalina/session/JDBCStore.java >=================================================================== >--- java/org/apache/catalina/session/JDBCStore.java (revision 1803599) >+++ java/org/apache/catalina/session/JDBCStore.java (working copy) >@@ -107,6 +107,11 @@ > protected String dataSourceName = null; > > /** >+ * Context local datasource. >+ */ >+ protected boolean localDataSource = false; >+ >+ /** > * DataSource to use > */ > protected DataSource dataSource = null; >@@ -454,7 +459,24 @@ > return this.dataSourceName; > } > >+ /** >+ * @return if the datasource will be looked up in the webapp JNDI Context. >+ */ >+ public boolean getLocalDataSource() { >+ return localDataSource; >+ } > >+ /** >+ * Set to true to cause the datasource to be looked up in the webapp JNDI >+ * Context. >+ * >+ * @param localDataSource the new flag value >+ */ >+ public void setLocalDataSource(boolean localDataSource) { >+ this.localDataSource = localDataSource; >+ } >+ >+ > // --------------------------------------------------------- Public Methods > > @Override >@@ -867,6 +889,12 @@ > return dbConnection; > > if (dataSourceName != null && dataSource == null) { >+ org.apache.catalina.Context context = getManager().getContext(); >+ ClassLoader oldThreadContextCL = null; >+ if (localDataSource) { >+ oldThreadContextCL = context.bind(Globals.IS_SECURITY_ENABLED, null); >+ } >+ > Context initCtx; > try { > initCtx = new InitialContext(); >@@ -873,10 +901,14 @@ > Context envCtx = (Context) initCtx.lookup("java:comp/env"); > this.dataSource = (DataSource) envCtx.lookup(this.dataSourceName); > } catch (NamingException e) { >- manager.getContext().getLogger().error( >+ context.getLogger().error( > sm.getString(getStoreName() + ".wrongDataSource", > this.dataSourceName), e); >- } >+ } finally { >+ if (localDataSource) { >+ context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL); >+ } >+ } > } > > if (dataSource != null) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 61366
:
35191
|
35192
| 35194