Error exporting new datasource
-
I created a new datasource and got the following stack trace trying to export all:
ERROR 2009-12-14 14:48:17,570 (com.serotonin.web.dwr.ExceptionDetectionFilter.doFilter:29) - DWR invocation exception com.serotonin.ShouldNeverHappenException: com.serotonin.json.JsonException: Error reading 'alarmLevel' from value com.serotonin.mango.vo.dataSource.openv4j.OpenVDataSourceVO@39d0c448 at com.serotonin.mango.web.dwr.EmportDwr.createExportData(EmportDwr.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.mango.web.dwr.util.LoggedInAjaxFilter.doFilter(LoggedInAjaxFilter.java:39) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.web.dwr.LocalizationFilter.doFilter(LocalizationFilter.java:54) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.web.dwr.ExceptionDetectionFilter.doFilter(ExceptionDetectionFilter.java:23) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283) at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52) at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101) at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619) Caused by: com.serotonin.json.JsonException: Error reading 'alarmLevel' from value com.serotonin.mango.vo.dataSource.openv4j.OpenVDataSourceVO@39d0c448 at com.serotonin.json.JsonWriter.writeObjectImpl(JsonWriter.java:120) at com.serotonin.json.JsonWriter.writePropertyValue(JsonWriter.java:201) at com.serotonin.json.JsonWriter.writeListSet(JsonWriter.java:215) at com.serotonin.json.JsonWriter.writePropertyValue(JsonWriter.java:170) at com.serotonin.json.JsonWriter.writePropertyValue(JsonWriter.java:192) at com.serotonin.json.JsonWriter.write(JsonWriter.java:73) at com.serotonin.json.JsonWriter.write(JsonWriter.java:64) at com.serotonin.mango.web.dwr.EmportDwr.createExportData(EmportDwr.java:77) ... 34 more Caused by: java.lang.NullPointerException at com.serotonin.json.JsonWriter.writeObjectImpl(JsonWriter.java:117) ... 41 more Listening for transport dt_socket at address: 11555 WARN 2009-12-14 14:48:17,584 (org.directwebremoting.util.CommonsLoggingOutput.warn:67) - Method execution failed: com.serotonin.ShouldNeverHappenException: com.serotonin.json.JsonException: Error reading 'alarmLevel' from value com.serotonin.mango.vo.dataSource.openv4j.OpenVDataSourceVO@39d0c448 at com.serotonin.mango.web.dwr.EmportDwr.createExportData(EmportDwr.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.mango.web.dwr.util.LoggedInAjaxFilter.doFilter(LoggedInAjaxFilter.java:39) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.web.dwr.LocalizationFilter.doFilter(LocalizationFilter.java:54) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.web.dwr.ExceptionDetectionFilter.doFilter(ExceptionDetectionFilter.java:23) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283) at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52) at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101) at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619) Caused by: com.serotonin.json.JsonException: Error reading 'alarmLevel' from value com.serotonin.mango.vo.dataSource.openv4j.OpenVDataSourceVO@39d0c448 at com.serotonin.json.JsonWriter.writeObjectImpl(JsonWriter.java:120) at com.serotonin.json.JsonWriter.writePropertyValue(JsonWriter.java:201) at com.serotonin.json.JsonWriter.writeListSet(JsonWriter.java:215) at com.serotonin.json.JsonWriter.writePropertyValue(JsonWriter.java:170) at com.serotonin.json.JsonWriter.writePropertyValue(JsonWriter.java:192) at com.serotonin.json.JsonWriter.write(JsonWriter.java:73) at com.serotonin.json.JsonWriter.write(JsonWriter.java:64) at com.serotonin.mango.web.dwr.EmportDwr.createExportData(EmportDwr.java:77) ... 34 more Caused by: java.lang.NullPointerException at com.serotonin.json.JsonWriter.writeObjectImpl(JsonWriter.java:117) ... 41 more WARN 2009-12-14 14:48:17,588 (org.directwebremoting.util.CommonsLoggingOutput.warn:59) - --Erroring: batchId[3] message[com.serotonin.ShouldNeverHappenException: com.serotonin.json.JsonException: Error reading 'alarmLevel' from value com.serotonin.mango.vo.dataSource.openv4j.OpenVDataSourceVO@39d0c448] 14.12.2009 14:48:19 org.apache.coyote.http11.Http11Protocol pause
I have no such property alarmLevel.
Any idea what happend?
The sources com.serotonin.json are missing (GPL violation?)
Thanks in advance
Arne
-
Perhaps posting your source would help.
-
package com.serotonin.mango.vo.dataSource.openv4j; import com.serotonin.json.JsonException; import com.serotonin.json.JsonObject; import com.serotonin.json.JsonReader; import com.serotonin.json.JsonRemoteProperty; import com.serotonin.mango.Common; import com.serotonin.mango.rt.dataSource.DataSourceRT; import com.serotonin.mango.rt.dataSource.openv4j.OpenVDataSourceRT; import com.serotonin.mango.rt.event.type.AuditEventType; import com.serotonin.mango.util.ExportCodes; import com.serotonin.mango.vo.dataSource.DataSourceVO; import com.serotonin.mango.vo.dataSource.PointLocatorVO; import com.serotonin.mango.vo.event.EventTypeVO; import com.serotonin.util.SerializationHelper; import com.serotonin.util.StringUtils; import com.serotonin.web.dwr.DwrResponseI18n; import com.serotonin.web.i18n.LocalizableMessage; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.List; import java.util.Map; import net.sf.openv4j.Devices; import net.sf.openv4j.Protocols; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class OpenVDataSourceVO extends DataSourceVO<OpenVDataSourceVO> { private final static Log LOG = LogFactory.getLog(OpenVDataSourceVO.class); private static final ExportCodes EVENT_CODES = new ExportCodes(); static { EVENT_CODES.addElement(OpenVDataSourceRT.DATA_SOURCE_EXCEPTION_EVENT, "DATA_SOURCE_EXCEPTION"); EVENT_CODES.addElement(OpenVDataSourceRT.POINT_READ_EXCEPTION_EVENT, "POINT_READ_EXCEPTION"); EVENT_CODES.addElement(OpenVDataSourceRT.POINT_WRITE_EXCEPTION_EVENT, "POINT_WRITE_EXCEPTION"); } @JsonRemoteProperty private String commPortId; private int updatePeriodType = Common.TimePeriods.MINUTES; @JsonRemoteProperty private int updatePeriods = 1; @JsonRemoteProperty private Devices device; @JsonRemoteProperty private Protocols protocol; @Override public Type getType() { return Type.OPEN_V_4_J; } @Override protected void addEventTypes(List<EventTypeVO> eventTypes) { eventTypes.add(createEventType(OpenVDataSourceRT.DATA_SOURCE_EXCEPTION_EVENT, new LocalizableMessage("event.ds.dataSource"))); eventTypes.add(createEventType(OpenVDataSourceRT.POINT_READ_EXCEPTION_EVENT, new LocalizableMessage("event.ds.pointRead"))); eventTypes.add(createEventType(OpenVDataSourceRT.POINT_WRITE_EXCEPTION_EVENT, new LocalizableMessage("event.ds.pointWrite"))); } @Override public LocalizableMessage getConnectionDescription() { return new LocalizableMessage("common.default", commPortId); } @Override public PointLocatorVO createPointLocator() { return new OpenVPointLocatorVO(); } @Override public DataSourceRT createDataSourceRT() { return new OpenVDataSourceRT(this); } @Override public ExportCodes getEventCodes() { return EVENT_CODES; } @Override protected void addPropertiesImpl(List<LocalizableMessage> list) { AuditEventType.addPropertyMessage(list, "dsEdit.openv4j.port", commPortId); AuditEventType.addPeriodMessage(list, "dsEdit.updatePeriod", updatePeriodType, updatePeriods); } @Override protected void addPropertyChangesImpl(List<LocalizableMessage> list, OpenVDataSourceVO from) { AuditEventType.maybeAddPropertyChangeMessage(list, "dsEdit.openv4j.port", from.commPortId, commPortId); AuditEventType.maybeAddPeriodChangeMessage(list, "dsEdit.updatePeriod", from.updatePeriodType, from.updatePeriods, updatePeriodType, updatePeriods); } public String getCommPortId() { return commPortId; } public void setCommPortId(String commPortId) { this.commPortId = commPortId; } public int getUpdatePeriodType() { return updatePeriodType; } public void setUpdatePeriodType(int updatePeriodType) { this.updatePeriodType = updatePeriodType; } public int getUpdatePeriods() { return updatePeriods; } public void setUpdatePeriods(int updatePeriods) { this.updatePeriods = updatePeriods; } @Override public void validate(DwrResponseI18n response) { super.validate(response); if (StringUtils.isEmpty(commPortId)) { response.addContextualMessage("commPortId", "validate.required"); } if (!Common.TIME_PERIOD_CODES.isValidId(updatePeriodType)) { response.addContextualMessage("updatePeriodType", "validate.invalidValue"); } if (updatePeriods <= 0) { response.addContextualMessage("updatePeriods", "validate.greaterThanZero"); } } // /// /// Serialization /// // private static final long serialVersionUID = -1; private static final int version = 2; // Serialization for saveDataSource private void writeObject(ObjectOutputStream out) throws IOException { out.writeInt(version); out.writeInt(updatePeriodType); out.writeInt(updatePeriods); SerializationHelper.writeSafeUTF(out, commPortId); SerializationHelper.writeSafeUTF(out, device.name()); SerializationHelper.writeSafeUTF(out, protocol.name()); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int ver = in.readInt(); // Switch on the version of the class so that version changes can be elegantly handled. switch (ver) { case 2: updatePeriodType = in.readInt(); updatePeriods = in.readInt(); commPortId = SerializationHelper.readSafeUTF(in); device = Devices.valueOf(SerializationHelper.readSafeUTF(in)); protocol = Protocols.valueOf(SerializationHelper.readSafeUTF(in)); break; } } @Override public void jsonDeserialize(JsonReader reader, JsonObject json) throws JsonException { LOG.info("WRITE TO JSON"); super.jsonDeserialize(reader, json); LOG.info("SUPER TO JSON"); Integer value = deserializeUpdatePeriodType(json); if (value != null) updatePeriodType = value; LOG.info("JSON OK"); } @Override public void jsonSerialize(Map<String, Object> map) { super.jsonSerialize(map); serializeUpdatePeriodType(map, updatePeriodType); } /** * @return the device */ public Devices getDevice() { return device; } /** * @param device the device to set */ public void setDevice(Devices device) { this.device = device; } /** * @return the device */ public Devices[] getDevices() { return Devices.values(); } /** * @return the protocol */ public Protocols getProtocol() { return protocol; } /** * @param protocol the protocol to set */ public void setProtocol(Protocols protocol) { this.protocol = protocol; } /** * @return the protocols */ public Protocols[] getProtocols() { return Protocols.values(); } }
-
Annotate your class with "@JsonRemoteEntity". The JSON serializer is picking up the s/getAlarmLevel from the super class.
-
Thanks,
it works. (I will have to look better doing past and copy next time:-))
Arne
-
Are your data sources completed/tested? You did mbus and openv?
-
No consider both as highly experimental...
Currently I work on openv read maybe write access.
If this is done I have to update the m-bus sources at mbus4j.sf.net to the latest specification (IEC).
Once this is done I plan to support primary adressing with no change of the data frame.
Later support for- secondary addressing.
- rewrite JSP to make it more compact
- ability of changing frames.
- atmodem support (atmodem4j.sf.net).
My problem is currently that I have no direct access to m-bus hardware so this is mostly tested against dummys or mbus data from different readouts.
If anyone has access to hardware it will speedup development.
Arne
-
If anyone has access to hardware it will speedup development.
Isn't that always the problem! I might as well make a shout out now for OPC XML-DA hardware. If anyone has any that they can make internet accessible for the purposes of data source testing, please let me know. I know there are some sample servers on the internet, but those i've found so far contain a single unchanging point. Not very useful...
-
Maybe try using WinCC from SIEMENS that has XML-OPC capabilities - I never tested it...
I think you can grap a demo version vom your local dealer.
Or could you send me the code for initial testing?
Arne
-
I haven't written any code yet. There was no point in starting without decent equipment to work against. You have some OPC XML-DA stuff? Any chance i could hit it up for a bit? Could you open just to a particular IP address?
-
What about OPC UA (xml and binary protocol) I dont know the licence restrictions for any?
And for software see www.opcfoundation.org, there seem many servers and clients for demo available???
Arne
-
And for software see www.opcfoundation.org, there seem many servers and clients for demo available???
That would be what i was referring to:
I know there are some sample servers on the internet, but those i've found so far contain a single unchanging point. Not very useful...
-
What exact is your plan OPS server, client or both.
I looked at the Java6 implementation of the Web service or axis2 or....
if mango should act as a server we need a client first - I can test it against WinCC.
after that the server should be easily implemented.Arne
-
Mango is primarily intended to act as a server.
-
So maybe implement at first the client into mango ;-) (one can use the get function to retrieve data from other (OPC-servers - which in turn could be simple devices...)
to have a testet client - and then do the server stuff.what do you plan to use JAX-WS or Axis2?
Arne
-
I use axis because i know it better, and it has ANT support (which i couldn't find in less than 5 minutes for JAX). But if someone else is doing the work it doesn't matter to me.