SSL Error while publishing extract to tableau server - java

Getting the following error while publishing an extract into Tableau server.
com.tableausoftware.TableauException: Problem with the SSL CA cert (path? access rights?)
at com.tableausoftware.server.ServerConnection.connect(Unknown Source)
at com.tableau.sample.PublishOrder.main(PublishOrder.java:31)
CURL_ERROR - Problem with the SSL CA cert (path? access rights?)
com.tableausoftware.TableauException: Problem with the SSL CA cert (path? access rights?)
at com.tableausoftware.server.ServerConnection.connect(Unknown Source)
at com.tableau.sample.PublishOrder.main(PublishOrder.java:31)
I am using online Tableau server and its version is 10.0
Here is my java code. This is same as the sample provided in Tableau documentation
import com.tableausoftware.TableauException;
import com.tableausoftware.common.*;
import com.tableausoftware.server.*;
public class PublishOrder {
public static void main( String[] args ) {
try {
// Initialize Tableau Server API
ServerAPI.initialize();
// Create the server connection object
ServerConnection serverConnection = new ServerConnection();
// Connect to the server
serverConnection.connect("https://xxx.online.tableau.com", "xxx#example.com", "xxx", "xxx");
// Publish order-java.tde to the server under the default project with name Order-java
serverConnection.publishExtract("order-java.tde", "default", "Order-java-ubuntu", false);
// Disconnect from the server
serverConnection.disconnect();
// Destroy the server connection object
serverConnection.close();
// Clean up Tableau Server API
ServerAPI.cleanup();
}
catch (TableauException e) {
e.printStackTrace();
}
}
}
I am running this java code from ubuntu 12.04.
Please help me to resolve this issue

The error indicates that the CA certificates are not available on your system. Check if the file /usr/local/share/ca-certificates exists. You may also need to update these certificates using update-ca-certificates.

Related

Is there any way to connect to perform operation on AWS neptune giving gremlin code in .java file

I tried Connecting the AWS Neptune with this Java code and got the error , NoHostAvailable Exception
approach 1:
public static void main(String[] args) throws Exception {
Cluster.Builder builder = Cluster.build();
builder.addContactPoint("endpoint");
builder.port(8182);
builder.enableSsl(true);
builder.keyStore("pem-file");
Cluster cluster = builder.create();
GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(cluster));
System.out.println(g.V().limit(10).toList());
cluster.close();
}}
approach 2:
Cluster cluster = Cluster.build("endpoint").
enableSsl(true).keyStore("pem").
handshakeInterceptor( r -> {
NeptuneNettyHttpSigV4Signer sigV4Signer = null;
try {
sigV4Signer = new NeptuneNettyHttpSigV4Signer("us-east-2", new
DefaultAWSCredentialsProviderChain());
} catch (NeptuneSigV4SignerException e) {
e.printStackTrace();
}
try {
sigV4Signer.signRequest(r);
} catch (NeptuneSigV4SignerException e) {
e.printStackTrace();
}
return r;
}).create();
Client client=Cluster.open("src\\conf\\remote-objects.yaml").connect();
client.submit("g.V().limit(10).toList()").all().get();
what ever I do, I am getting this error:
Sep 02, 2021 3:18:34 PM io.netty.channel.ChannelInitializer exceptionCaught
WARNING: Failed to initialize a channel. Closing:
java.lang.RuntimeException: java.lang.NullPointerException
org.apache.tinkerpop.gremlin.driver.Channelizer$AbstractChannelizer.initChannel(Channelizer.java:117)
Caused by: org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException: All hosts
are considered unavailable due to previous exceptions. Check the error log to find the actual
reason.
I need the code or the document to connect my Gremlin code in .java file to AWS neptune. I am struggling and tried various number of ways,
1.created EC2 instance and did installed maven and apache still got error and code is running in Server(EC2), i want code to present in IntelliJ
it would be more helpful, if I get the Exact Code any way. what should be added in remote-objects.yaml.
if we require Pem-file to access Amazon Neptune, please help with the creation of it.
Assuming SSL is enabled but IAM is not, in terms of Java code, this is all you need to create the connection.
Cluster.Builder builder = Cluster.build();
builder.addContactPoint("localhost");
builder.port(8182);
builder.enableSsl(true);
builder.serializer(Serializers.GRAPHBINARY_V1D0);
cluster = builder.create();
drc = DriverRemoteConnection.using(cluster);
g = traversal().withRemote(drc);
You may need to add an entry to your /etc/hosts file to get the SSL certs to resolve correctly such as:
127.0.0.1 localhost my-neptune-cluster.us-east-1.neptune.amazonaws.com
If you find that using localhost with SSL enabled does not work then use the actual Neptune cluster DNS name and make the edit to your /etc/hosts file.
The last thing you will need to do is create access to the Neptune VPC from your local machine. One way is using an SSH tunnel as explained in this post

