If user tries to start and stop multiple containers with Cargo maven plugin during one maven build then classloader issues occur.
For example when starting and stopping WildFly and WildFly Swarm containers together Cargo maven plugin crash during the stop goal with ClassCastException.
This is caused by using different classloaders for handling of containers stored in plugin context. When invoking several different goals on one container the container is retrieved from plugin context, however the classloader for container is created again (if resource loader doesn't contain required classes). This can result in loading of different classes by different classloaders thus resulting in errors like ClassCastException.