View | Details | Raw Unified | Return to bug 61366
Collapse All | Expand All

(-)java/org/apache/catalina/session/JDBCStore.java (-2 / +7 lines)
Lines 867-872 Link Here
867
            return dbConnection;
867
            return dbConnection;
868
868
869
        if (dataSourceName != null && dataSource == null) {
869
        if (dataSourceName != null && dataSource == null) {
870
            org.apache.catalina.Context context = getManager().getContext();
871
            ClassLoader oldThreadContextCL = context.bind(Globals.IS_SECURITY_ENABLED, null);
872
870
            Context initCtx;
873
            Context initCtx;
871
            try {
874
            try {
872
                initCtx = new InitialContext();
875
                initCtx = new InitialContext();
Lines 873-882 Link Here
873
                Context envCtx = (Context) initCtx.lookup("java:comp/env");
876
                Context envCtx = (Context) initCtx.lookup("java:comp/env");
874
                this.dataSource = (DataSource) envCtx.lookup(this.dataSourceName);
877
                this.dataSource = (DataSource) envCtx.lookup(this.dataSourceName);
875
            } catch (NamingException e) {
878
            } catch (NamingException e) {
876
                manager.getContext().getLogger().error(
879
                context.getLogger().error(
877
                        sm.getString(getStoreName() + ".wrongDataSource",
880
                        sm.getString(getStoreName() + ".wrongDataSource",
878
                                this.dataSourceName), e);
881
                                this.dataSourceName), e);
879
           }
882
            } finally {
883
                context.unbind(Globals.IS_SECURITY_ENABLED, oldThreadContextCL);
884
            }
880
        }
885
        }
881
886
882
        if (dataSource != null) {
887
        if (dataSource != null) {

Return to bug 61366