1 Reply Latest reply on Sep 29, 2016 2:18 PM by Bartosz Majsak

    Issue with storing JSON  in postgresql 9.4 for Test (Wildfly 9.0.2 Final + Arquillian Setup)

    piyush chand Newbie

      I am facing issue in storing json while running Test InContainer. So the setup is Wildfly + Postgresql and Arquillian (For running the InContainer Test).

      Till now we were using h2db (in memory database) for basically loading datasets and than running InContainer Tests that were testing the business logic.

      Now we have added a new column that is Json type. After adding the json type, we have issues with the tests as h2db doesn't support json type (Data Types).

       

      So, we decided to use postgresql for loading the datasets and than running the InContainer test, So, I made the necessary changes in the arquillian.xml file. and deployed the jdbc driver.

       

      That allows me to seed the database with the datasets, but have issue with json type. I get the following error.

       

      org.jboss.arquillian.persistence.dbunit.exception.DBUnitDataSetHandlingException: Failed while seeding database.

        at org.jboss.arquillian.persistence.dbunit.DBUnitDataHandler.prepare(DBUnitDataHandler.java:87)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

        at org.jboss.arquillian.persistence.dbunit.DBUnitDataStateLogger.aroundDataSeeding(DBUnitDataStateLogger.java:106)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)

        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

        at org.jboss.arquillian.persistence.core.lifecycle.DataSetHandler.prepareDatabase(DataSetHandler.java:62)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

        at org.jboss.arquillian.persistence.dbunit.DBUnitDataStateLogger.beforePersistenceTest(DBUnitDataStateLogger.java:98)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.persistence.core.lifecycle.SchemaCreationScriptsExecutor.createSchema(SchemaCreationScriptsExecutor.java:68)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.persistence.dbunit.DBUnitPersistenceTestLifecycleHandler.createDatasets(DBUnitPersistenceTestLifecycleHandler.java:108)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.persistence.core.lifecycle.ErrorCollectorHandler.createErrorCollector(ErrorCollectorHandler.java:38)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.persistence.dbunit.DBUnitPersistenceTestLifecycleHandler.provideDatabaseConnection(DBUnitPersistenceTestLifecycleHandler.java:118)

        at org.jboss.arquillian.persistence.dbunit.DBUnitPersistenceTestLifecycleHandler.provideDatabaseConnectionAroundBeforePersistenceTest(DBUnitPersistenceTestLifecycleHandler.java:84)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)

        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

        at org.jboss.arquillian.persistence.core.lifecycle.PersistenceTestTrigger.beforeTest(PersistenceTestTrigger.java:113)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

        at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)

        at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:108)

        at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:241)

        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:426)

        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)

        at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:259)

        at org.jboss.arquillian.junit.Arquillian$7$1.invoke(Arquillian.java:319)

        at org.jboss.arquillian.container.test.impl.execution.BeforeLifecycleEventExecuter.on(BeforeLifecycleEventExecuter.java:35)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

        at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)

        at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:159)

        at org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:312)

        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

        at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:204)

        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:426)

        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)

        at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:218)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:166)

        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)

        at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66)

        at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:170)

        at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:135)

        at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:98)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)

        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)

        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)

        at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

        at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)

        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)

        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)

        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)

        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)

        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

      Caused by: org.dbunit.dataset.NoSuchColumnException: contract_events.DATA -  (Non-uppercase input column: data) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.

        at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:117)

        at org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)

        at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:143)

        at org.jboss.arquillian.persistence.dbunit.DBUnitDataHandler.fillDatabase(DBUnitDataHandler.java:157)

        at org.jboss.arquillian.persistence.dbunit.DBUnitDataHandler.prepare(DBUnitDataHandler.java:83)

        ... 204 more

       

       

       

      The data is basically representing the json type column.

       

      If there is any other solution to this problem, it would be very helpful.

       

      Thank you in Advance.