Code Monkey home page Code Monkey logo

jcabi-dynamo's Introduction

logo

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn PDD status Maven Central Hits-of-Code License

This project is just a parent POM for all other Java projects in "jcabi family".

See www.jcabi.com website for more details.

jcabi-dynamo's People

Contributors

amihaiemil avatar gvlasov avatar jrdalpra avatar nathansgreen avatar nhekfqn avatar prondzyn avatar renovate[bot] avatar romankisilenko avatar rultor avatar sandordargo avatar simonjenga avatar super132 avatar tkjee avatar valery1707 avatar yegor256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jcabi-dynamo's Issues

Can't get integration test to work

Note I had to append the suffix "Test" to the file name so that mvn test would execute it.

iteratesItems(com.jcabi.dynamo.AwsIteratorITCaseTest)  Time elapsed: 0.008 sec  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class com.jcabi.dynamo.RegionMock
        at com.jcabi.dynamo.AwsIteratorITCaseTest.iteratesItems(AwsIteratorITCaseTest.java:57)
        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:497)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        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.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:318)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)

`String table` parameter in MkData methods doesn't make sense

MkData represents data of a table. Conceptually it is wrong to require table's name to search for data in an object that represents the data of a table, because table name should not matter. But each of MkData methods requires a table name as a parameter. Clients of MkData are not supposed to know the name of the table, because there is no table โ€” only its records.

Now, I see why that parameter is in the methods' signatures in the first place: it is the implementation of H2Data leaking into the MkData interface's signature. H2Data does need the name of a table. But nevertheless the name of a table should not be a parameter of MkData methods, but instead a constructor parameter in H2Data.

NotNull annotations are inconsistently used

There are many classes that contain methods whose arguments are annotated with @NotNull, and also some methods that don't have those annotations. I'm speaking strictly about methods whose parameters are descendants of Object.

For example, AttributeUpdates#with(String,AttributeValue) and AttributeUpdates#with(String,Object) methods lack @NotNull validation for their arguments. Other AttributeUpdates#with methods have those annotations for their arguments.

Also, I'm not sure if methods inherited from Map that have proper implementations, like AttributeUpdates#containsKey(Object) and unlike AttributeUpdates#remove(Object), should have their parameters annotated with @NotNull as well.

Other examples of inconsistent @NotNull usage are: QueryValve#withSelect(Select), QueryValve#withIndexName(String).


- ~~`56-be65f863`/#64~~ (by Jose Volmei Dal Pra Junior) - `56-9ee1f8fe`/#65 (by Mihai Emil Andronache)

AwsTable#print needs to be extracted in a separate class

AwsTable#print is a pubilc static method that operates on public methods of its argument ConsumedCapacity. It could be made into an instance method of PrintableConsumedCapacity class, so we have one less public static method in our codebase.

Throughput.java:76-76: The exact algorithm for figuring...

Puzzle 10-d74a245f in src/main/java/com/jcabi/dynamo/Throughput.java:76-76 has to be resolved: The exact algorithm for figuring out read and write... The puzzle was created by Suseika on 16-Jun-2015.

If you have any technical questions, don't ask me, submit new tickets instead

ReTable.java:101-102: Implement ReTable.delete() operation. delete() method...

Puzzle 8-81cf3845 in src/main/java/com/jcabi/dynamo/retry/ReTable.java:101-102 has to be resolved: Implement ReTable.delete() operation. delete() method added to Table interface and implemented in AwsTable class so far.... The puzzle was created by Nikolay Popov on 28-Jan-2015.

If you have any technical questions, don't ask me, submit new tickets instead

Upgrade to jcabi 1.15

Without this upgrade jcabi-dynamo can't be used in proejcts that depend on jcabi-aspects >= 0.18 (missing @Immutable.Array on arrays).

RegionITCase.java:53-56: integration test fails when adding...

Puzzle 56-9ee1f8fe in src/test/java/com/jcabi/dynamo/RegionITCase.java:53-56 has to be resolved: integration test fails when adding @NotNull to constraints this needs to be fixed in methods RegionITCase.worksWithAmazon() and RegionITCase.retrievesAttributesFromDynamo(). Also see AwsIteratorITCase.... The puzzle was created by tkjee on 5-Oct-2015.

If you have any technical questions, don't ask me, submit new tickets instead

MkTable.java:106-107: Implement MkTable.delete() operation. delete() method...

