Monitoring the state of currently running processes and reacting to ad-hoc situations during runtime is a key challenge in Business Process Management (BPM). This is especially the case in cyber-physical environments that are characterized by high context sensitivity. MAPE-K control loops are widely used for self-management in these environments and describe four phases for approaching this challenge: Monitor, Analyze, Plan, and Execute. In this paper, we present an architectural solution as well as implementation proposals for using MAPE-K control loops for adaptive workflow management in smart factories. We use Complex Event Processing (CEP) techniques and the process execution states of a Workflow Management System (WfMS) in the monitoring phase. In addition, we apply automated planning techniques to resolve detected exceptional situations and to continue process execution. The experimental evaluation with a physical smart factory shows the potential of the developed approach that is able to detect failures by using IoT sensor data and to resolve them autonomously in near real time with considerable results.