jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1048) JNDIDatabaseFileSystem was not woring in tomcat webapp
Date Wed, 08 Aug 2007 12:18:59 GMT

    [ 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.


Mime
View raw message