Puzzle 8-abdd4627 in src/main/java/com/jcabi/dynamo/mock/MkTable.java:106-107 has to be resolved: Implement MkTable.delete() operation. delete() method added to Table interface and implemented in AwsTable class so far.... The puzzle was created by Nikolay Popov on 28-Jan-2015.

If you have any technical questions, don't ask me, submit new tickets instead

Can't retrieve attributes with uppercase letters

Since dynamodb attribute names are case sensitive, what is the reason to convert all attribute name to lowercase in AwsItem and Conditions classes? This makes it impossible to retrieve attributes with uppercase letters in their names. Thanks.

It is not clear how we're supposed to use MkData

Its put() and update() methods have nearly identical description in the javadoc. It is not clear what is the keys parameter in the update() method for.

The javadoc text for the methods should tell what is the difference between them and what excaclty the keys parameter is for.

H2Data does not support names with ".", "-", or digits

I encountered this issue while working on yegor256/s3auth#90.

In S3Auth, the table and attribute names contain . characters, e.g. domain.name. However, H2 does not allow this, but [http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html](Amazon Dynamo DB) does; Dynamo DB allows - characters and digits 0-9 for table names, and attributes can be any UTF-8 character.

This is something that we should take into account, as other users of this library may also be using names that are not allowed by H2Data but allowed by Dynamo DB.

Support for deleting items

We're looking to migrate the S3Auth project to jcabi-dynamo (yegor256/s3auth#90). In jcabi-dynamo, there doesn't appear to be any support for deleting items:

        final AmazonDynamoDB amazon = this.client.get();
        amazon.deleteItem(
            new DeleteItemRequest(
                this.table,
                new ImmutableMap.Builder<String, AttributeValue>()
                    .put(DefaultDynamo.NAME, new AttributeValue(domain.name()))
                    .build()
            )
        );

What I end up doing is that I get the AmazonDynamoDB instance from Region. Can we add support for it in jcabi-dynamo?

Qulice configuration - no license specified.

  1. Checkout master branch
  2. run mvn qulice:check -Pqulice
  3. There are multiple Line does not match expected header line of ' * BSD License'. (HeaderCheck) messages.

