I've tried to send a CoAP message to IN-CSE in OM2M but IN-CSE printed NullpointerException like the picture I've uploaded.
I solved the problem by modifying CoAPServer class in OM2M source code.
I think the problem is "to=coap://localhost/~/in-cse" so I modified requestPrimitive.setTo(request.getURI())
to request.Primivice.setTo(request.getOptions().getURIString()) in CoAPServer class.
I think this way is not good, I don't know how to solve the problem without modifying the code...
If anyone knows any other way, let me know.
Thanks
-- append
I found the solution to remove the error.
First, I checked the OM2M version released. and I tried to send CoAP message to old version(1.0.0). then It was transferred well without problem. but the latest version had an error. So I compared the two codes.( I focused on CoapServer.java in org.eclipse.om2m.binding.coap)
In Coapserver.java, service() create a requestPrimitive object and transfer to Router.java. and It puts the targetId as a "to" variable in the requestPrimitive object via setTargetId() (setTargetId() calls setTo()) in 1.0.0 version. but In the latest version, it puts the string returned getURI() as a "to" variable in the requestPrimitive object.
(and in the latest version it does not seem to use targetId unless I use it.)
targetId contained "/in-cse" and getURI() returned "coap://localhost/~/in-cse".
enter image description here
enter image description here
The lastest version removed setTargetId() in reqeustPrimitive class. so when I modified setTo(getURI()) to setTo(targetId), it was transferred well.
enter image description here
enter image description here
Is this the bug of the lastest version? or am I doing something wrong?
Related
I'm attempting to use an online timestamp authority (rfc3161) with the Digital Signature Service Java library. However, the following snippet (from their test cases, and similar to the one from their Cookbook):
String tspServer = "http://tsa.belgium.be/connect";
OnlineTSPSource otsp = new OnlineTSPSource(tspServer);
/* tried setting otsp.setDataLoader(new TimestampDataLoader());
too, as it defaults to otsp.setDataLoader(new
NativeHTTPDataLoader()); the exception happens in both cases */
byte[] digest = DSSUtils.digest(DigestAlgorithm.SHA1, "Hello world".getBytes());
TimeStampToken timeStampResponse =
otsp.getTimeStampResponse(DigestAlgorithm.SHA1, digest);
always ends with the following exception:
eu.europa.esig.dss.DSSException:
java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError:
org.apache.commons.io.IOUtils.closeQuietly(Ljava/io/Closeable;)V
Already tried many different public rfc3161 servers (some listed here). Sure there's something wrong going on there, but, as a beginner, I cannot understand what is wrong (what method should be there).
If anyone could put me in the right direction to get the snippet working (or even be kind enough to comment a reliable startup guide on cades/xades/pades with Java's bouncycastle) I would be really grateful.
As stated in the comments by Marteen Bodewes and Mark Rotteveel, there was something wrong with the version of Apache Commons-IO in the classpath. The project is set using Apache Maven and there was an old Commons-IO version declared there as a dependency. In this case, it was enough to remove that declaration, so Maven could download the appropriate version that was declared as an esig/DSS dependency.
esig/DSS version was 5.4 at the time.
I have an SOAP 1.1 Service developed with Spring Boot in Java which responses without any problems to any of my requests and deliver a valid SOAP-response.
Now the problem is as soon as I add this service as Service Reference to any .NET/C# project the reference gets created and I can send requests but the response (Which get definitely sent from my SOAP-Service) cant be mapped back and the object in my .NET application is always null.
I already found out what the problem might be but I don't know exactly how (of if it is even possible like this) to change my xsd/wsdl to generate all the sources correctly.
First of all here is my .xsd from my Java Spring Boot project for the generation of the WSDL & Service Reference:
Here is the code from the generated Service Reference from Visual Studio in a C# project:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute([NAMESPACE]/processing", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("processingResponse", Namespace="http://[NAMESPACE]/base", IsNullable=true)]
public processingResponse processing([System.Xml.Serialization.XmlElementAttribute(Namespace="http://[NAMESPACE]/base", IsNullable=true)] processingRequest processingRequest) {
object[] results = this.Invoke("processing", new object[] {
processingRequest});
return ((processingResponse)(results[0]));
}
I found out if I change the following line
[return: System.Xml.Serialization.XmlElementAttribute("processingResponse", Namespace="http://[NAMESPACE]", IsNullable=true)]
and add "Form=System.Xml.Schema.XmlSchemaForm.Unqualified":
[return: System.Xml.Serialization.XmlElementAttribute("processingResponse", Namespace="http://[NAMESPACE]", IsNullable=true, Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
The response gets mapped correctly to my Object and it seem to work like this without any problems at the moment.
The problem is that I want to change my .xsd to generate these sources correctly from the start - I already tried to add Form=Unqualified to the "AppDataDataResult" element inside the "processingResponse" complexType but it doesnt work.
Adding this property directly to the processingResponse Element isn't working either cause it's not possible cause the <xs:element/> is one level beneath the schema definition/tag.
I havent found any concrete solution to this problem cause it seems to be very specific with the Spring Boot Framework Java, and the generation of the wsdl.
I hope someone can help me with this problem cause it doesnt seem to be a big one (Its "only" a attribute which needs to get added during the generation of the sources) but I cant seem to find a solution to this. Thanks in advance for the help!
I found the Problem and it was a really simple fix for this Issue - In my Spring Boot Project I was returning JAXBElements and a Parameter for the response is the "QName" which indicates the Object of the Response. The Problem here was that the SOAP-Response did not have the relevant Namespace to identify the Object during the generation of Sources in .NET. So I added the correct Namespace-URI to the QName-Object and now the objects gets resolved and returns the correct responses:
final QName qname = new QName(NAMESPACE_URI, "processingResponse");
return new JAXBElement<>(qname, ProcessingResponse.class, processingResponse);
In the end it was a pretty stupid/simple problem but I tried everything else but havent tried to most obvious/easiest.
I am setting up GATE to run on a text document, I want to use DefaultTokenizer and POSTagger, but I am getting error while initializing ANNIE controller.
Exception in thread "main" gate.creole.ResourceInstantiationException: No URL provided for the rules!
at gate.creole.tokeniser.SimpleTokeniser.init(SimpleTokeniser.java:131)
at gate.Factory.createResource(Factory.java:302)
at gate.Factory.createResource(Factory.java:117)
at gate.creole.tokeniser.DefaultTokeniser.init(DefaultTokeniser.java:55)
at gate.Factory.createResource(Factory.java:302)
at gate.Factory.createResource(Factory.java:97)
Can you please help?
Could you please share information how you created application pipeline?
From the error description I can assume that you have a wrong path in your Tokenizer. May be you accidentally added something to default path.
ProcessingResource tokeniser = (ProcessingResource) Factory.createResource("gate.creole.tokeniser.DefaultTokeniser",Factory.newFeatureMap());
SerialAnalyserController pipeline = (SerialAnalyserController) Factory.createResource("gate.creole.SerialAnalyserController");
pipeline.add(tokeniser);
I think the issue was with its home, so I just removed old version, reinstalled GATE latest version and set path accordingly and it worked.
I am using SVNKit to checkout svn base repository. Earlier I was using checkout to head for that purpose I was using SVNRevision.HEAD. It was working fine without issue.
below is the syntax of same and revision.Head was used in case of checkout to Head.
doCheckout(SVNURL url,File dstPath,SVNRevision pegRevision,SVNRevision revision, boolean recursive)
but let say if I have to checkout to a specific revision for example 27988, what should be value of pegRevision parameter ?
I am confused please help, I tried HEAD/BASE for pegrevision and also same 27988 etc but it gives error like URL not exist etc .
Just an update, problem was with my code revision was going as 0 always due to some logic issue hence SVN URL was not found and giving error. I tried now with HEAD as pegRevision and 27988 revision works just fine. Thanks!
Well, first, you have to specify an SVNRevision, not an integer.
long targetRev = 27988;
SVNRevision revision = SVNRevision.create( targetRev );
doCheckout(...
As for pegRevision, you almost certainly want SVNRevision.HEAD. As the docs specify, it is:
the revision at which url will be firstly seen in the repository to
make sure it's the one that is needed
So, HEAD is usually sufficient. When it's not, things get complicated (and very specific), see the svn book.
I am working on a XMPP client on Android, using the Smack library. The roster/messaging/presence stuff is running very well. However, I didn't find a way to store additional profile information (userpicture, the dogs name, ...).
The only way I see from googling is using VCards. But it simply did not work. I tried the following:
VCard vCard = new VCard();
vCard.load(connection);
vCard.setEmailHome("meine_home#email.de");
vCard.setLastName("Scheller");
vCard.setField("blafasel", "asdf");
vCard.save(connection);
Then I was looking for a way to see that VCard information. It did neither show up in iChat nor in this System.out:
vCard.load(connection, user);
System.out.println(user + " has this vCard: " + vCard.toXML());
So anything went wrong, but theres no indication what it was. I tried this with the google talk server and my own copy of openfire with the same result. Btw, I am using this version of Smack: http://davanum.wordpress.com/2007/12/31/android-just-use-smack-api-for-xmpp/
What am I doing wrong here? What is the correct way of storing profile related information with Smack?
I have checked out the source of Smack and went through the important parts with a debugger, as well as using the Smack Debug Window. The problem is inside the VCard implementation of the Smack API. Saving a VCard does work as described, however the loading is broken.
parseIQ(XmlPullParser parser) is part of the PacketReader.java class and handles different types of packages. It only handles tags with the following namespaces:
"jabber:iq:auth",
"jabber:iq:roster",
"jabber:iq:register",
"urn:ietf:params:xml:ns:xmpp-bind"
It also looks if there is any registered IQProvider in the ProviderManager. And this is the root of my problem. There is no IQProvider for VCards registered. So whatever information is inside of the vCard tag simply gets dropped.
It is not too hard to register this IQProvider though:
ProviderManager.getInstance().addIQProvider("vCard", "vcard-temp", new VCardProvider());
This solved my little example above for saving my own vCard and downloading it again. I am still having trouble with downloading other users vcards... Gonna have a closer look into this and maybe open up another thread for that issue.
You can use the following code to get info.
VCard card = new VCard();
card.load(connection, "user#fqdn");
System.out.println("Voice: "+card.getPhoneHome("VOICE"));
Try setting a vCard for that user with another client first, and see how that changes your results. In order to diagnose further, you'll need to turn on protocol debugging in Smack (use "-Dsmack.debugEnabled=true" on a desktop machine), and post the relevant bits here.