3 Replies Latest reply on Mar 8, 2017 10:02 AM by Sławomir Wojciechowski

    Jberet standalone, jdbc to mongo

    Sławomir Wojciechowski Newbie

      Hello,

      I created simple example with jberet standalone that load data from mssql to mongodb. It's jbatch file:

       

      <job id="mssqlToMongo" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">

          <step id="step1">

              <chunk item-count="100">

                  <reader ref="jdbcItemReader">

                        <properties>

                              <property name="url" value="jdbc:sqlserver://ela" />

                              <property name="sql" value="select id, name, loc

                                            from t_my_tab"/>

                        <property name="beanType" value="pl.smilu.test.Tab"/>

                        <property name="skipBeanValidation" value="true"/>

                     </properties>

                  </reader>

                  <processor ref="pl.smilu.test.TabProcessor">

                        </processor>

                  <writer ref="mongoItemWriter">

                      <properties>

                          <property name="uri" value="mongodb://localhost/inte"/>

                          <property name="beanType" value="pl.smilu.test.Tab"/>

                          <property name="host" value="localhost"/>

                          <property name="database" value="inte"/>

                          <property name="collection" value="tab"/>

                      </properties>

                  </writer>

              </chunk>

          </step>

      </job>

       

       

      When I start above example I got error:

       

      ERROR: ProcessingInfo{count=100, timerExpired=false, itemState=RUNNING, chunkState=RUNNING, checkpointPosition=2699, readPosition=2799, failurePoint=null}

      Mar 08, 2017 2:01:54 PM org.jberet.runtime.runner.ChunkRunner run

      ERROR: item-count=100, time-limit=0, skip-limit=-1, skipCount=0, retry-limit=-1, retryCount=0

      Mar 08, 2017 2:01:54 PM org.jberet.runtime.runner.ChunkRunner run

      ERROR: JBERET000007: Failed to run job callToMongo, step1, org.jberet.job.model.Chunk@6e875caa

      1. com.mongodb.MongoInterruptedException: Interrupted acquiring a permit to retrieve an item from the pool

              at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:186)

              at com.mongodb.internal.connection.ConcurrentPool.get(ConcurrentPool.java:126)

              at com.mongodb.connection.DefaultConnectionPool.getPooledConnection(DefaultConnectionPool.java:258)

              at com.mongodb.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:99)

              at com.mongodb.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:88)

              at com.mongodb.connection.DefaultServer.getConnection(DefaultServer.java:86)

              at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:86)

              at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:420)

              at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:413)

              at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:133)

              at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:60)

              at com.mongodb.Mongo.execute(Mongo.java:845)

              at com.mongodb.Mongo$2.execute(Mongo.java:828)

              at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:342)

              at com.mongodb.DBCollection.insert(DBCollection.java:337)

              at com.mongodb.DBCollection.insert(DBCollection.java:328)

              at com.mongodb.DBCollection.insert(DBCollection.java:298)

              at com.mongodb.DBCollection.insert(DBCollection.java:264)

              at com.mongodb.DBCollection.insert(DBCollection.java:201)

              at org.mongojack.JacksonDBCollection.insert(JacksonDBCollection.java:338)

              at org.mongojack.JacksonDBCollection.insert(JacksonDBCollection.java:375)

              at org.jberet.support.io.MongoItemWriter.writeItems(MongoItemWriter.java:38)

              at org.jberet.runtime.runner.ChunkRunner.doCheckpoint(ChunkRunner.java:522)

              at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:317)

              at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:201)

              at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:219)

              at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:140)

              at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:164)

              at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88)

              at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:59)

              at org.jberet.spi.JobExecutor$1.run(JobExecutor.java:99)

              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: java.lang.InterruptedException

              at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1326)

              at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:409)

              at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:180)

              ... 33 more

       

      Finally only 20 records is loaded. What is wrong with pool?