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.
Related
One application to get details from an external system was developed and deployed in the IIB 10.0.0.10 version. Later, the application was moved to a new server in which IIB 10.0.0.14 was installed. The issue is that the application gives proper response after deployment or an EG restart, but giving parsing error after that. A java compute node is used for connecting to the external system and the parsing error occurs at the below line:
String response = getStringValue(detailsObject.getLastChild().getFirstElementByPath("./element1/element2/element3"));
The same service is working fine in the old server(IIB 10.0.0.10). Also, the first hit of the service after the deployment will give a proper response to the new server.
I have this code:
Connector conn = FrameworkUtil.getConnector(context, ALFRESCO_ENDPOINT_ID);
ConnectorContext c = new ConnectorContext(HttpMethod.POST);
c.setContentType("application/json");
Response res = conn.call("/slingshot/profile/userprofile", c,
new ByteArrayInputStream(buf.toString().getBytes()));
That makes a POST to the link: POST http://localhost:8080/share/service/components/profile/userprofile
But, I got the error:
TypeError: g.getResponseHeader is undefined
...unction(g){var b=g.argument.config;var
f=g.getResponseHeader["Content-Type"]||g....
In a search on the Internet, I saw that this can be a problem that is solved adding Content-Type with CORS.
Something like:
.header("Access-Control-Allow-Headers", "x-requested-with,Content-Type");
How can I do this in my code? With Connector or ConnectorContext I don't find a way to set the header...
Or if this is not the way to solve this, how can I solve this error?
I think you might have a few things configured incorrectly here, or you might be misunderstanding a few things. If you're making a remote connection to the ALFRESCO_ENDPOINT_ID then this typically means that you're trying to connect to the Alfresco Repository - and based on where you say you're trying to make the call from it would appear that this is in a Java-backed WebScript running within the Share application - is this correct?
If so, the URL that should be requested would actually be:
http://localhost:8080/alfresco/service/slingshot/profile/userprofile
Which would be equivalent to calling the following:
http://localhost:8080/share/proxy/alfresco/slingshot/profile/userprofile
(the second URL automatically proxies to the Alfresco enpoint).
If you have both the Alfresco Repository and Share running in the same server (which the use of the port 8080 implies you do) then you shouldn't be hitting CORS issues - unless you're trying to go from localhost to some remote location where the Alfresco Repository is running.
Share/Surf should be taking care of all of this for you - perhaps you can provide a bit more context on exactly what it is you're trying to do,
where the code is running (e.g. WebScript, Share, etc) and where you're trying to connect to?
This might help in best advising how to solve your main problem.
I want to use GeoMesa (GIS extension of Accumulo) and virtualized it using Docker just like this repo. Now I want to connect to the Accumulo instance using Java using:
Instance i = new ZooKeeperInstance("docker_instance",zkIP:port);
Connector conn = i.getConnector(user, new PasswordToken(password));
The connetion does not get established and hangs (just like in this question). I can connect to the ZooKeeper instance using using
./zkCli.sh -server ip:port
So i guess the instance_name is wrong. I used the one noted in the repo linked first. However I don't know where how to check the instance_name needed.
To make my problem reproducable I did setup a digital ocean server with all necessary dependencies and accumulo. I tested that the connection to zookeeper is possible using zkCli and checked the credentials using accumulo shell on the server.
Instance i = new ZooKeeperInstance("DIGITAL_OCEAN","46.101.199.216:2181");
// WARN org.apache.accumulo.core.client.ClientConfiguration - Found no client.conf in default paths. Using default client configuration values.
System.out.println("This is reached");
Connector conn = i.getConnector("root", new PasswordToken("mypassw"));
System.out.println("This is not reached");
As a troubleshooting step, you may be able to extract the instance name by using HdfsZooInstance.getInstance().getInstanceName() or by connecting directly to ZooKeeper and listing the instance names with ls /accumulo/instances/
There are multiple easy ways to get the instance_name: Ether just look to the top of the accumulo status page as elserj noted in the comments or use zkCli to connect to Zookeeper and use ls /accumulo/instances / as Christopher answered.
However I could not manage to connect to accumulo using the ordinary Java Connector. Nevertheless I managed to connect to Accumulo using the Proxy-Settings which is a valid solution for me, even that I still would have liked to find the problem.
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.
I've got the following problem: I'm running a JAVA Server with socket.io (netty socket.io - https://github.com/mrniko/netty-socketio) - I'm trying to access this server from a different web-server through javascript.
For a test I'm trying to get the Demo Chat running (https://github.com/mrniko/netty-socketio-demo).
The Problem now is that i keep getting the following
XMLHttpRequest cannot load http://myserver/socket.io/1/?t=1400445162388. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'myclient.com' is therefore not allowed access.
So the big question is: How do i allow access to my java server? I've found a few solutions saying to add the 'header' to it, but i have no idea where to put that. Does that go into the socket.io server code?
I think i need something like this, placed somewhere on the JAVA server:
response.setHeader("Access-Control-Allow-Origin", "*");
This is the code which starts the server:
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(80);
final SocketIOServer server = new SocketIOServer(config);
//ChatObject wurde extra implementiert, ggf. loeschen
server.addJsonObjectListener(ChatObject.class, new DataListener<ChatObject>() {
#Override
public void onData(SocketIOClient client, ChatObject data, AckRequest ackRequest) throws Exception {
// broadcast messages to all clients
server.getBroadcastOperations().sendJsonObject(data);
}
});
server.start();
and this is the output im getting from the server:
error: The specified resource was not found: /static/flashsocket/WebSocketMain.swf
error: The specified resource was not found: /static/flashsocket/WebSocketMainInsecure.swf
info: Session store / pubsub factory used: {}MemoryStoreFactory (local session store only)
info: SocketIO server started at port: {}80
Any help is greatly appreciated ! Thank you
I've confronted the similar problem yesterday and solved it mostly. I'd like to share my solution here.
Firstly, we all know it is so called CORS standard (cross-origin resource sharing) which means one resource we opened up from website A request another resource from website B (reference). Therefore, in your case, assume the original web server (with domain AAA.com) and your netty server (domain BBB.com), then append this line to your netty server to get permission:
config.setOrigin("http://AAA.com");
Note that you cannot use wildcard (*) for Access-Control-Allow-Origin in netty-socketio as it set credentials (i.e., Access-Control-Allow-Credentials) TRUE by default (see here). Keep in mind that the browser will also reject any response that does not have the Access-Control-Allow-Credentials: true header, and not make the response available to the invoking web content. Hope these help.
The followings are my library versions:
netty-socketio version
<dependency>
<groupId>com.corundumstudio.socketio</groupId>
<artifactId>netty-socketio</artifactId>
<version>1.7.6</version>
</dependency>
socket.io.javascript
script(type="text/javascript", src="https://cdn.socket.io/socket.io-1.3.5.js")
Use netty-socketio 1.7.1 or 1.6.6 version. Ability to set custom Access-Control-Allow-Origin via Configuration.origin parameter was added in this version.