> > java.lang.RuntimeException: Failed to invoke > public org.apache.activemq.command.ActiveMQDestination() with no args > java.lang.RuntimeException: Failed to invoke public > org.apache.activemq.command.ActiveMQDestination() with no args >
This error message means that Gson is trying to deserialize an ActiveMQDestination object but doesn't know how to because it doesn't have a constructor that takes no arguments. Of course, your code isn't supposed to be deserializing objects of that time, so the real question is why that's happening. at > com.google.gson.internal.ConstructorConstructor$3.construct( > ConstructorConstructor.java:111) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read( > ReflectiveTypeAdapterFactory.java:206) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read( > ReflectiveTypeAdapterFactory.java:116) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read( > ReflectiveTypeAdapterFactory.java:216) > at com.google.gson.Gson.fromJson(Gson.java:879) > at com.google.gson.Gson.fromJson(Gson.java:844) > at com.google.gson.Gson.fromJson(Gson.java:793) > at com.google.gson.Gson.fromJson(Gson.java:765) > Gson code is being invoked. Did you manually configure a serializer/unserializer? (In Jackson, you'd make an ObjectMapper that knew how to serialize and deserialize, but I've not used Gson so I'm not sure how it works.) If so, might you have configured something about it incorrectly? > at > de.mannheim.wifo2.fesas.sasStructure.data.adaptationLogic.knowledge. > KnowledgeRecord.getData(KnowledgeRecord.java:61) > Is this your code, or at least code to which you have the source? What is it doing? Also, what text is being passed to Gson.fromJson()? If you have this source, you can use a debugger to answer that question; if not, set a breakpoint on the fromJson() method (for which the source code is definitely available) and look at the value of the passed argument. I suspect you'll find it contains more content than just the JSON you listed below. > at logicElements.monitor.Monitor.callLogic(Monitor.java:130) > at logicElements.monitor.Monitor$3.onMessage(Monitor.java:211) > How about these two methods? Are they yours? What are they doing? How are they turning an ActiveMQMessage into text that is getting passed to the Gson.fromJson() method? > at > org.apache.activemq.ActiveMQMessageConsumer.dispatch( > ActiveMQMessageConsumer.java:967) > at > org.apache.activemq.ActiveMQSessionExecutor.dispatch( > ActiveMQSessionExecutor.java:122) > at > org.apache.activemq.ActiveMQSessionExecutor.iterate( > ActiveMQSessionExecutor.java:192) > at > org.apache.activemq.thread.PooledTaskRunner.runTask( > PooledTaskRunner.java:122) > at > org.apache.activemq.thread.PooledTaskRunner$1.run( > PooledTaskRunner.java:43) > at > java.util.concurrent.ThreadPoolExecutor.runWorker( > ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run( > ThreadPoolExecutor.java:617) > at java.lang.Thread.run(Thread.java:745) > Caused by: java.lang.InstantiationException > at > sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance( > InstantiationExceptionConstructorAccessorImpl.java:48) > at java.lang.reflect.Constructor.newInstance(Constructor.java:423) > at > com.google.gson.internal.ConstructorConstructor$3.construct( > ConstructorConstructor.java:108) > ... 18 more > None of the code in this final block is relevant to your problem. > The String das is sent is similar to this: > > {"Tulips_1":{"Zone":"Tulips","PresenceSensor":false," > Thermometer":289,"Illuminance":1146,"CO2-Level":400,"CO- > Level":440,"FloodSensor":true},"Roses_1":{"Zone":"Roses"," > PresenceSensor":true,"Thermometer":290,"Illuminance" > :214,"CO2-Level":300,"CO-Level":430,"FloodSensor":true}} > What do you get when you call Gson.fromJson() on this input string? Tim