Exception (org.apache.cassandra.exceptions.ConfigurationException) encountered during startup: Invalid yaml - cassandra

I have to modify the source code of Cassandraļ¼Œbut when I debug the cassandraDaemon suggested by https://cassandra.apache.org/_/development/ide.html , I have this strange error:
`
Invalid yaml: file:/home/cjx/Downloads/depart0/depart-main/conf/cassandra.yaml
Error: null; Can't construct a java object for tag:yaml.org,2002:org.apache.cassandra.config.Config; exception=java.lang.reflect.InvocationTargetException; in 'reader', line 10, column 1:
cluster_name: 'Test Cluster'
^
Exception (org.apache.cassandra.exceptions.ConfigurationException) encountered during startup: Invalid yaml: file:/home/cjx/Downloads/depart0/depart-main/conf/cassandra.yaml
Error: null; Can't construct a java object for tag:yaml.org,2002:org.apache.cassandra.config.Config; exception=java.lang.reflect.InvocationTargetException; in 'reader', line 10, column 1:
cluster_name: 'Test Cluster'
^
19:29:07.494 [main] ERROR o.a.c.service.CassandraDaemon - Exception encountered during startup: Invalid yaml: file:/home/cjx/Downloads/depart0/depart-main/conf/cassandra.yaml
Error: null; Can't construct a java object for tag:yaml.org,2002:org.apache.cassandra.config.Config; exception=java.lang.reflect.InvocationTargetException; in 'reader', line 10, column 1:
cluster_name: 'Test Cluster'
^
I'm working on centos7(VM) with idea IntelliJ
In fact, I can run cassandra on command line by using ( ./cassandra) . Anyone know a solution to this problem?

Related

how to configure and run Reaper to repair cassandra in linux( centos environment)

I'm trying to install and run Reaper 1.4 on my centos VM. And followed the same installation step as in given video (https://www.youtube.com/watch?v=0dub29BgwPI), but still no success in getting reaper started.Can anyone please help me with proper/complete document. however i have read and followed
http://cassandra-reaper.io/docs/download/
Below given is my cassandra-reaper.yaml settings:
segmentCountPerNode: 16
repairParallelism: DATACENTER_AWARE
repairIntensity: 0.9
scheduleDaysBetween: 7
repairRunThreadCount: 15
hangingRepairTimeoutMins: 30
storageType: cassandra
enableCrossOrigin: true
incrementalRepair: false
blacklistTwcsTables: false
enableDynamicSeedList: true
repairManagerSchedulingIntervalSeconds: 10
activateQueryLogger: false
jmxConnectionTimeoutInSeconds: 5
useAddressTranslator: false
# purgeRecordsAfterInDays: 30
# numberOfRunsToKeepPerUnit: 10
jmxPorts:
#127.0.0.1: 7100
#10.X.X.X: 7199
#127.0.0.2: 7200
#127.0.0.3: 7300
#127.0.0.4: 7400
#127.0.0.5: 7500
#127.0.0.6: 7600
#127.0.0.7: 7700
#127.0.0.8: 7800
jmxAuth:
username: *****
password: *****
server:
type: default
applicationConnectors:
- type: http
port: 8080
bindHost: 0.0.0.0
adminConnectors:
- type: http
port: 8081
bindHost: 0.0.0.0
requestLog:
appenders: []
cassandra:
clusterName: "dc1"
contactPoints: ["10.X.X.1","10.X.X.2","10.X.X.3","10.X.X.4","10.X.X.5"]
#contactPoints: ["127.0.0.1"]
keyspace: "reaper_db"
loadBalancingPolicy:
type: tokenAware
shuffleReplicas: true
subPolicy:
type: dcAwareRoundRobin
localDC:
usedHostsPerRemoteDC: 0
allowRemoteDCsForLocalConsistencyLevel: false
authProvider:
type: plainText
username: cass
password: cass
ssl:
type: jdk
autoScheduling:
enabled: false
initialDelayPeriod: PT15S
periodBetweenPolls: PT10M
timeBeforeFirstSchedule: PT5M
scheduleSpreadPeriod: PT6H
excludedKeyspaces:
- keyspace1
- keyspace2
accessControl:
sessionTimeout: PT10M
shiro:
iniConfigs: ["classpath:shiro.ini"]
log from /var/log/cassandra-reaper/reaper.log
INFO [main] i.c.ReaperApplication - initializing runner thread pool with 15 threads
INFO [main] i.c.ReaperApplication - initializing storage of type: cassandra
INFO [main] c.d.d.core - DataStax Java driver 3.5.0 for Apache Cassandra
INFO [main] c.d.d.c.GuavaCompatibility - Detected Guava >= 19 in the classpath, using modern compatibility layer
INFO [main] c.d.d.c.ClockFactory - Using native clock to generate timestamps.
INFO [main] c.d.d.c.NettyUtil - Found Netty's native epoll transport in the classpath, using it
INFO [main] o.a.s.c.ReflectionBuilder - An instance with name 'authc' already exists. Redefining this object as a new instance of type org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter
log from /var/log/cassandra-reaper.err
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:415)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:586)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:347)
... 11 more
ls: cannot access server/target/cassandra-reaper-*.jar: No such file or directory
io.dropwizard.configuration.ConfigurationParsingException: /etc/cassandra-reaper/cassandra-reaper.yaml has an error:
* Malformed YAML at line: 27, column: 11; while scanning for the next token; found character '\t' that cannot start any token; in 'reader', line 27, column 1:
clusterName: "dc1"
^
at [Source: (ByteArrayInputStream); line: 26, column: 10]
at io.dropwizard.configuration.ConfigurationParsingException$Builder.build(ConfigurationParsingException.java:279)
at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:96)
at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:126)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:74)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:93)
at io.cassandrareaper.ReaperApplication.main(ReaperApplication.java:99)
Caused by: com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAMLException: while scanning for the next token; found character '\t' that cannot start any token; in 'reader', line 27, column 1:
clusterName: "dc1"
^
Malformed YAML at line: 27, column: 11; while scanning for the next token; found character '\t' that cannot start any token; in 'reader', line 27, column 1:
clusterName: "dc1"
You need to remove any tab whitespaces in your yaml file and replace it with 4 spaces instead.
See the answer here for why this is common when manipulating YAML files.
A YAML file cannot contain tabs as indentation

Error while using javax.crypto API in cassandra UDF

I have written a cassandra UDF using java code to encrypt data. For this I have used the javax.crypto.Cipher and javax.crypto.spec.SecretKeySpec.
I am unable to create the UDF as I am getting the following error:
InvalidRequest: Error from server: code=2200 [Invalid query] message="Java source compilation failed:
Line 1: javax.crypto.spec.SecretKeySpec cannot be resolved to a type
Line 1: javax.crypto.spec.SecretKeySpec cannot be resolved to a type
Line 1: javax.crypto.Cipher cannot be resolved to a type
Line 1: javax.crypto.Cipher cannot be resolved to a type
Line 1: javax.crypto.Cipher.ENCRYPT_MODE cannot be resolved to a type
create function encrypt("val" text)
returns null on null input
returns text
language java as
'
String strData="";
javax.crypto.spec.SecretKeySpec skeyspec=new
javax.crypto.spec.SecretKeySpec("abc".getBytes(),"Blowfish");
javax.crypto.Cipher cipher=javax.crypto.Cipher.getInstance("Blowfish");
cipher.init(javax.crypto.Cipher.ENCRYPT_MODE,skeyspec);
byte[] encrypted=cipher.doFinal(val.getBytes());
strData=new String(encrypted);
return strData;
';

schema crawler--Table name pattern can not be NULL or empty

I'm running the following command:
schemacrawler.cmd -server=mysql -database=prepaid -infolevel=minimum -command=list -loglevel=CONFIG -url=jdbc:mysql://127.0.0.1:3306/prepaid -u=root -schemas=prepaid
And I'm getting the following error:
Feb 22, 2017 5:11:48 PM us.fatehi.commandlineparser.CommandLineUtility logFullStackTrace
SEVERE: Exception retrieving table information: Table name pattern can not be NULL or empty.
schemacrawler.schemacrawler.SchemaCrawlerException: Exception retrieving table information: Table name pattern can not be NULL or empty.
at schemacrawler.crawl.SchemaCrawler.crawlTables(SchemaCrawler.java:739)
at schemacrawler.crawl.SchemaCrawler.crawl(SchemaCrawler.java:797)
at schemacrawler.tools.executable.BaseStagedExecutable.execute(BaseStagedExecutable.java:91)
at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(SchemaCrawlerCommandLine.java:129)
at schemacrawler.Main.main(Main.java:90)
Caused by: java.sql.SQLException: Table name pattern can not be NULL or empty.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)
at com.mysql.cj.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:3836)
at schemacrawler.crawl.TableRetriever.retrieveTables(TableRetriever.java:114)
at schemacrawler.crawl.SchemaCrawler.lambda$crawlTables$26(SchemaCrawler.java:570)
at schemacrawler.crawl.SchemaCrawler$$Lambda$41/1559122513.call(Unknown Source)
at sf.util.StopWatch.time(StopWatch.java:156)
at schemacrawler.crawl.SchemaCrawler.crawlTables(SchemaCrawler.java:567)
... 4 more
=================
Please advise
Please make sure to use the correct MySQL database connection URL, following the documentation on Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J. In particular, you need to set nullNamePatternMatchesAll=true like this:
schemacrawler.cmd -server=mysql -database=prepaid -infolevel=minimum -command=list -loglevel=CONFIG -url=jdbc:mysql://127.0.0.1:3306/prepaid?nullNamePatternMatchesAll=true -u=root -schemas=prepaid
Or, better, use SchemaCrawler's built-in support for MySQL, like this, which is much easier:
schemacrawler.cmd -server=mysql -host=127.0.0.1 -database=prepaid -infolevel=minimum -command=list -loglevel=CONFIG -u=root -schemas=prepaid
Sualeh Fatehi, SchemaCrawler

Cassandra 2.2.5 to 3.0.4 upgrade fails

Pretty much what it says.
Quiesce node, stop cassandra, upgrade cassandra RPMs from 2.2.5 to 3.0.4 and then start cassandra. When it comes back up:
INFO 13:02:50 Detected version upgrade from 2.2.5 to 3.0.4, snapshotting system keyspace
INFO 13:02:50 Updating topology for all endpoints that have changed
Exception (java.lang.RuntimeException) encountered during startup: org.codehaus.jackson.JsonParseException: Unexpected character ('K' (code 75)): expected a valid value (numbe
r, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.StringReader#27be81e5; line: 1, column: 2]
java.lang.RuntimeException: org.codehaus.jackson.JsonParseException: Unexpected character ('K' (code 75)): expected a valid value (number, String, array, object, 'true', 'fals
e' or 'null')
at [Source: java.io.StringReader#27be81e5; line: 1, column: 2]
at org.apache.cassandra.utils.FBUtilities.fromJsonMap(FBUtilities.java:561)
at org.apache.cassandra.schema.LegacySchemaMigrator.decodeTableParams(LegacySchemaMigrator.java:381)
at org.apache.cassandra.schema.LegacySchemaMigrator.decodeTableMetadata(LegacySchemaMigrator.java:363)
at org.apache.cassandra.schema.LegacySchemaMigrator.readTableMetadata(LegacySchemaMigrator.java:273)
at org.apache.cassandra.schema.LegacySchemaMigrator.readTable(LegacySchemaMigrator.java:244)
at org.apache.cassandra.schema.LegacySchemaMigrator.lambda$readTables$233(LegacySchemaMigrator.java:237)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.apache.cassandra.schema.LegacySchemaMigrator.readTables(LegacySchemaMigrator.java:237)
at org.apache.cassandra.schema.LegacySchemaMigrator.readKeyspace(LegacySchemaMigrator.java:186)
at org.apache.cassandra.schema.LegacySchemaMigrator.lambda$readSchema$230(LegacySchemaMigrator.java:177)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.apache.cassandra.schema.LegacySchemaMigrator.readSchema(LegacySchemaMigrator.java:177)
at org.apache.cassandra.schema.LegacySchemaMigrator.migrate(LegacySchemaMigrator.java:77)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:223)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:551)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:679)
And the node dies. I'm stumped.
Fixed: delete everything in the datadir/system*/* and make it rebuild.

Cannot return map<text,text> from User Defined Function in CQL 3.x (Cassandra 2.2.3)

I am not able to return map from User Defined Function in CQL 3.x (Cassandra 2.2.3). Here is my code:
CREATE OR REPLACE FUNCTION issaviktempkeyspace.myfilter1(begindate timestamp,argtimestamp timestamp,columnname text,columnvalue text,companyid int)
CALLED ON NULL INPUT
RETURNS map<text,text> LANGUAGE java AS
'
if(begindate.before(argtimestamp)){
Map<String,String> map= Collections.<String,String>emptyMap();
map.put("columnname",columnname);
map.put("columnvalue",columnvalue);
map.put("companyid",Integer.toString(companyid));
return map;
}
else
return null;
';
When I try to create the function, Cassandra says that,
InvalidQueryException: Could not compile function 'issaviktempkeyspace.myfilter1' from Java source: org.apache.cassandra.exceptions.InvalidRequestException: Java source compilation failed:
Line 3: Map cannot be resolved to a type
Line 3: Collections cannot be resolved
com.datastax.driver.core.exceptions.InvalidQueryException: InvalidQueryException: Could not compile function 'issaviktempkeyspace.myfilter1' from Java source: org.apache.cassandra.exceptions.InvalidRequestException: Java source compilation failed:
Line 3: Map cannot be resolved to a type
Line 3: Collections cannot be resolved
-- Any idea how to do this.
I have one more query. Can I have tuple type to be returned as a part of UDF ?

Resources