java.lang.IllegalStateException: Unable to negotiate key exchange for server host key algorithms

Description:
Trying to send requests to an application that tries to access a Netopeer2 server, but a problem happens and the key exchange fails. There are solutions out there how to configure it on the server side in /etc/ssh/sshd_config, but we want it to be on the client side that is in the application.
The application uses Apache MINA SSHD to establish the connection (GitHub). By default, certain algorithms are disabled. We want to enable them in that Main class below to be able to exchange rsa-sha2-512, rsa-sha2-256 with the server. Any idea on how to do that with Apache MINA SSHD?
The full error message says:
java.lang.IllegalStateException: Unable to negotiate key exchange for server host key algorithms
(client: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa,ssh-dss /
server: rsa-sha2-512,rsa-sha2-256)
The code that throws the error:
import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.session.ClientSession;
import java.io.IOException;
public class Main{
public static void main(String[] args) {
SshClient client = SshClient.setUpDefaultClient();
client.start();
try {
ClientSession session = client.connect("root", "172.17.0.2", 830).verify(10000).getSession();
session.addPasswordIdentity("root");
session.auth().verify(9999);
// error 'Unable to negotiate key exchange for server host key algorithms' is thrown
}
catch (IOException e){
e.printStackTrace();
}
}
}
I'm also not solving my own problem but I am in the same zone as you. But for me, looking at SSHD log I think I see the client offering rsa_sha2_512 and the (one) server rejecting that and dropping the connection request.
Here is a little Scala snippet that didn't change anything for me. I think this is what you get if you don't set it; every default factory (that I found).
import org.apache.sshd.common.kex.{BuiltinDHFactories, KeyExchangeFactory}
val kexList: util.List[KeyExchangeFactory] = {
val kex = List(
BuiltinDHFactories.dhg1,
BuiltinDHFactories.dhg14,
BuiltinDHFactories.dhgex,
BuiltinDHFactories.dhg14_256,
BuiltinDHFactories.dhg15_512,
BuiltinDHFactories.dhg16_512,
BuiltinDHFactories.dhg17_512,
BuiltinDHFactories.dhg18_512,
BuiltinDHFactories.dhgex256,
BuiltinDHFactories.ecdhp256,
BuiltinDHFactories.ecdhp384,
BuiltinDHFactories.ecdhp521)
val dh2kex = kex.map(k => ClientBuilder.DH2KEX(k))
dh2kex.asJava
}
session.setKeyExchangeFactories(kexList)
Or this in Java:
List<KeyExchangeFactory> kexList =
BuiltinDHFactories.VALUES.stream().map(ClientBuilder.DH2KEX).collect(Collectors.toList());
Below should solve the problem.
client.setKeyExchangeFactories(NamedFactory.setUpTransformedFactories(
false,
BuiltinDHFactories.VALUES,
ClientBuilder.DH2KEX
));
client.setSignatureFactories(new ArrayList<>(BuiltinSignatures.VALUES))
For putty support
https://github.com/apache/mina-sshd/blob/master/docs/files-parsing.md
Simply add the following
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-common</artifactId>
<version>...same version as the rest of the artifacts...</version>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-putty</artifactId>
<version>...same version as the rest of the artifacts...</version>
</dependency>

IBM MQ fail with reason '2278' ('MQRC_CLIENT_CONN_ERROR')

