You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2007/08/08 14:18:59 UTC

[jira] Commented: (JCR-1048) JNDIDatabaseFileSystem was not woring in tomcat webapp

    [ https://issues.apache.org/jira/browse/JCR-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518425 ] 

Jukka Zitting commented on JCR-1048:
------------------------------------

Wouldn't a more appropriate fix be to simply change your repository configuration to include the "java:comp/env" prefix?

> JNDIDatabaseFileSystem was not woring in tomcat webapp
> ------------------------------------------------------
>
>                 Key: JCR-1048
>                 URL: https://issues.apache.org/jira/browse/JCR-1048
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.3
>            Reporter: Stephen More
>
> The new method should look like this:
> protected Connection getConnection() throws NamingException, SQLException {
>         InitialContext ic = new InitialContext();
>         DataSource dataSource = null;
>         try
>         {
>             dataSource = (DataSource) ic.lookup(dataSourceLocation);
>         }
>         catch( javax.naming.NameNotFoundException e )
>         {
>             // Now lets try it this way
>             javax.naming.Context envCtx = (javax.naming.Context)ic.lookup( "java:comp/env" );
>             dataSource = (DataSource) envCtx.lookup(dataSourceLocation);
>         }
>         return dataSource.getConnection();
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.