java.awt.Paint error on vision window open in designer

Whenever I open a vision window(with objects on it) in the designer I receive the following error.

I am not certain what is causing it any guidance on where to look would be greatly appreciated.

java.lang.ClassCastException: Unable to create new interface java.awt.Paint. java.awt.Paint
	at com.inductiveautomation.ignition.common.TypeUtilities$DefaultClassInitializer.createNew(TypeUtilities.java:1663)
	at com.inductiveautomation.ignition.common.TypeUtilities.getInitValueForClass(TypeUtilities.java:1613)
	at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.setQValue(AbstractPropertyAdapter.java:216)
	at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.setQValue(SimpleBoundTagAdapter.java:245)
	at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:262)
	at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.notifyTagChanged(SimpleBoundTagAdapter.java:498)
	at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.tagChanged(SimpleBoundTagAdapter.java:487)
	at com.inductiveautomation.ignition.client.sqltags.impl.db.DatasourceTagManager$TagChangeListenerProxy.tagChanged(DatasourceTagManager.java:1108)
	at com.inductiveautomation.ignition.client.sqltags.impl.db.DatasourceTagManager.subscribe(DatasourceTagManager.java:299)
	at com.inductiveautomation.ignition.client.sqltags.impl.ClientTagManagerImpl.subscribe(ClientTagManagerImpl.java:422)
	at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.startup(SimpleBoundTagAdapter.java:140)
	at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.startupAdapters(DefaultInteractionController.java:332)
	at com.inductiveautomation.factorypmi.application.FPMIWindow.startup(FPMIWindow.java:348)
	at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace$DesigntimeWindowOpener.openWindow(WindowWorkspace.java:3575)
	at com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace.openWindow(WindowWorkspace.java:1333)
	at com.inductiveautomation.factorypmi.designer.workspace.StartupPanel$ResourceThumbnail.onClick(StartupPanel.java:339)
	at com.inductiveautomation.factorypmi.designer.workspace.StartupPanel$ThumbnailButton$1.mouseClicked(StartupPanel.java:244)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.9.3 (b2017060210)
Java: Oracle Corporation 1.8.0_74

Hi Irose :slight_smile:,
did you solve the problem?
I have the same message and in my opinion is due to a bad conversion from string to color when reading the color value from a tag (string) to assigni it to a component field property, as FillColor.

first error message:

ClassCastException: Unable to create new interface java.awt.Paint. java.awt.Paint

Ignition v7.9.8 (b2018053113)
Java: Oracle Corporation 1.8.0_172

second and following error messages:

ClassCastException: Cannot coerce string value '-1' into a color

Ignition v7.9.8 (b2018053113)
Java: Oracle Corporation 1.8.0_172

Tag bindings typically deliver an integer -1 on startup, no matter what they really are, until the first poll for tag values returns. Prior to that first poll, the datatype is unknown, so even datasets and other types will get the -1. Consider using the toColor() expression function instead of relying on implicit string-to-color conversion, then you can wrap it in the try() function to catch this phenomenon.

2 Likes

Tag bindings typically deliver an integer -1 on startup

thank you pturmel :+1: that was sufficent to manage all the possible cases

Thanks for the information pturmel, however, not all of my displays have component scripting on them, and as far as I can tell it doesn’t matter which window I open. There is some tag scripting in the project, but, as far as I understand these scripts should not occur until following startup. Please correct me if I am wrong.

Thanks,

This is more a problem with tag binding than scripting. It only impacts scripts to the extent that the affected properties have propertyChange scripts.