I have been trying with no luck to get a java app to connect to IBM MQ v8 via CCDT file. I can connect fine when connecting using properties (hostname, port, etc) but with CCDT I consistently get WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2278' ('MQRC_CLIENT_CONN_ERROR').
I am using a vanilla install of MQ Developer 8.0 (version required, can't change) and the Jars from the installation. All I did was install MQ, then setup a QueueManager 'QM1', then create a queue 'Q1'.
My code:
package mqtest;
import com.ibm.mq.jms.*;
import java.io.File;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
File file = new File("C:/ProgramData/IBM/MQ/qmgrs/QM1/#ipcc/AMQCLCHL.TAB");
URL clientChannelTableUrl = file.toURI().toURL();
cf.setQueueManager("QM1");
cf.setCCDTURL(clientChannelTableUrl);
MQQueueConnection mqQueueConnection = (MQQueueConnection) cf.createConnection();
} catch (Exception e) {
e.printStackTrace();
}
}
}
dis qmgr
AMQ8408: Display Queue Manager details.
QMNAME(QM1) ACCTCONO(DISABLED)
ACCTINT(1800) ACCTMQI(OFF)
ACCTQ(OFF) ACTIVREC(MSG)
ACTVCONO(DISABLED) ACTVTRC(OFF)
ALTDATE(2018-05-23) ALTTIME(10.21.26)
AUTHOREV(DISABLED) CCSID(437)
CERTLABL(ibmwebspheremqqm1) CERTVPOL(ANY)
CHAD(DISABLED) CHADEV(DISABLED)
CHADEXIT( ) CHLEV(DISABLED)
CHLAUTH(ENABLED) CLWLDATA( )
CLWLEXIT( ) CLWLLEN(100)
CLWLMRUC(999999999) CLWLUSEQ(LOCAL)
CMDEV(DISABLED) CMDLEVEL(800)
COMMANDQ(SYSTEM.ADMIN.COMMAND.QUEUE) CONFIGEV(DISABLED)
CONNAUTH(SYSTEM.DEFAULT.AUTHINFO.IDPWOS)
CRDATE(2018-05-23) CRTIME(10.21.26)
CUSTOM( ) DEADQ( )
DEFCLXQ(SCTQ) DEFXMITQ( )
DESCR( ) DISTL(YES)
INHIBTEV(DISABLED) IPADDRV(IPV4)
LOCALEV(DISABLED) LOGGEREV(DISABLED)
MARKINT(5000) MAXHANDS(256)
MAXMSGL(4194304) MAXPROPL(NOLIMIT)
MAXPRTY(9) MAXUMSGS(10000)
MONACLS(QMGR) MONCHL(OFF)
MONQ(OFF) PARENT( )
PERFMEV(DISABLED) PLATFORM(WINDOWSNT)
PSMODE(ENABLED) PSCLUS(ENABLED)
PSNPMSG(DISCARD) PSNPRES(NORMAL)
PSRTYCNT(5) PSSYNCPT(IFPER)
QMID(QM1_2018-05-23_10.21.26) REMOTEEV(DISABLED)
REPOS( ) REPOSNL( )
REVDNS(ENABLED) ROUTEREC(MSG)
SCHINIT(QMGR) SCMDSERV(QMGR)
SPLCAP(ENABLED) SSLCRLNL( )
SSLCRYP( ) SSLEV(DISABLED)
SSLFIPS(NO)
SSLKEYR(C:\ProgramData\IBM\MQ\qmgrs\QM1\ssl\key)
SSLRKEYC(0) STATACLS(QMGR)
STATCHL(OFF) STATINT(1800)
The error log in C:\ProgramData\IBM\MQ\qmgrs\QM1\errors has no relevant (that I can see at least) data in it.
As far as I can tell from various SO, IBM, Google searches this should work. As far as I can tell it has something to do with Channel definition or settings, but I just don't know what.
And, honestly, I think I have spent enough brain cells on this that I am most likely overlooking something important but can't see the small simple detail I am overlooking. Any help as appreciated.
MQ Version: 9.0.0.4
Step 1: only one jar required: com.ibm.mq.allclient-9.0.4.0.jar
Step 2:
Do not set any variable in MQEnvironment
Step 3:
java.net.URL chanTab1 = new URL("file:///C:/MGR.TAB");
MQQueueManager _queueManager = new MQQueueManager("*", chanTab1);
int openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;
MQQueue queue = _queueManager.accessQueue( "QNAME", openOptions,null,null, null );
MQMessage sendmsg = new MQMessage();
* will allow you to connect all the QManager available in the .TAB file.
Step 4:
Install certificate in your jre C:\Program Files\Java\jdk1.7\jre\bin by command
keytool -import -alias example -keystore ..\lib\security\cacerts -file C:\test.cer
default password is changeit. Mostly nobody change this. :-)
or
if you deployed your code on websphere application server then no need to install certificate in server JRE. Insted install certificate on Websphere server
SSL certificate and key management > Key stores and certificates > NodeDefaultKeyStore > Signer certificates > Retrieve from port

