I'm creating a custom trigger for casssandra.
So, to get the metadata, the statement in the given example trigger file fails.
TableMetadata metadata = Schema.instance.getTableMetadata(auditKeyspace, auditTable);
I get this error while build
AuditTrigger.java:27: error: package org.apaceh.cassandra.schema does not exist
[javac] import org.apaceh.cassandra.schema.TableMetadata;
[javac] ^
[javac] /home/bkoganti/cassandra/examples/triggers/src/org/apache/cassandra/triggers/AuditTrigger.java:28: error: cannot find symbol
[javac] import org.apache.cassandra.schema.Schema;
[javac] ^
[javac] symbol: class Schema
[javac] location: package org.apache.cassandra.schema
[javac] /home/bkoganti/cassandra/examples/triggers/src/org/apache/cassandra/triggers/AuditTrigger.java:50: error: cannot find symbol
[javac] TableMetadata metadata = Schema.instance.getTableMetadata(auditKeyspace, auditTable);
[javac] ^
[javac] symbol: class TableMetadata
[javac] location: class AuditTrigger
[javac] /home/bkoganti/cassandra/examples/triggers/src/org/apache/cassandra/triggers/AuditTrigger.java:50: error: package Schema does not exist
[javac] TableMetadata metadata = Schema.instance.getTableMetadata(auditKeyspace, auditTable);
[javac] ^
[javac] 4 errors
There is no class TableMetadata and Schema available.
So, how do I get the metadata using the keyspace name and table name.
This is a typo missed during some refactors. I created a jira and provided patch with fix here CASSANDRA-13796 you can see the change on github
audit.row()
.add("keyspace_name", update.metadata().keyspace)
- .add("table_name", update.metadata().table)
+ .add("table_name", update.metadata().name)
.add("primary_key", update.metadata().partitionKeyType.getString(update.partitionKey().getKey()));
Related
I am running my build.xml as 1 Ant Build .
I have jdk and jre 1.7.0_80 installed on the machine; this is the console log :
Buildfile: C:\Users\Alessandro\workspace\cqwebapp\build.xml
clean:
[delete] Deleting directory C:\Users\Alessandro\workspace\cqwebapp\build
init:
[mkdir] Created dir: C:\Users\Alessandro\workspace\cqwebapp\build
[mkdir] Created dir: C:\Users\Alessandro\workspace\cqwebapp\build\classes
compile:
[javac] Compiling 85 source files to C:\Users\Alessandro\workspace\cqwebapp\build\classes
[javac] An exception has occurred in the compiler (1.7.0_80). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
[javac] java.lang.NullPointerException
[javac] at com.sun.tools.javac.file.Paths.getPathEntries(Paths.java:215)
[javac] at com.sun.tools.javac.file.Paths.getPathEntries(Paths.java:200)
[javac] at com.sun.tools.javac.file.Paths.computeBootClassPath(Paths.java:389)
[javac] at com.sun.tools.javac.file.Paths.lazy(Paths.java:166)
[javac] at com.sun.tools.javac.file.JavacFileManager.getLocation(JavacFileManager.java:857)
[javac] at com.sun.tools.javac.file.JavacFileManager.hasLocation(JavacFileManager.java:674)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.initProcessorIterator(JavacProcessingEnvironment.java:224)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.<init>(JavacProcessingEnvironment.java:188)
[javac] at com.sun.tools.javac.main.JavaCompiler.initProcessAnnotations(JavaCompiler.java:992)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:821)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:439)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:342)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:333)
[javac] at com.sun.tools.javac.Main.compile(Main.java:76)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:57)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1160)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:936)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
[javac] at jdk.internal.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
[javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[javac] at org.apache.tools.ant.Task.perform(Task.java:348)
[javac] at org.apache.tools.ant.Target.execute(Target.java:435)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
[javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[javac] at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
[javac] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:705)
[javac] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:527)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[javac] at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[javac] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:371)
[javac] at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:269)
[javac] at java.base/java.lang.Thread.run(Unknown Source)
BUILD FAILED
C:\Users\Alessandro\workspace\cqwebapp\build.xml:36: Compile failed; see the compiler error output for details.
Total time: 546 milliseconds
Those images are :
The jdk1.7.0_80 folder ( gained by installing the corrispective
jdk.exe from Oracle Website)
The JRE
the current Compiler selected
Build Path pt1
Build Path pt2
I've Java polyglot application which mainly has Java code and uses few Scala libraries as well.
The Scala below code compiles fine.
import com.twitter.finagle.Http.Client
import com.twitter.finagle.Http
import com.twitter.finagle.param.Logger
object Main extends App {
private val loggerFinagle = java.util.logging.Logger.getLogger("FinagleLogger")
val client: Client = Http.client
.configured(Logger(loggerFinagle))
}
I write the same code in java as below
import com.twitter.finagle.Http;
import com.twitter.finagle.param.Logger;
public class JavaMain {
public static void main(String[] args) {
java.util.logging.Logger loggerFinagle = java.util.logging.Logger.getLogger("FinagleLogger");
Http.client()
.configured(new Logger(loggerFinagle));
}
}
When I compile the code I get below error -
[info] Compiling 1 Scala source and 1 Java source to /Users/rajkumar.natarajan/Documents/Coding/finagle-errors/target/scala-2.12/classes ...
[error] /Users/rajkumar.natarajan/Documents/Coding/finagle-errors/src/main/java/JavaMain.java:10:1: no suitable method found for configured(com.twitter.finagle.param.Logger)
[error] method com.twitter.finagle.Stack.Parameterized.<P>configured(P,com.twitter.finagle.Stack.Param<P>) is not applicable
[error] (cannot infer type-variable(s) P
[error] (actual and formal argument lists differ in length))
[error] method com.twitter.finagle.Stack.Parameterized.<P>configured(scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>) is not applicable
[error] (cannot infer type-variable(s) P
[error] (argument mismatch; com.twitter.finagle.param.Logger cannot be converted to scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>))
[error] method com.twitter.finagle.client.StackClient.<P>configured(P,com.twitter.finagle.Stack.Param<P>) is not applicable
[error] (cannot infer type-variable(s) P
[error] (actual and formal argument lists differ in length))
[error] method com.twitter.finagle.client.StackClient.<P>configured(scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>) is not applicable
[error] (cannot infer type-variable(s) P
[error] (argument mismatch; com.twitter.finagle.param.Logger cannot be converted to scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>))
[error] method com.twitter.finagle.client.EndpointerStackClient.<P>configured(P,com.twitter.finagle.Stack.Param<P>) is not applicable
[error] (cannot infer type-variable(s) P
[error] (actual and formal argument lists differ in length))
[error] method com.twitter.finagle.client.EndpointerStackClient.<P>configured(scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>) is not applicable
[error] (cannot infer type-variable(s) P
[error] (argument mismatch; com.twitter.finagle.param.Logger cannot be converted to scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>))
[error] method com.twitter.finagle.Http.Client.<P>configured(scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>) is not applicable
[error] (cannot infer type-variable(s) P
[error] (argument mismatch; com.twitter.finagle.param.Logger cannot be converted to scala.Tuple2<P,com.twitter.finagle.Stack.Param<P>>))
[error] Http.client()
[error] .configured
Looks like I've to pass the Tuple but I don't know how.
The project in github is here.
Below are dependency details of my project -
Scala Version - 2.12.6
Java Version - 1.8.0_151
finagle version - 7.1.0
According to the docs, you need to call the mk() method on the param, so something like the following should create the proper tuple:
Http.client()
.configured(new Logger(loggerFinagle).mk());
I am trying to import a module from another project and did as following:
As you can see on the image, the imported library is /home/developer/...kafka-api.
I am using the importing library in testing.
When I compile my spec files with statement test:compile and I've got following error:
[IJ]sbt:auth_stream> test:compile
[info] Compiling 3 Scala sources to /home/developer/Desktop/microservices/bary/auth-stream/target/scala-2.12/test-classes ...
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:14:20: object kkapi is not a member of package io.khinkali
[error] import io.khinkali.kkapi.consumer.{KkConsumer, KkConsumerConfig, KkConsumerCreator}
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:15:20: object kkapi is not a member of package io.khinkali
[error] import io.khinkali.kkapi.producer.{KkProducer, KkProducerCreator, MaxBlockMsConfig}
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:24:56: not found: value KkConsumer
[error] private val consumer: IO[Consumer[String, String]] = KkConsumer.create(createConsumer())
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:52:5: not found: type KkConsumerCreator
[error] : KkConsumerCreator
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:25:56: not found: value KkProducer
[error] private val producer: IO[Producer[String, String]] = KkProducer.create(createProducer())
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:46:5: not found: type KkProducerCreator
[error] : KkProducerCreator
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:47:5: not found: value KkProducerCreator
[error] = KkProducerCreator(sys.env.get("KAFKA_SERVER").get,
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:49:10: not found: value MaxBlockMsConfig
[error] List(MaxBlockMsConfig(2000)))
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:53:5: not found: value KkConsumerCreator
[error] = KkConsumerCreator(sys.env.get("KAFKA_SERVER").get,
[error] ^
[error] /home/developer/Desktop/microservices/bary/auth-stream/src/test/scala/io/khinkali/auth/AppSpec.scala:57:16: not found: type KkConsumerConfig
[error] List.empty[KkConsumerConfig])
[error] ^
[error] 10 errors found
[error] (test:compileIncremental) Compilation failed
What am I doing wrong?
Hint, that the package of both project starts with the name, namely:
The current project:
The imported project:
As you can see, the name differs only at the end. Could it be the problem?
What I am trying to approach is, to use a function for kafka-api project.
I am trying to use Scallop (https://github.com/scallop/scallop/) to parse the command-line arguments in Scala.
However, I cannot compile the example for converting arguments to a case class as shown on https://github.com/scallop/scallop/wiki/Custom-converters.
I get two errors at compile-time:
[error] found : org.rogach.scallop.ValueConverter[center.scala.sbk.Commands.Person]{val nameRgx: scala.util.matching.Regex; val phoneRgx: scala.util.matching.Regex}
[error] required: String
[error] Error occurred in an application involving default arguments.
[error] val person = opt[Person](personConverter)
[error] ^
and
[error] ...: could not find implicit value for parameter conv: org.rogach.scallop.ValueConverter[center.scala.sbk.Commands.Person]
[error] Error occurred in an application involving default arguments.
[error] val person = opt[Person](personConverter)
[error] ^
Thank you for your help!
The documentation has a typo.
Use
val person = opt[Person]()(personConverter) // note the parentheses
instead of
val person = opt[Person](personConverter)
since personConverter is passed in implicit arguments.
I have the code shown here
http://scastie.org/10156
report the error
when running sbt 0.13.8
plugin assembly
I get
[error] /home/xx/workspace/sync-hsae-middleware/src/test/scala/com/example/MyServiceSpec.scala:8: not found: type MyService
[error] class MyServiceSpec extends Specification with Specs2RouteTest with MyService {
[error] ^
[error] /home/xx/workspace/sync-hsae-middleware/src/test/scala/com/example/MyServiceSpec.scala:14: not found: value myRoute
[error] Get() ~> myRoute ~> check {
[error] ^
[error] two errors found
[error] (test:compileIncremental) Compilation failed
[error] Total time: 5 s, completed 10/06/2015 15:00:15
*/
I can't figure out what is the issue because when I use
sbt run it works well.