getting rid of Hbase configuration deprecated warning - java

I'm getting this error message in my log file WARN hbase.HBaseConfiguration: instantiating HBaseConfiguration() is deprecated. Please use HBaseConfiguration#create() to construct a plain Configuration how can I get rid of this?
My class extends Configured.class , and I'm instantiating configuration like this :
HBaseConfiguration hBaseConfiguration = new HBaseConfiguration(getConf());
Did anyone have the similar issue? how to fix it ?
EDIT
How can I get this version of HbaseConfiguration :
http://hbase.apache.org/docs/r0.89.20100726/xref/org/apache/hadoop/hbase/HBaseConfiguration.html
I downloaded the latest version from hbase web site(version 0.20.6) but the class is different from this one, its missing create() method and some other too.

Quoting the Javadoc:
Instantinating HBaseConfiguration() is
deprecated. Please use
HBaseConfiguration#create(conf) to
construct a plain Configuration
Instead of doing:
HBaseConfiguration hBaseConfiguration = new HBaseConfiguration(getConf());
You should do:
Configuration configuration = HBaseConfiguration.create(getConf());

Related

java.lang.UnsupportedOperationException: option is not a supported field type

Using the following library
<dependency>
<groupId>net.rcarz</groupId>
<artifactId>jira-client</artifactId>
<version>0.5</version>
</dependency>
I am getting error while executing below code:
BasicCredentials creds = new BasicCredentials("username", "password");
JiraClient jira = new JiraClient("xyz/rest/api/2/issue", creds);
Issue newIssue = jira.createIssue("XYZ", "Bug")
.field(Field.SUMMARY, "tEST bUG")
.field("customfield_20200","No STeps")
.field("customfield_20202","No actual")
.field("customfield_25600",Field.valueById("35650"))
.execute();
Getting error for field("customfield_25600",Field.valueByID("35650"))
Error Description :
java.lang.UnsupportedOperationException: option is not a supported
field type
This is customized field in JIRA.
Please let me know if required more information.
Thanks in advance.
Field#toJson() method had not know about option type in v0.5, it was added later. That is why method throws UnsupportedOperationException. Try to use the latest version from GitHub: https://github.com/rcarz/jira-client
Seems to be a known issue with the library,the field you try to add is probably an option and it is not supported
The error was already reported here:
https://github.com/rcarz/jira-client/issues/123
Hi,
trying to use custom fields, I encounter the following issue :
For a "Select List (single choice)" type of field, I get the following exception when trying to create an issue :
Exception: java.lang.UnsupportedOperationException: option is not a supported field type
at net.rcarz.jiraclient.Field.toJson(Field.java:655)
at net.rcarz.jiraclient.Issue$FluentCreate.executeCreate(Issue.java:104)
at net.rcarz.jiraclient.Issue$FluentCreate.execute(Issue.java:59)
I'm using JIRA v7.1.0-OD-05-006
It seems to have to do with the JIRA version.
Following the link to #154, it seems that it was not fixed.
https://github.com/rcarz/jira-client/pull/154
The issue still persists
Caused by: java.lang.UnsupportedOperationException: option is not a supported field type
at net.rcarz.jiraclient.Field.toJson(Field.java:737)
at net.rcarz.jiraclient.Issue$FluentCreate.executeCreate(Issue.java:102)
at net.rcarz.jiraclient.Issue$FluentCreate.execute(Issue.java:57)
Here is my snippet code looks like. The customfield_12133 is an options.
JiraClient jiraClient;
Issue issue = jiraClient.createIssue("MYPROJECT", "Internal Bug")
.field(Field.SUMMARY, summary)
.field(Field.DESCRIPTION, summary)
.field("customfield_12133", "Other")
.execute();
Finally pull #176 should actually have fixed it:
https://github.com/rcarz/jira-client/pull/176
might be fixed in the next version (0.6) of the library

CAMEL - SALESFORCE Bulk API - set API version

i'm creating a new Job with:
<to id="_slf_send2SC_to_salesforce_1" uri="salesforce:createJob"/>
in camelconfig.
After that, I created a new instance:
JobInfo jobInfo = new JobInfo();
jobInfo.setOperation(OperationEnum.UPSERT);
jobInfo.setContentType(ContentType.CSV);
jobInfo.setObject(objName);
jobInfo.setExternalIdFieldName(externalId);
//Set API Version
jobInfo.setApiVersion("43.0");
But it seems that it doesn't work: api version on salesforce is always 34 (default version).
Could you help me?
Thanks,
Emanuele
I solved in AnypointStudio.ini the variable vm. It should be:
-vm
C:\progra~1\Java\jdk1.8.0_144\bin\
(without java.exe)
By
Emanuele
If you are using springboot, you can set the API version using the below property
camel.component.salesforce.api-version
Example:
camel.component.salesforce.api-version=38.0

Can't get logbacks TimeBasedRollingPolicy running

I can't get this snippet running:
TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new TimeBasedRollingPolicy<>();
rollingPolicy.setFileNamePattern("%d{yyyy-MM-dd}.log");
rollingPolicy.start();
Whatever pattern I try, I keep getting
Caused by: java.lang.IllegalStateException: FileNamePattern [%d{yyyy-MM-dd}.log] does not contain a valid DateToken
at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(TimeBasedFileNamingAndTriggeringPolicyBase.java:46)
at ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy.start(DefaultTimeBasedFileNamingAndTriggeringPolicy.java:32)
at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.start(TimeBasedRollingPolicy.java:90)
I've tried various examples from the docs, but what works in logback.xml doesn't seem to work in code.
According to this: https://github.com/tony19/logback-android/issues/51 you need a context and an appender. There is an example there.

disable strict mode in drools

I'm getting error like Error: unable to resolve method using strict-mode: ...
I've added system property drools.dialect.mvel.strict=false
I can see system property was applied to my app in jvisualvm
But I'm getting the same error with 'using strict-mode'.
How could I disable strict mode in drools?
This is how it can be done from Java:
KnowledgeBuilderConfiguration kbConfig =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
kbConfig.setProperty("drools.dialect.mvel.strict", "false");
KnowledgeBuilder kBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder( kbConfig );
Although, setting the property should be OK. -- Maybe a look at the error might help to find a workaround?

defining keys in play framework application conf file

I'm trying to add new keys in application.conf file in play framework 2.1. I have added the following keys:
gen.db.host=localhost
gen.db.port=27017
gen.db.name=test
When i start my application, it is throwing the following error:
Configuration error: Configuration error[application.conf: 46: port has type NUMBER rather than OBJECT]
......
......
......
Caused by: com.typesafe.config.ConfigException$WrongType: application.conf: 46: port has type NUMBER rather than OBJECT
I don't understand this issue. How can i resolve it? Also, is it a good practice to define new keys in application.conf file?
Thanks.
Put the port between double quotes:
gen.db.port="27017"
You have to use a colon
gen.dn.port:"26017"
Here's a link to the current documentation
http://www.playframework.com/documentation/2.0.x/Configuration
You are propably using wrong method to extract the data from config. I assume you use it like:
current.configuration.getConfig("gen.db.port")
But this method returns play.api.Configuration and expects an object to be under the path "gen.db.port" (as it is mentioned in the error). Since under the "gen.db.port" path you have a number, you should change the method to:
current.configuration.getNumber("gen.db.port")

Categories

Resources