Problem using @UseStringTemplate3StatementLocator annotation.

3,445 views
Skip to first unread message

Gopikrishna VM

unread,
Jul 10, 2015, 12:08:38 AM7/10/15
to dropwiz...@googlegroups.com
Hi All,

I'm using JDBI in my Dropwizard project. I need to use a dynamic variable in one of my query, for that I added @UseStringTemplate3StatementLocator annotation. But after adding the annotation, my application is not coming up. It is throwing below error. Can any one help please...

INFO  [2015-07-08 12:55:56,978] org.eclipse.jetty.util.log: Logging initialized @2058ms
INFO  [2015-07-08 12:55:57,138] io.dropwizard.assets.AssetsBundle: 
Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.skife.jdbi.v2.sqlobject.stringtemplate.UseStringTemplate3StatementLocator.errorListener()
at java.lang.reflect.Method.getDefaultValue(Method.java:611)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:128)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(Hi All,

I'm using JDBI in my Dropwizard project. I need to use a dynamic variable in one of my query, for that I added @UseStringTemplate3StatementLocator annotation. But after adding the annotation, my application is not coming up. It is throwing below error. Can any one help please...

INFO  [2015-07-08 12:55:56,978] org.eclipse.jetty.util.log: Logging initialized @2058ms
INFO  [2015-07-08 12:55:57,138] io.dropwizard.assets.AssetsBundle: 
Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.skife.jdbi.v2.sqlobject.stringtemplate.UseStringTemplate3StatementLocator.errorListener()
at java.lang.reflect.Method.getDefaultValue(Method.java:611)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:128)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotations(Class.java:3446)
at org.skife.jdbi.v2.sqlobject.CustomizingStatementHandler.<init>(CustomizingStatementHandler.java:43)
at org.skife.jdbi.v2.sqlobject.QueryHandler.<init>(QueryHandler.java:31)Hi All,

I'm using JDBI in my Dropwizard project. I need to use a dynamic variable in one of my query, for that I added @UseStringTemplate3StatementLocator annotation. But after adding the annotation, my application is not coming up. It is throwing below error. Can any one help please...

INFO  [2015-07-08 12:55:56,978] org.eclipse.jetty.util.log: Logging initialized @2058ms
INFO  [2015-07-08 12:55:57,138] io.dropwizard.assets.AssetsBundle: 
Exception in thread "main" java.lang.annotation.AnnotatiHi All,

I'm using JDBI in my Dropwizard project. I need to use a dynamic variable in one of my query, for that I added @UseStringTemplate3StatementLocator annotation. But after adding the annotation, my application is not coming up. It is throwing below error. Can any one help please...

INFO  [2015-07-08 12:55:56,978] org.eclipse.jetty.util.log: Logging initialized @2058ms
INFO  [2015-07-08 12:55:57,138] io.dropwizard.assets.AssetsBundle: 
Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.skife.jdbi.v2.sqlobject.stringtemplate.UseStringTemplate3StatementLocator.errorListener()
at java.lang.reflect.Method.getDefaultValue(Method.java:611)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:128)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotations(Class.java:3446)
at org.skife.jdbi.v2.sqlobject.CustomizingStatementHandler.<init>(CustomizingStatementHandler.java:43)
at org.skife.jdbi.v2.sqlobject.QueryHandler.<init>(QueryHandler.java:31)
at org.skife.jdbi.v2.sqlobject.SqlObject.buildHandlersFor(SqlObject.java:113)
at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject(SqlObject.java:69)
at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.onDemand(SqlObjectBuilder.java:66)
at org.skife.jdbi.v2.DBI.onDemand(DBI.java:350)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
at io.dropwizard.cli.Cli.run(Cli.java:70)
at io.dropwizard.Application.run(Application.java:73)

onFormatError: Invalid default: public abstract java.lang.Class org.skife.jdbi.v2.sqlobject.stringtemplate.UseStringTemplate3StatementLocator.errorListener()
at java.lang.reflect.Method.getDefaultValue(Method.java:611)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:128)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotations(Class.java:3446)
at org.skife.jdbi.v2.sqlobject.CustomizingStatementHandler.<init>(CustomizingStatementHandler.java:43)
at org.skife.jdbi.v2.sqlobject.QueryHandler.<init>(QueryHandler.java:31)
at org.skife.jdbi.v2.sqlobject.SqlObject.buildHandlersFor(SqlObject.java:113)
at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject(SqlObject.java:69)
at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.onDemand(SqlObjectBuilder.java:66)
at org.skife.jdbi.v2.DBI.onDemand(DBI.java:350)

at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
at io.dropwizard.cli.Cli.run(Cli.java:70)
at io.dropwizard.Application.run(Application.java:73)


at org.skife.jdbi.v2.sqlobject.SqlObject.buildHandlersFor(SqlObject.java:113)
at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject(SqlObject.java:69)
at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.onDemand(SqlObjectBuilder.java:66)
at org.skife.jdbi.v2.DBI.onDemand(DBI.java:350)

at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
at io.dropwizard.cli.Cli.run(Cli.java:70)
at io.dropwizard.Application.run(Application.java:73)
AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotations(Class.java:3446)
at org.skife.jdbi.v2.sqlobject.CustomizingStatementHandler.<init>(CustomizingStatementHandler.java:43)
at org.skife.jdbi.v2.sqlobject.QueryHandler.<init>(QueryHandler.java:31)
at org.skife.jdbi.v2.sqlobject.SqlObject.buildHandlersFor(SqlObject.java:113)
at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject(SqlObject.java:69)
at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.onDemand(SqlObjectBuilder.java:66)
at org.skife.jdbi.v2.DBI.onDemand(DBI.java:350)

at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
at io.dropwizard.cli.Cli.run(Cli.java:70)
at io.dropwizard.Application.run(Application.java:73)


Saumitra Bhave

unread,
Jul 30, 2015, 11:48:53 AM7/30/15
to dropwizard-user
I think its because the String Template library is assumed to be provided and that assumption fails at runtime. Adding following to the POM fixed the issue for me.
<dependency>
<groupId>org.antlr</groupId>
<artifactId>stringtemplate</artifactId>
<version>3.2</version>
</dependency>


By looking at JDBI 2 pom, you can see following,
<dependency>
<groupId>org.antlr</groupId>
<artifactId>stringtemplate</artifactId>
<version>3.2.1</version>
<optional>true</optional>
</dependency>
Meaning jdbi wont complain on absence of stringtemplate lib.

Hope that helps.

Reply all
Reply to author
Forward
0 new messages