I'm trying to use the EWS Java library (link) with LispWorks 7.1.2 Win32's Java interface. I am somewhat familiar with basic Java concepts but have no experience with the Java language. This is the code I am trying to mimic:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
So I figured I would create an ExchangeVersion object (which is an enum), set it to the value "Exchange2010_SP2", and pass it to another create-java-object expression for the ExchangeService object.
This was my first step:
(create-java-object "microsoft.exchange.webservices.data.core.ExchangeService"
"microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion.Exchange2010_SP2")
However, I get the following error message: constructor of microsoft/exchange/webservices/data/core/ExchangeService first arguments is wrong type, wanted microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion got "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion.Exchange2010_SP2"
OK, so then I tried this:
(create-java-object "microsoft.exchange.webservices.data.core.ExchangeService"
"microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion")
which gave me the error: constructor of microsoft/exchange/webservices/data/core/ExchangeService first arguments is wrong type, wanted microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion got "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion". Which doesn't make much sense to me. So finally I tried to create a standalone ExchangeVersion object:
(create-java-object "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion")
which led to this error message: CREATE-JAVA-OBJECT: : Failed to find constructors for class "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion".
I wonder if anyone have suggestions on what am I doing wrong?
Many Thanks!
Related
I'm trying to get a basic Custom Vision image classifier working by following the tutorial in the Azure documentation found here: https://learn.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/quickstarts/image-classification?pivots=programming-language-java
I have followed this tutorial word for word and have spent a couple days trying to work this out. The issue I am having is when running the code I am getting the following stack trace:
Parameter this.client.endpoint() is required and cannot be null.
java.lang.IllegalArgumentException: Parameter this.client.endpoint() is required and cannot be null.
at com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation.TrainingsImpl.createProjectWithServiceResponseAsync(TrainingsImpl.java:2313)
at com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation.TrainingsImpl$TrainingsCreateProjectParameters.execute(TrainingsImpl.java:2401)
at com.microsoft.azure.cognitiveservices.vision.customvision.samples.CustomVisionSamples.ImageClassification_Sample(CustomVisionSamples.java:67)
at com.microsoft.azure.cognitiveservices.vision.customvision.samples.CustomVisionSamples.runSample(CustomVisionSamples.java:46)
at com.microsoft.azure.cognitiveservices.vision.customvision.samples.CustomVisionSamples.main(CustomVisionSamples.java:374)
The endpoint is defined here and passed as a parameter
final String Endpoint = System.getenv("AZURE_CUSTOMVISION_ENDPOINT");
CustomVisionTrainingClient trainClient = CustomVisionTrainingManager.authenticate("https://{Endpoint}/customvision/v3.0/training/", CustomVisionTrainingClientKey).withEndpoint(Endpoint);
CustomVisionPredictionClient predictClient = CustomVisionPredictionManager.authenticate("https://{Endpoint}/customvision/v3.0/prediction/", predictionApiKey).withEndpoint(Endpoint);
While the tutorial doesn't explicitly state to do so I have tried to set the system environment variable AZURE_CUSTOMVISION_ENDPOINT manually with PowerShell and it doesn't work with or without this set.
Am I missing something? Any help would be greatly appreciated!
Fixed my own issue. The environment variables had not set correctly and were null pointers. I replaced the System.getenv call to the string in plain text and this is working correctly.
When i'm trying to create a HawkConsole Object using Hawk JAVA API, i'm get bellow error message
Unable to create EMS transport:
COM.TIBCO.hawk.console.nest.shared.TransportInitializationException:
COM/TIBCO/hawk/util/security/PasswordObfuscation
I'm using the follow code to try to create the object
hawkConsole = new TIBHawkConsole("MyDomain",
"MyEMSConnectionString",
"MyUserTOEMS",
"MyPasswortoEMS",
1);
In according with the official documentation, to the last parameter can be used anyone number ... This will be ignored ...
The object is successfully created but when the below line is executed the error happens
getAgentMonitor().initialize;
I think the exact syntax is getAgentMonitor():initialize;
Try to do and told me if it works.
Problem is solved.
Its necessary add the security.jar and utils.jar extracted from lib Hawk folder, on the Top of BUildPath to work.
Trying to implement the Java SDK, following the tutorial here: https://blogs.msdn.microsoft.com/bharry/2011/05/16/announcing-a-java-sdk-for-tfs/
I have the libraries imported, but getting a compilation error
TFSTeamProjectCollection tpc =
new TFSTeamProjectCollection(BASEURL);
BASEURL is a string I defined earlier in the code.
The error is: The constructor TFSTeamProjectCollection(String) is undefined
Does anyone know how to resolve this issue?
Well, studying the C# side of things ( see here ) I can't find a constructor that would only take a String argument.
There is only a single argument constructor taking a Uri.
In other words: the fact that you your string contains a Url; and that you named it a BASEURL doesn't magically turn it from a String into a URL or URI class object.
Guessing: the ctor wants an argument of type java.net.URL which you could probably create with something like new URL(BASEURL); instead of just passing BASEURL to that constructor.
The thing is: in order to actually understand which constructors that Team Foundation class has; one would need access to the corresponding SDK from Microsoft - which you probably downloaded and and have in place. So, the only thing that you need to do ... read the javadocs!
Please forgive me, as I am a Java man dabbling in Javascript business :)
I wanted to be able to define a set of integration test cases to be easy to script against a Java application. I thought Javascript would be a perfect language to script against. To that end, I am using the Rhino engine that comes with JDK 7, via Java's Scripting API. The scripts would have access to Java classes already defined in the application, and could be reused to define use case scenarios for integration testing.
In the Java application, I have binded the javascript engine itself to the script as jsengine, so that I can load javascript files (Including a JavaScript file during Rhino eval).
I have two Javascript files, as defined below:
Function.js:
function send(msg) {
send.sendMessage(msg);
}
TestCase.js
jsengine.eval(new java.io.FileReader("Function.js");
sendMsg("Test Message");
I also have the following object defined and binded to the script as "javaobj":
public class TestConnection {
...
public void send(String message) {
// Code to send the string message via JMS
}
}
However, the Rhino engine complains with the following Exception. It seems to not like calling the javaobj's send method, for some reason.
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function send in object
function sendMsg(msg) {...}. (TestCase.js#3) in TestCase.js at line number 3
at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:224)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:212)
at com.foo.test.scenario.JavaScriptEngine.execute(JavaScriptEngine.java:56)
at com.foo.test.TestSuite.start(TestSuite.java:88)
at com.foo.test.TestSuite.main(TestSuite.java:41)
Caused by: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function send in object
function sendMsg(msg) {...}. (TestCase.js#3) in TestCase.js at line number 3
at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3773)
at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3751)
at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError(ScriptRuntime.java:3779)
at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError2(ScriptRuntime.java:3798)
at sun.org.mozilla.javascript.internal.ScriptRuntime.notFunctionError(ScriptRuntime.java:3869)
at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2345)
at sun.org.mozilla.javascript.internal.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2312)
at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Interpreter.java:1524)
at sun.org.mozilla.javascript.internal.Interpreter.interpret(Interpreter.java:854)
at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:164)
at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(ContextFactory.java:429)
at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(RhinoScriptEngine.java:116)
at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(RhinoScriptEngine.java:109)
at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(ScriptRuntime.java:3163)
at sun.org.mozilla.javascript.internal.InterpretedFunction.exec(InterpretedFunction.java:175)
at sun.org.mozilla.javascript.internal.Context.evaluateReader(Context.java:1159)
at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:214)
... 4 more
Has anyone ever encountered this type of issue with Rhino?
P.S. This question seems related, but no answer given as well (TypeError in Rhino: migration from Java 6 to Java 7)
Looks like I found my own answer. There was a name conflict between the Javascript function and the name of the binded Java object. Both having the same name, the engine tries to call a non-existent method on a Function object!
Silly me... :P
I am working on a web-app using the Play Framework. I am trying to pass a variable through a dynamic URI. I am following the example shown here. However, I am getting this error:
not enough arguments for method showClients: (clientId: Long)play.mvc.Result. Unspecified value parameter clientId.
routes file:
GET /clients/{clientId} controllers.Application.showClients
Controller Code:
public static Result showClients(Long clientId) {
Client c = clientFinder.byId(clientId);
return ok(client.render(c));
}
URL
http://localhost:9000/clients/1
Does anyone see a problem with my code? After googling around, I have found similar questions, but no one with the exact same problem, so I am thinking it is something simple. Thanks for the help.
Whoops...It looks like I was looking at documentation for a previous version of Play. The current documentation here shows that my routes file should look like this:
GET /clients/:clientId controllers.Application.showClients(clientId : Long)
Thanks to anyone who looked into finding an answer to the question.