Can't connect to MYSQL server which hosted in google instance

I got a google cloud platform - compute engine instance, which I installed MySQL server on.
And now I can't get any signal of life our of the VM the sql installed on,
for exsample:
package com.company;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Main {
public static void connection(){
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("in conncection");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public static void connectToMySQL(){
connection();
String host = "jdbc:mysql://hotsIP:3306/DBname";
String user = "user";
String pass = "password";
try {
Connection connection = DriverManager.getConnection(host,user,pass);
System.out.println("???");
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
connectToMySQL();
}
}
It's take a few second like he trying to connect and the EXEPTION
in conncection
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
What I done to make it work:
in the my.conf:bind address = 0.0.0.0, skip-external-locking comment out
restart the server
looked if the server is active
looked if the server listening to the port
looked if its TCP
I don't know what to do anymore.
You have to make the following change to your my.cnf file
my.cnf
bind-address = www.000webhost.com (OR)
bind-address = xx.xx.xx.xx (IP Address)
You need to restart your MySQL service, once this setting is changed.
Also worth noting is the point that MAMP/ MAMP Pro sets MAMP_skip-networking_MAMP by default. You've to disable this line in your my.cnf
And if you don't have any user login issues, you should be able to connect to the MySQL Database from your Java code.
In my case the root cause was: Firewall. I was trying to run the application at work.
What was interesting is that the App Engine Standard running locally actually generated a non-error log in Google Cloud Platform Logs, making me discard the firewall hypotheses.
Solution: I found out bringing my notebook from home and connecting to company's network, did not work. When I connected to the shared connection in my mobile, worked perfectly.

Java Web Service Client which access the .Net Webservice

I'm trying to access online .Net Webservice through Java Webservice client.
But unfortunately, am getting an error "Connection timed out: connect"
Below is my code:
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
public class WebServiceMain {
public static void main(String[] args) {
try {
String endpoint = "http://wsf.cdyne.com/SpellChecker/check.asmx";
Service service = new Service();
Call call = (Call)service.createCall();
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://ws.cdyne.com/CheckTextBodyV2");
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setPortName(new QName("http://ws.cdyne.com/", "check"));
call.setOperationName(new QName("http://ws.cdyne.com/", "CheckTextBodyV2"));
System.out.println(call.invoke(new Object[] {"helo is my name"}));
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
Connection timeout comes because of network issues.try to acess URL in browser.also try to append ?wsdl at the end of URL,you should see the wsdl.if this doesn't work troubleshoot network settings.
Connection timed out: connect
This means that your client application cannot even talk to the Web Service. This is not a programmatic issue.
Check and see whether you can access the end-point through your web browser. If not, then that service is not available. So it doesn't work.
If your browser can access it, and if you are connecting to Internet through a proxy, then you need to specify the proxy details to Java Client. To do that, you can use -Dhttp.proxyHost=10.2.240.11 and -Dhttp.proxyPort=8080 (replace with your values) system properties when you start up your client application.
Download the soapui software and get installed it.
then load the wsdl file and create the project.
Then test your web service via soap ui.
you can edit the connection timeout value of the soap ui. chane it for big vlue and test.still your getiong time out ping to the ip addres of the service

Categories