# Changing route to JPA entities causing FlowableClassLoadingException class not found '\*\*'

**URL:** <https://forum.flowable.org/t/changing-route-to-jpa-entities-causing-flowableclassloadingexception-class-not-found/6531>\
**Category:** Flowable Engine\
**Created:** [August 14, 2020, 9:39am UTC](https://forum.flowable.org/t/changing-route-to-jpa-entities-causing-flowableclassloadingexception-class-not-found/6531 "2020-08-14T09:39:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BehaveRabbit](https://avatars.discourse-cdn.com/v4/letter/b/e5b9ba/32.png) [@BehaveRabbit](https://forum.flowable.org/u/BehaveRabbit)\
**Post date:** [August 14, 2020, 9:39am UTC](https://forum.flowable.org/t/changing-route-to-jpa-entities-causing-flowableclassloadingexception-class-not-found/6531/1 "2020-08-14T09:39:57Z")

</div>

I have a deployed system and would like to deploy a new version, in this new version the spring service has had a substantial refactor, with many files changing location.

When I deploy the new spring service and carry out an engine action it falls over due to `FlowableClassLoadingException class not found '**'` (see full logs below). The logs are looking for the classes in their new locations however the engine mustn’t be using these new classpaths and is expecting the old ones. This error is only coming up for the spring JPA entities NOT other files whose classpath has changed, services, delegates etc. If I move the entities back to their old classpath and redeploy the engine is happy. Delegates and services work fine with their new classpath as long as those entities are using their old classpaths.

Why is engine referencing old classpath and not updated ones, and why is this error isolated to only JPA entities?

> ## Error querying database. Cause: org.flowable.common.engine.api.FlowableClassLoadingException: Class not found: test.folder.uk.user.User

> | ### The error may exist in org/flowable/db/mapping/entity/Execution.xml  
> | ### The error may involve org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl.selectProcessInstanceWithVariablesByQueryCriteria  
> | ### The error occurred while handling results

> java.lang.ClassNotFoundException: test.folder.uk.user.User  
> | at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:51) ~[spring-boot-1.5.22.RELEASE.jar!/:1.5.22.RELEASE]  
> | at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1182) ~[tomcat-embed-core-8.5.43.jar!/:8.5.43]  
> | at java.lang.Class.forName0(Native Method) ~[na:1.8.0\_212]  
> | at java.lang.Class.forName(Class.java:348) ~[na:1.8.0\_212]  
> | at org.flowable.common.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:338) ~[flowable-engine-common-6.4.1.jar!/:6.4.1]  
> | at org.flowable.common.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:71) ~[flowable-engine-common-6.4.1.jar!/:6.4.1]  
> | at org.flowable.variable.service.impl.types.JPAEntityMappings.getJPAEntity(JPAEntityMappings.java:111) ~[flowable-variable-service-6.4.1.jar!/:6.4.1]  
> | at org.flowable.variable.service.impl.types.JPAEntityVariableType.getValue(JPAEntityVariableType.java:84) ~[flowable-variable-service-6.4.1.jar!/:6.4.1]  
> | at org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntityImpl.getValue(VariableInstanceEntityImpl.java:132) ~[flowable-variable-service-6.4.1.jar!/:6.4.1

---

<div class="post-metadata">

**Author:** ![BehaveRabbit](https://avatars.discourse-cdn.com/v4/letter/b/e5b9ba/32.png) [@BehaveRabbit](https://forum.flowable.org/u/BehaveRabbit)\
**Post date:** [August 18, 2020, 8:51am UTC](https://forum.flowable.org/t/changing-route-to-jpa-entities-causing-flowableclassloadingexception-class-not-found/6531/2 "2020-08-18T08:51:10Z")

</div>

Can anybody provide help/advice?

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [August 20, 2020, 8:33pm UTC](https://forum.flowable.org/t/changing-route-to-jpa-entities-causing-flowableclassloadingexception-class-not-found/6531/3 "2020-08-20T20:33:59Z")

</div>

> [@BehaveRabbit](#):
>
> Delegates and services work fine with their new classpath as long as those entities are using their old classpaths.

That’s correct: the reason is because the delegates use the id of the bean as reference.  
For JPA entities, this doesn’t work like that because the class name is stored in the actual variable: [flowable-engine/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/types/JPAEntityVariableType.java at main · flowable/flowable-engine · GitHub](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/types/JPAEntityVariableType.java#L71)  
This means that for JPA variables, these classes cannot be changed (unless you’d update the variable in the database).