This is a known bug of qulice configuration in parent-0.31 (jcabi/jcabi-parent#19), accessed via jcabi-0.16. Suggested action is waiting until jcabi/jcabi#297 fix is released and upgrading jcabi version.

com.jcabi.dynamo.Throughput

migrated from jcabi/jcabi#276

Let's implement a class com.jcabi.dynamo.Throughput, which would be able to change throughput of a table according to certain parameters of elasticity/scalability. For example:

final Region region = //...
final Table table = region.table("my-users");
new Throughput(table).adjust();

The class is intended to be executed regularly (every few minutes). It has to use the same AWS credentials to access CloudWatch metrics.


- `10-d74a245f`/#46 (by ) - `10-41088ed2`/#75 (by )

H2Data cannot cope with periods in column names

If you use H2Data with column names with dots such as user.urn, domain.name, domain.key etc. in a unit test like com.s3auth.hosts.DefaultDynamoTest#loadsDynamoConfiguration

    public void loadsDynamoConfiguration() throws Exception {
        final H2Data data = new H2Data().with(
            TABLE,
            new String[]
            {
                DefaultDynamo.USER,
            },
            new String[]
            {
                DefaultDynamo.NAME,
                DefaultDynamo.KEY,
                DefaultDynamo.SECRET,
                DefaultDynamo.REGION,
                DefaultDynamo.BUCKET,
                DefaultDynamo.SYSLOG,
            }
        );
        for (int num = 0; num < Tv.TWENTY; ++num) {
            data.put(
                TABLE,
                new Attributes(
                    this.item()
                )
            );
        }
        final Region region = new MkRegion(data);
        final RegionCreator regionCreator = Mockito.mock(RegionCreator.class);
        Mockito.when(regionCreator.createRegion()).thenReturn(region);
        final DefaultDynamo dynamo = new DefaultDynamo(
            regionCreator, TABLE
        );
        final int size = dynamo.load().size();
        MatcherAssert.assertThat(
            dynamo.load().size(),
            Matchers.is(size)
        );
        dynamo.add(new URN("urn:test:alpha"), new DomainMocker().mock());
        MatcherAssert.assertThat(
            dynamo.load().size(),
            Matchers.is(size + 1)
        );
        dynamo.close();
    }

then during the test run you get an exception like this:

[[0;31mERROR[m] com.jcabi.jdbc.JdbcSession: #execute(): thrown java.sql.SQLException(org.h2.jdbc.JdbcSQLException: Unbekannter Datentyp: "."
Unknown data type: "."; SQL statement:
CREATE TABLE table (user.urn VARCHAR PRIMARY KEY,domain.name CLOB,domain.key CLOB,domain.secret CLOB,domain.region CLOB,domain.bucket CLOB,domain.syslog CLOB) [50004-176]) out of com.jcabi.jdbc.JdbcSession#run[418] in 732ms

java.io.IOException: java.sql.SQLException: org.h2.jdbc.JdbcSQLException: Unbekannter Datentyp: "."
Unknown data type: "."; SQL statement:
CREATE TABLE table (user.urn VARCHAR PRIMARY KEY,domain.name CLOB,domain.key CLOB,domain.secret CLOB,domain.region CLOB,domain.bucket CLOB,domain.syslog CLOB) [50004-176]
    at com.jcabi.dynamo.mock.H2Data.with_aroundBody6(H2Data.java:291)
    at com.jcabi.dynamo.mock.H2Data$AjcClosure7.run(H2Data.java:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
    at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:212)
    at com.jcabi.aspects.aj.MethodLogger.ajc$inlineAccessMethod$com_jcabi_aspects_aj_MethodLogger$com_jcabi_aspects_aj_MethodLogger$wrap(MethodLogger.java:1)
    at com.jcabi.aspects.aj.MethodLogger.wrapClass(MethodLogger.java:136)
    at com.jcabi.dynamo.mock.H2Data.with(H2Data.java:269)
    at com.s3auth.hosts.DefaultDynamoTest.loadsDynamoConfiguration(DefaultDynamoTest.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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    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.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.sql.SQLException: org.h2.jdbc.JdbcSQLException: Unbekannter Datentyp: "."
Unknown data type: "."; SQL statement:
CREATE TABLE table (user.urn VARCHAR PRIMARY KEY,domain.name CLOB,domain.key CLOB,domain.secret CLOB,domain.region CLOB,domain.bucket CLOB,domain.syslog CLOB) [50004-176]
    at com.jcabi.jdbc.JdbcSession.run(JdbcSession.java:418)
    at com.jcabi.jdbc.JdbcSession.execute_aroundBody12(JdbcSession.java:329)
    at com.jcabi.jdbc.JdbcSession$AjcClosure13.run(JdbcSession.java:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
    at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:212)
    at com.jcabi.aspects.aj.MethodLogger.ajc$inlineAccessMethod$com_jcabi_aspects_aj_MethodLogger$com_jcabi_aspects_aj_MethodLogger$wrap(MethodLogger.java:1)
    at com.jcabi.aspects.aj.MethodLogger.wrapClass(MethodLogger.java:136)
    at com.jcabi.jdbc.JdbcSession.execute(JdbcSession.java:329)
    at com.jcabi.dynamo.mock.H2Data.with_aroundBody6(H2Data.java:289)
    ... 33 more
Caused by: org.h2.jdbc.JdbcSQLException: Unbekannter Datentyp: "."
Unknown data type: "."; SQL statement:
CREATE TABLE table (user.urn VARCHAR PRIMARY KEY,domain.name CLOB,domain.key CLOB,domain.secret CLOB,domain.region CLOB,domain.bucket CLOB,domain.syslog CLOB) [50004-176]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
    at org.h2.message.DbException.get(DbException.java:178)
    at org.h2.message.DbException.get(DbException.java:154)
    at org.h2.command.Parser.parseColumnWithType(Parser.java:3963)
    at org.h2.command.Parser.parseColumnForTable(Parser.java:3826)
    at org.h2.command.Parser.parseCreateTable(Parser.java:5723)
    at org.h2.command.Parser.parseCreate(Parser.java:4122)
    at org.h2.command.Parser.parsePrepared(Parser.java:351)
    at org.h2.command.Parser.parse(Parser.java:306)
    at org.h2.command.Parser.parse(Parser.java:278)
    at org.h2.command.Parser.prepareCommand(Parser.java:243)
    at org.h2.engine.Session.prepareLocal(Session.java:442)
    at org.h2.engine.Session.prepareCommand(Session.java:384)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188)
    at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
    at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276)
    at com.jcabi.jdbc.JdbcSession$3.statement(JdbcSession.java:341)
    at com.jcabi.jdbc.JdbcSession.run(JdbcSession.java:398)
    ... 41 more

[[0;31mERROR[m] com.jcabi.dynamo.mock.H2Data: #with('table', ['user.urn'], ['domain.name', 'domain.key', 'domain.secret', 'domain.region', 'domain.bucket', 'domain.syslog']): thrown java.io.IOException(java.sql.SQLException: org.h2.jdbc.JdbcSQLException: Unbekannter Datentyp: "."
Unknown data type: "."; SQL statement:
CREATE TABLE table (user.urn VARCHAR PRIMARY KEY,domain.name CLOB,domain.key CLOB,domain.secret CLOB,domain.region CLOB,domain.bucket CLOB,domain.syslog CLOB) [50004-176]) out of com.jcabi.dynamo.mock.H2Data#with_aroundBody6[291] in 5s

Please make sure that jcabi-dynamo can work with column names that contain periods (e. g. by replacing the periods by dots transparently to the user).

log4j for Dynamodb

Hi Yergor,
I am trying with storing log files into Dynamodb. what I did:
I created one class 'DynamoAppender' which extends 'AppenderSkeleton' and added jar 'jcabi-dynamo-0.8.jar' into it. and then I created a jar file of this class. then I created a new application and added the newly created jar file into it. and added a log4j property file into the application. these are the errors I am getting when I am trying with the given java file and log4j.properties.

please tell me a solution for this.

Thanks....
Nimms

ERRORS
---------------
javax.servlet.ServletException: Servlet execution threw an exception


root cause 

java.lang.NoClassDefFoundError: javax/validation/ConstraintViolationException
    com.jcabi.dynamo.Credentials$Simple.<init>(Credentials.java:99)
    com.Vehicle.dynamodbAppender.DynamoAppender.append(DynamoAppender.java:36)
    org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
    org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
    org.apache.log4j.Category.callAppenders(Category.java:206)
    org.apache.log4j.Category.forcedLog(Category.java:391)
    org.apache.log4j.Category.info(Category.java:666)
    com.Vehicle.web.FrontController.doGet(FrontController.java:42)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause 

java.lang.ClassNotFoundException: javax.validation.ConstraintViolationException
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    com.jcabi.dynamo.Credentials$Simple.<init>(Credentials.java:99)
    com.Vehicle.dynamodbAppender.DynamoAppender.append(DynamoAppender.java:36)
    org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
    org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
    org.apache.log4j.Category.callAppenders(Category.java:206)
    org.apache.log4j.Category.forcedLog(Category.java:391)
    org.apache.log4j.Category.info(Category.java:666)
    com.mindtree.web.FrontController.doGet(FrontController.java:42)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
_____________________________________________________________________________________

Sep 25, 2013 12:06:02 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;%M2%;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;%JAVA_HOME%\bin;C:\TC\BIN;C:\Program Files\Apache Software Foundation\apache-maven-3.0.4\bin;C:\Program Files\Java\jdk1.6.0_25\bin;D:\Temp\SOFTWARES\eclipse-jee-juno-win32\eclipse;
Sep 25, 2013 12:06:03 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:VehicleRental' did not find a matching property.
Sep 25, 2013 12:06:03 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 25, 2013 12:06:03 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 983 ms
Sep 25, 2013 12:06:03 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 25, 2013 12:06:03 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.33
Sep 25, 2013 12:06:03 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 25, 2013 12:06:03 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 25, 2013 12:06:03 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/48  config=null
Sep 25, 2013 12:06:03 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 651 ms
log4j:WARN No such property [file] in com.Vehicle.dynamodbAppender.DynamoAppender.
log4j:WARN No such property [maxBackupIndex] in com.mindtree.dynamodbAppender.DynamoAppender.
log4j:WARN No such property [maxFileSize] in com.Vehicle.dynamodbAppender.DynamoAppender.
SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Sep 25, 2013 12:06:06 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet FrontController threw exception
java.lang.ClassNotFoundException: javax.validation.ConstraintViolationException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at com.jcabi.dynamo.Credentials$Simple.<init>(Credentials.java:99)
    at com.Vehicle.dynamodbAppender.DynamoAppender.append(DynamoAppender.java:36)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
    at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
    at org.apache.log4j.Category.callAppenders(Category.java:206)
    at org.apache.log4j.Category.forcedLog(Category.java:391)
    at org.apache.log4j.Category.info(Category.java:666)
    at com.Vehicle.web.FrontController.doGet(FrontController.java:42)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Unknown Source)

DynamoAppender.Java:

/**
 * 
 */
package com.vehicle.dynamodbAppender;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.LoggingEvent;

import com.jcabi.dynamo.Attributes;
import com.jcabi.dynamo.Credentials;
import com.jcabi.dynamo.Region;
import com.jcabi.dynamo.Table;

/**
 * @author Nimms
 *
 */
public class DynamoAppender extends AppenderSkeleton{

    @Override
    public void close() {
        // TODO Auto-generated method stub

    }

    @Override
    public boolean requiresLayout() {
        // TODO Auto-generated method stub
        return true;
    }

    @Override
    protected void append(LoggingEvent event) {

        Credentials credentials = new Credentials.Simple("My-Accesskey", "My-Secretkey");
        Region region = new Region.Simple(credentials);
        LogLog.debug("Putting Into dynamoDb");
        Table table = region.table("AppLog");
        LogLog.debug("Putting into db table");
        table.put( new Attributes()
            .with("time", System.currentTimeMillis())
            .with("message", this.layout.format(event))
        );
      }


    }

log4j.properties:

# Root logger option
log4j.rootLogger=DEBUG, file
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file=com.vehicle.dynamodbAppender.DynamoAppender
log4j.appender.file.File=d:/122.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

Incomplete documentation of wheher Regions must be shut down

The current documentation of the Region interface is not complete as it doesn't specify whether or not the region must be shut down after all operations are finished.

How to fix

In the header comments of the com.jcabi.dynamo.Region describe whether or not code similar to one shown below must be called after all operations have been completed.

protected void shutdownAws(final Region region) {
    final AmazonDynamoDB aws = region.aws();

    if (aws != null)
    {
        aws.shutdown();
    }
}

H2Data don't support multiple tables

Suppose I want to create two tables that somehow relate to each other. Current H2Data implementation only allows one table to be created using the with method:

new H2Data().with("users", new String[] {"name"}, new String[0])

I believe that a good fit would be something like:

new H2Data()
  .with("users", new String[] {"name"}, new String[0])
  .with("tenants", new String[] {"id"}, new String[0])
  .get() // or done() or build() or something else

Indie tech review no.1

Review our existing source code and all other technical artifacts and report at least 8 bugs. More about such reviews you can read here. The task will be closed once we have that bugs reported and classified. Don't forget to add itr tag to each of them.

0.19

Please, publish a new release 0.19 (or higher). Don't forget to update us here regularly (at least once a week), as explained in this article.

Problem running AwsIteratorITCase.java test

Hi,
I forked, cloned and ran all mvn tests in the project. As result there were no failing tests.
After I commented out @ignore annotation for iteratesItems() and iteratesItemsAndDeletes() in src/test/java/com/jcabi/dynamo/AwsIteratorITCase.java
and run: mvn test -Dtest=com.jcabi.dynamo.AwsIteratorITCase
they failed with a NumberFormatException wrapped into ExceptionInInitializerError:

ava.lang.ExceptionInInitializerError
    at com.jcabi.dynamo.AwsIteratorITCase.iteratesItems(AwsIteratorITCase.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    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.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:318)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: null
    at java.lang.Integer.parseInt(Integer.java:454)
    at java.lang.Integer.parseInt(Integer.java:527)
    at com.jcabi.dynamo.RegionMock.<clinit>(RegionMock.java:63)
    ... 19 more

It looks like failsafe.port environment variable is missing. Where can I find this variable? Or may be I'm doing something wrong?

AwsIteratorITCase.java:51-53: Integration test fail when adding...

Puzzle 56-be65f863 in src/test/java/com/jcabi/dynamo/AwsIteratorITCase.java:51-53 has to be resolved: Integration test fail when adding @NotNull constraint this should be fixed in methods AwsIteratorITCase.iteratesItems() and AwsIteratorITCase.iteratesItemsAndDeletes(). Also see RegionITCase... The puzzle was created by tkjee on 5-Oct-2015.

If you have any technical questions, don't ask me, submit new tickets instead

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.