Closed ebaysteve closed 9 years ago
See this tutorial: How to register a function as a Plugin in OrientDB.
Thanks for the info. I am running into one more issue. I have a class that extends from OServerCommandAuthenticatedDbAbstract. I tried to put it in the plugins directory, but I kept getting a ClassNotFound exception. When it was in the plugins directory I also received the following error:
java.lang.ClassCastException: org.kp.tro.cerebro.graph.plugins.orient.CerebroDlpTokenLoader cannot be cast to com.orientechnologies.orient.server.plugin.OServerPlugin
When I moved it into the lib directory the server seemed to start but when I issued the POST, per the config, it responded Command Not Found.
Do you have any examples that show adding a server extension that uses http?
Steve Gillis Solution Consulting Cnslt/Spec Cyber Security | Data Protection | Technology Risk Office Office: 925.924.4953 Mobile: 707.592.7305
NOTICE TO RECIPIENT: If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them. Thank you.
From: Vitor Enes Duarte notifications@github.com To: orientechnologies/orientdb orientdb@noreply.github.com Cc: Steve M Gillis/CA/KAIPERM@KAIPERM Date: 05/01/2015 09:17 AM Subject: Re: [orientdb] Custom command plugin (#4063)
See this tutorial: How to register a function as a Plugin in OrientDB. — Reply to this email directly or view it on GitHub.
I don't have any, but I'm guessing you're right about moving it to $ORIENTDB_HOME/lib. But don't forget to register it in $ORIENTDB_HOME/config/orientdb-server-config.xml. Something like:
<listener protocol="http" port-range="2480-2490" ip-address="0.0.0.0">
<commands>
<!-- other commands -->
<command implementation="org.kp.tro.cerebro.graph.plugins.orient.CerebroDlpTokenLoader" pattern="yourPattern">
<parameters>
<!-- maybe some params -->
</parameters>
</command>
</commands>
</listener>
You've probably already seen this.
I was able to follow the tutorial in the docs and came up with this.
I have it working locally as well. Looks like I was specifying the port when I should not have been. I noticed during startup there were a few ports used, 2480 and 2481. When I ran the command on 2481 it worked. Also when I ran it without specifying the port it worked as well.
Thanks for the help. Now on to more coding to get this thing working.
Steve Gillis Solution Consulting Cnslt/Spec Cyber Security | Data Protection | Technology Risk Office Office: 925.924.4953 Mobile: 707.592.7305
NOTICE TO RECIPIENT: If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them. Thank you.
From: Vitor Enes Duarte notifications@github.com To: orientechnologies/orientdb orientdb@noreply.github.com Cc: Steve M Gillis/CA/KAIPERM@KAIPERM Date: 05/01/2015 01:10 PM Subject: Re: [orientdb] Custom command plugin (#4063)
I was able to follow the tutorial in the docs and came up with this. — Reply to this email directly or view it on GitHub.
Thanks again for all you help. I am having one more issue trying to execute the custom command from within a Java Application. Are there any code examples of how to properly do this. I keep getting a connection refused error:
HttpClient httpClient = new HttpClient(); httpClient.getState().setCredentials( new AuthScope(null, 80, "OrientDB db-DemoGraph"), new UsernamePasswordCredentials( "root", "password"));
int statusCode = httpClient.executeMethod(
postMethod);
Steve Gillis Solution Consulting Cnslt/Spec Cyber Security | Data Protection | Technology Risk Office Office: 925.924.4953 Mobile: 707.592.7305
NOTICE TO RECIPIENT: If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them. Thank you.
From: Vitor Enes Duarte notifications@github.com To: orientechnologies/orientdb orientdb@noreply.github.com Cc: Steve M Gillis/CA/KAIPERM@KAIPERM Date: 05/01/2015 01:10 PM Subject: Re: [orientdb] Custom command plugin (#4063)
I was able to follow the tutorial in the docs and came up with this. — Reply to this email directly or view it on GitHub.
I've updated the tutorial with a possible solution.
Were you ever able to get this to work? I copied your github example directly and the orientdb server still wouldn't recognize the custom command. It doesn't show any errors in the log so I'm not sure what's going on.
@jbkielis Did you follow every step of the tutorial?
Yes, I'm running on 2.0.12. Does it work on that?
I don't know, but it should. If you don't see the message "INFO new hello command [OServerCommandGetHello]" when starting OrientDB, then the plugin is not properly installed. Did you restart the OrientDB server?
As more context, if I put the jar file in the plugins directory, I do get a server error that it couldn't find the class. This indicates to me that it's registered correctly in the server config file. When I move the jar file to the lib directory I no longer get the error, but I still can't seem to access the endpoint. I continually get a 405.
Do you see the message when starting the server?
When I put the jar file in the plugins directory i see the following: http://i.imgur.com/Jmbjkql.png When I put the jar file in the lib directory I see the following: http://i.imgur.com/MwTGLzd.png
No message that the new command has been registered.
Can you share your orientdb-server-config.xml?
How you're calling the endpoint? There's an error?
http://serverurl:2480/hello/development/Tom
error is 405 response with: Command not found: hello/development/Tom
I can successfully hit the gephi endpoint at: http://serverurl:2480/gephi/ so I don't think the url is bad
I'll take a look to this today. I'll let you know.
Ah, figured it out! I was using the hello class that was posted on the orientdb tutorial page, which is slightly different than yours. It contains the following: return new String[]{"GET|hello/* POST|hello/*"}; Note the two endpoints that are part of 1 string. That obviously doesn't work, so you have to separate the two commands into separate strings.
Thanks for your help!
Glad you worked it out!
Ok, I'm closing this.
I created a custom command plugin on 2.0.8. The plugin was loaded into the plugins directory. When attempting to start the server I receive a plugins.json cannot be found.