Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1246153

Summary: MongoDB metadata import fails with NPE
Product: [JBoss] JBoss Data Virtualization 6 Reporter: Andrej Smigala <asmigala>
Component: Teiid, DocumentationAssignee: David Le Sage <dlesage>
Status: CLOSED CURRENTRELEASE QA Contact: Filip Elias <felias>
Severity: high Docs Contact: David Le Sage <dlesage>
Priority: high    
Version: 6.2.0CC: asmigala, atangrin, dlesage, felias, jstastny, lfabriko, vhalbert
Target Milestone: ER1Keywords: Documentation
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Release Note
Doc Text:
If a mongodb user has insufficient permissions to import metadata, the importation process will fail. The user needs adequate permissions to access the mongodb database. If there is a collection which cannot be accessed by the user, metadata import will fail. Currently, there is no way to exclude those tables from import.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-11 05:04:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrej Smigala 2015-07-23 14:48:28 UTC
Deploying the following dynamic vdb fails with a NullPointerException:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="mongo" version="1">
	<description>Importer VDB</description>
	<property name="UseConnectorMetadata" value="true" />
	<property name="deployment-name" value="mongo-vdb.xml" />
	<model name="importVDBSrcModel">
		<source name="importVDBSrcModel" translator-name="mongodb" connection-jndi-name="java:/mongoDS" />
	</model>
</vdb>


The resource adapter is defined as:

                <resource-adapter id="mongoDS">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.mongodb"/>
                    <transaction-support>NoTransaction</transaction-support>
                    <connection-definitions>
                        <connection-definition class-name="org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory" jndi-name="java:/mongoDS" enabled="true" use-java-context="true" pool-name="mongoDS">
                            <config-property name="Database">
                                bqt
                            </config-property>
                            <config-property name="RemoteServerList">
                                vmgdb01.mw.lab.eng.bos.redhat.com:27017
                            </config-property>
                            <config-property name="Username">
                                dv
                            </config-property>
                            <config-property name="Password">
                                dv
                            </config-property>
                        </connection-definition>
                    </connection-definitions>
                </resource-adapter>



Server log:

16:46:49,793 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "mongo-vdb.xml" (runtime-name: "mongo-vdb.xml")
16:46:49,809 DEBUG [org.teiid.RUNTIME] (MSC service thread 1-5) VDB mongo-vdb.xml has been parsed.
16:46:49,835 INFO  [org.teiid.RUNTIME] (MSC service thread 1-1) TEIID50029 VDB mongo.1 model "importVDBSrcModel" metadata is currently being loaded. Start Time: 7/23/15 4:46 PM
16:46:49,869 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015859: Deployed "mongo-vdb.xml" (runtime-name : "mongo-vdb.xml")
16:46:50,626 WARN  [org.teiid.RUNTIME] (teiid-async-threads - 3) TEIID50036 VDB mongo.1 model "importVDBSrcModel" metadata failed to load. Reason:java.lang.NullPointerException: java.lang.NullPointerException
        at org.teiid.translator.mongodb.MongoDBMetadataProcessor.addTable(MongoDBMetadataProcessor.java:92)
        at org.teiid.translator.mongodb.MongoDBMetadataProcessor.process(MongoDBMetadataProcessor.java:57)
        at org.teiid.translator.mongodb.MongoDBMetadataProcessor.process(MongoDBMetadataProcessor.java:38)
        at org.teiid.translator.ExecutionFactory.getMetadata(ExecutionFactory.java:935) [teiid-api-8.7.1.6_2-redhat-3.jar:8.7.1.6_2-redhat-3]
        at org.teiid.query.metadata.NativeMetadataRepository.loadMetadata(NativeMetadataRepository.java:73) [teiid-engine-8.7.1.6_2-redhat-3.jar:8.7.1.6_2-redhat-3]
        at org.teiid.query.metadata.ChainingMetadataRepository.loadMetadata(ChainingMetadataRepository.java:55) [teiid-engine-8.7.1.6_2-redhat-3.jar:8.7.1.6_2-redhat-3]
        at org.teiid.jboss.VDBService$6.run(VDBService.java:395) [teiid-jboss-integration-8.7.1.6_2-redhat-3.jar:8.7.1.6_2-redhat-3]
        at org.teiid.jboss.VDBService$7.run(VDBService.java:442) [teiid-jboss-integration-8.7.1.6_2-redhat-3.jar:8.7.1.6_2-redhat-3]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_79]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_79]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

Comment 2 JBoss JIRA Server 2015-07-23 19:25:29 UTC
Ramesh Reddy <rareddy> updated the status of jira TEIID-3589 to Resolved

