Ok, I'm attempting unsuccessfully to connect to a remote datastore and populate from my local machine using the steps outlined here: https://cloud.google.com/appengine/docs/java/tools/remoteapi#Configuring_Remote_API_on_the_Client
public static void main(String[] args) {
String username = "myemail#gmail.com";
String password = "mygmailpassword";
RemoteApiOptions options = new RemoteApiOptions()
.server("myappname.appspot.com", 443)
.credentials(username, password);
RemoteApiInstaller installer = new RemoteApiInstaller();
installer.install(options);
try {
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
...
I'm getting a 404 in installer.install(options):
java.io.IOException: can't get appId from remote api; status code = 404
Am I missing something here? I enabled the remote api in my web.xml and deployed to GAE. I am the owner of the project.
Run your service locally (with remote api enabled) and try running same code using 'localhost' and 8888 (port) and check if your code can access locally running service. Your code seems right. There are 2 possibilities -
1. RemoteApi is not enabled correctly.
2. app-name is not spelled correctly.
Other than this, I also use following code to access remote api-
installer.install(options);
try {
// Update the options with reusable credentials so we can skip
// authentication on subsequent calls.
options.reuseCredentials(username, installer.serializeCredentials());
} finally {
installer.uninstall();
}
However, that shouldn't give you the error you're getting.
I realize this is coming a bit late, but I just found this when googling because I had a similar problem, and I solved it for myself. For me the problem was, that my AppEngine app that was serving the remote API, was a python app, and the python docs instruct configuring the remote api endpoint as /remoteapi.*
However my remote api client is a java application, and apparently the remote api call it makes, goes to an endpoit like this: /remote_api. So adding that to the server route configuration (in my case app.yaml) solved the problem. Please note also, that if your remote api serving appengine app is not in the default module, the url should be something like my-module-name-dot-my-project.appspot.com
Also, you should use useApplicationDefaultCredential() instead of credentials(), it is deprecated.
Related
Uploading files to AWS S3 using spring boot works great when it executed without proxy and when I add proxy in the VM args it fails with following error,
Internal Server Error (Service: Amazon S3; Status Code: 500; Error Code: 500 Internal Server Error; Request ID: null; S3 Extended Request ID: null; Proxy: 192.168.1.171)
Below are the vm arguments that I have provided,
-Dhttp.proxyHost=192.168.1.171 -Dhttp.proxyPort=9999 -Dhttps.proxyHost=192.168.1.171 -Dhttps.proxyPort=9999
When I started to execute the package the AWS SDK auto initialize the proxy as it finds in the args list
and it prints in the console
com.amazonaws.http.AmazonHttpClient - Configuring Proxy. Proxy Host: 192.168.1.171 Proxy Port: 9999
I can not remove the proxy because I am using Oauth2 authentication in spring security.
Is there any way that I can disable auto initializing the proxy in AWS SDK?
In effect to communicate over a network "endpoints" are an address, but links require "connections" so it may be more of a connection/connected "host conflict" by configuration.
For example i could have both a webserver and a DB that takes requests via http direct but it depends if they are configured for each other and/or to be connected through an irq to network to anything else.
I was able to resolve the issue after contacting AWS, I had to configure the method “setNoneProxyHosts (String nonProxyHosts)” method in the ClientConfiguration class. This sets the optional hosts the client will access without going through the proxy.
The parameter – “nonProxyHosts” takes the hosts the client will access without going through the proxy. Please follow this link here for more information about the class and the method: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ClientConfiguration.html#setNonProxyHosts-java.lang.String-
Based on the instructions provided by AWS Support I had amended the config and added following;
public ClientConfiguration clientConfiguration() {
final ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setNonProxyHosts("*.s3.<ZONE>.amazonaws.com|*.s3-<ZONE>.amazonaws.com");
return clientConfiguration;
}
We have a Java web application at http://ourapp.com hosted at Heroku and the frontend of the app cannot connect to the WebSocket endpoint (endpoint) running in a Heroku dyno. We have tried these URIs:
ws://ourapp.com/endpoint
ws://ourapp.com:80/endpoint
ws://ourapp.com:8080/endpoint
ws://ourapp.com:8084/endpoint
ws://ourapp.com:443/endpoint
wss://ourapp.com/endpoint
wss://ourapp.com:80/endpoint
wss://ourapp.com:8080/endpoint
wss://ourapp.com:8084/endpoint
wss://ourapp.com:443/endpoint
None of the above open a connection. What are we missing here?
PS: I have set up a test ground: http://vakuutustiedot-dev.herokuapp.com/websocket.test.html (the URI is PROTOCOL:vakuutustiedot-dev.herokuapp.com:PORT/trial)
The target app runs in a Heroku Apache Tomcat 8.5.38.
What comes to the port number, I am not sure how to get one.
Perhaps you have missed adding the support of WebSockets to Heroku, like in this answer (https://stackoverflow.com/a/50002416/11197115)?
Maybe you should try configuring the proxy attribute of devServer. This attribute is used when the frontend app and backend api are not running on the same host. Perhaps the below setting might solve your problem.
module.exports = {
devServer: {
proxy: 'ws://ourapp.com:8080/endpoint'
}
}
For more info see the docs: https://cli.vuejs.org/config/#devserver
I've been trying for days and have gotten nowhere. I am trying to connect to my MySQL database through a JavaFX program I'm building, without requiring me to whitelist every IP that attempts to connect. The GCP support team has replied to me once but completely misinterpreted the issue (gave examples of logs that only occurred after I whitelisted my own IP to test the other aspects of my program).
I found instructions at https://cloud.google.com/sql/docs/mysql/connect-external-app#java, and pasted the following code into my main method (substituting the appropriate values for databaseName, instanceConnectionName, username, and password):
String jdbcUrl = String.format(
"jdbc:mysql://google/%s?cloudSqlInstance=%s"
+ "&socketFactory=com.google.cloud.sql.mysql.SocketFactory&useSSL=false",
databaseName,
instanceConnectionName);
Connection connection = DriverManager.getConnection(jdbcUrl, username,
password);
I then enabled the Cloud API and, to the best of my knowledge, installed and authenticated the Cloud SDK, as directed. Yet despite all of that, I still cannot connect to the instance without a whitelisted IP address, even though the documentation says this is the workaround for that. Does anyone see an issue with how I'm attempting to connect or know how to make this work?
There are some more detailed instructions in the README for the repo of the project.
Some potential tripping points:
Use Application Default Credentials to provide credentials to the factory.
Make sure you have the Cloud SQL API enabled to your project (and if you are using a service account, make sure to have the Cloud SQL Client role added to it).
Add the library as a dependency in your POM or gradlefile.
Make sure your firewall allows out on port 3307 to your Cloud SQL instance.
Hi i am following the below link
http://oozie.apache.org/docs/4.0.1/DG_JMSNotifications.html
snippet
OozieClient oc = new OozieClient("http://IP:8888/oozie");
JMSConnectionInfo jmsInfo = oc.getJMSConnectionInfo();
Properties jndiProperties = jmsInfo.getJNDIProperties();
Context jndiContext = new InitialContext(jndiProperties);
however as per the sample code given as above when trying to see the debug information for getting JMSConnectionInfo it says
java.io.FileNotFoundException: http://[ip:8888]/oozie/versions
is it some configuration with oozie-4.0.0-cdh5.1.0 (i m using). One more info i am running the above code with separate jvm on eclipse and oozie is configured on some other machine.
I found the link http://archive.cloudera.com/cdh4/cdh/4/oozie/WebServicesAPI.html
this says
The Oozie Web Services API is a HTTP REST JSON API.
All responses are in UTF-8 .
Assuming Oozie is runing at OOZIE_URL , the following web services end points are supported:
/versions
/v1/admin
/v1/job
/v1/jobs
in my case /versions are not supported so this is the reason. however i am not sure how i
can make my oozieserver to support /versions. please help
The port that i was using was wrong it should be 11000 instead. Due to this the oozieclient was not able to establish HTTPConnection to oozie server to get the Rest call. I am adding this as might be this is useful for some other person.
We're writing a web application that is trying to replace all ReportManager functionality using calls to Reporting Services SOAP API.
We started working with SSRS 2008 and had our Java code working correctly. We've since had to downgrade to SSRS 2005 and now we're having problems connecting to the Server to get the list of reports available.
We make the following call:
catalog = _reportingService.listChildren(_reportCredentials.getFolder(), false);
which returns an exception - (401)Unauthorized
_reportCredentials just holds information from a properties file (like the folder to use, the username and password, etc.). _reportService is defined as:
private ReportingService2005Soap _reportingService;
...
_reportingServiceLocator = new ReportingService2005Locator();
_reportingServiceLocator.setReportingService2005SoapEndpointAddress(soapURL);
try {
_reportingService = _reportingServiceLocator.getReportingService2005Soap();
} catch (Exception e) {
throw new ReportServicesException("Could not retrieve SOAP Reporting Service.");
}
I can also connect to ReportManager as the user/password we're connecting with in the code.
All of the 'documentation' I can find is just .NET code that doesn't seem to apply to the Java code. Has anybody experienced problems like this, or know of a good resource for Java developers using these services?
We traced the problem back to having SSRS 2005 installed on Windows Server 2008. Following the steps here: http://www.omegaprojex.com/index.php/2008/10/10/ssrs-2005-on-windows-server-2008/ fixed our problem.