jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guido Jäkel (JIRA) <j...@apache.org>
Subject [jira] Commented: (JCR-1305) JNDI data sources with BundleDbPersistenceManager: UnsupportedOperationException
Date Thu, 04 Sep 2008 12:57:44 GMT

    [ https://issues.apache.org/jira/browse/JCR-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12628330#action_12628330
] 

Guido Jäkel commented on JCR-1305:
----------------------------------

Dear Thomas,

please *reopen* this issue, it seems to be (still?) defect in 1.4.5!

Trying to switch to the MySqlPersitanceManager and a Workspace Configuration like

    [...]
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
      <param name="driver" value="javax.naming.InitialContext"/>
      <param name="url" value="java:comp/env/jdbc/foo"/>
      <param name="schemaObjectPrefix" value="${wsp.name}_"/>
      <param name="schema" value="mysql"/>
    </PersistenceManager>
    [...]

To access to a database connection defined in a Tomcat environment i got:

20080904-135101.532 ERROR [main] [] [RepositoryImpl] Unable to start repository, forcing shutdown...
20080904-135101.533 INFO  [main] [] [RepositoryImpl] Shutting down repository...
20080904-135101.618 INFO  [main] [] [RepositoryImpl] Repository has been shutdown
20080904-135101.619 ERROR [main] [] [RepositoryImpl] failed to start Repository: Cannot instantiate
persistence manager org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager:
null
javax.jcr.RepositoryException: Cannot instantiate persistence manager org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager:
null: null
        at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1163)
        at org.apache.jackrabbit.core.RepositoryImpl.access$700(RepositoryImpl.java:104)
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doInitialize(RepositoryImpl.java:1727)
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:1710)
        at org.apache.jackrabbit.core.RepositoryImpl.initWorkspace(RepositoryImpl.java:569)
        at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:408)
        at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:304)
        at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:550)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.createRepository(RepositoryStartupServlet.java:439)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.initRepository(RepositoryStartupServlet.java:407)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.startup(RepositoryStartupServlet.java:238)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.init(RepositoryStartupServlet.java:211)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:448)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.UnsupportedOperationException
        at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:116)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:554)
        at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionFactory.getConnection(ConnectionFactory.java:60)
        at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.setupConnection(ConnectionRecoveryManager.java:328)
        at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.<init>(ConnectionRecoveryManager.java:137)
        at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.init(BundleDbPersistenceManager.java:558)
        at org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager.init(MySqlPersistenceManager.java:54)
        at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1159)
        ... 38 more
java.lang.UnsupportedOperationException
        at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:116)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:554)
        at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionFactory.getConnection(ConnectionFactory.java:60)
        at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.setupConnection(ConnectionRecoveryManager.java:328)
        at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.<init>(ConnectionRecoveryManager.java:137)
        at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.init(BundleDbPersistenceManager.java:558)
        at org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager.init(MySqlPersistenceManager.java:54)
        at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1159)
        at org.apache.jackrabbit.core.RepositoryImpl.access$700(RepositoryImpl.java:104)
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doInitialize(RepositoryImpl.java:1727)
        at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:1710)
        at org.apache.jackrabbit.core.RepositoryImpl.initWorkspace(RepositoryImpl.java:569)
        at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:408)
        at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:304)
        at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:550)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.createRepository(RepositoryStartupServlet.java:439)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.initRepository(RepositoryStartupServlet.java:407)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.startup(RepositoryStartupServlet.java:238)
        at org.apache.jackrabbit.j2ee.RepositoryStartupServlet.init(RepositoryStartupServlet.java:211)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:448)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)


I think, \org\apache\jackrabbit\core\persistence\bundle\util\ConnectionFactory.java is still
wrong at line 60ff. The thrown exception points out, that getConnection of the Pooled Datasource
is called with user and passwort, which is illegal. 

                    if (user == null && password == null) {
                        return ds.getConnection();
                    } else {
                        return ds.getConnection(user, password);
                    }

May some other code accidentally set user and password to empty strings?

Note: We're already using the feature of JNDI database connections, e.g.

    <FileSystem class="org.apache.jackrabbit.core.fs.db.JNDIDatabaseFileSystem">
      <param name="dataSourceLocation" value="java:comp/env/jdbc/foo"/>
      <param name="schemaObjectPrefix" value="${wsp.name}_"/>
      <param name="schema" value="mysql"/>
    </FileSystem>

is in use without this problem.

> JNDI data sources with BundleDbPersistenceManager: UnsupportedOperationException
> --------------------------------------------------------------------------------
>
>                 Key: JCR-1305
>                 URL: https://issues.apache.org/jira/browse/JCR-1305
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.4
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>             Fix For: 1.3.4, core 1.4.1
>
>
> When using the org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory, the BundleDbPersistenceManager
can not open a database connection via JNDI because the method DataSource.getConnection(user,
password) is not supported. Instead, DataSource.getConnection() must be used for this to work.
> ConnectionFactory.getConnection should be changed to call this method if user name and
password are empty.

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