Comment 3 Filip Elias 2015-08-12 13:08:53 UTC
This issue is not fixed in DV 6.2 ER4.

Comment 4 Van Halbert 2015-08-12 13:21:43 UTC
Any details as to what you are seeing, maybe any exceptions in the server log?

Comment 5 Filip Elias 2015-08-12 13:25:03 UTC
The exception is in the first comment.

Comment 6 JBoss JIRA Server 2015-08-12 13:32:08 UTC
Van Halbert <vhalbert> updated the status of jira TEIID-3589 to Reopened

Comment 7 JBoss JIRA Server 2015-08-12 17:07:01 UTC
Ramesh Reddy <rareddy> updated the status of jira TEIID-3589 to Resolved

Comment 8 Andrej Smigala 2015-09-04 12:41:18 UTC
The vdb deployment now fails with the following errror:

14:26:08,810 WARN  [org.teiid.RUNTIME] (teiid-async-threads - 3) TEIID50036 VDB mongo.1 model "importVDBSrcModel" metadata failed to load. Reason:not authorized for query on bqt.system.users: com.mongodb.MongoEx
ception: not authorized for query on bqt.system.users
        at com.mongodb.MongoException.parse(MongoException.java:82)
        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:292)
        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:273)
        at com.mongodb.DBCursor._check(DBCursor.java:368)
        at com.mongodb.DBCursor._hasNext(DBCursor.java:459)
        at com.mongodb.DBCursor.hasNext(DBCursor.java:484)
        at org.teiid.translator.mongodb.MongoDBMetadataProcessor.process(MongoDBMetadataProcessor.java:58)
        at org.teiid.translator.mongodb.MongoDBMetadataProcessor.process(MongoDBMetadataProcessor.java:39)
        at org.teiid.translator.ExecutionFactory.getMetadata(ExecutionFactory.java:935) [teiid-api-8.7.1.6_2-redhat-5.jar:8.7.1.6_2-redhat-5]
        at org.teiid.query.metadata.NativeMetadataRepository.loadMetadata(NativeMetadataRepository.java:73) [teiid-engine-8.7.1.6_2-redhat-5.jar:8.7.1.6_2-redhat-5]
        at org.teiid.query.metadata.ChainingMetadataRepository.loadMetadata(ChainingMetadataRepository.java:55) [teiid-engine-8.7.1.6_2-redhat-5.jar:8.7.1.6_2-redhat-5]
        at org.teiid.jboss.VDBService$6.run(VDBService.java:395) [teiid-jboss-integration-8.7.1.6_2-redhat-5.jar:8.7.1.6_2-redhat-5]
        at org.teiid.jboss.VDBService$7.run(VDBService.java:442) [teiid-jboss-integration-8.7.1.6_2-redhat-5.jar:8.7.1.6_2-redhat-5]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_79]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_79]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)



The user dv does not have access to the system tables, but there is no way to exclude those tables from the import (like with the JDBC importer).

Comment 9 JBoss JIRA Server 2015-09-04 12:51:36 UTC
Van Halbert <vhalbert> updated the status of jira TEIID-3589 to Reopened

Comment 11 JBoss JIRA Server 2015-09-23 18:09:30 UTC
Ramesh Reddy <rareddy> updated the status of jira TEIID-3589 to Resolved

Comment 12 Van Halbert 2015-10-26 20:35:52 UTC
As indicated by the engineers, this needs to be tested on DV 6.3 to determine the status of this BZ.

Comment 13 JBoss JIRA Server 2016-01-27 21:25:04 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-3589 to Closed

Comment 14 JBoss JIRA Server 2016-02-16 20:24:13 UTC
Ramesh Reddy <rareddy> updated the status of jira TEIID-3715 to Resolved

Comment 15 Jan Stastny 2016-05-24 14:58:00 UTC
The NullpointerException issue is resolved.

The issue described in https://bugzilla.redhat.com/show_bug.cgi?id=1246153#c8 is observable in DV 6.3.0 ER3 too.

The root cause of the issue is in insufficient permissions assigned to the mongodb user used to access the mongodb database. If there's a collection which cannot be accessed by the user, metadata import would fail with mentioned message.

The resolution of this issue would require more development done, new enhancement JIRA will be created.

We need to document the fact for the time being.

Comment 17 JBoss JIRA Server 2016-06-03 22:43:32 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-3715 to Closed

Comment 18 Lucie Fabrikova 2016-08-05 07:54:04 UTC
The release note does not contain info about mongodb metadata import.

Comment 19 David Le Sage 2016-08-08 05:43:09 UTC
Added to known issues in release notes.

URL:  https://access.qa.redhat.com/documentation/en/red-hat-jboss-data-virtualization/6.3/single/release-notes