<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Axon ivy Docker Java referenced class not found exception</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception</link><description>&lt;p&gt;Hi Ivy team,&lt;/p&gt;
&lt;p&gt;I use axon ivy version 7.3.1(Designer and Engine), maven 3.6.2
I've create a dialog form with "add new" button, when user click that button, it will call a method in Java class.&lt;/p&gt;
&lt;p&gt;after run and build with maven, I have a &lt;strong&gt;"xxx-app-1.0.0-SNAPSHOT.iar"&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;I copy this file to deploy folder of &lt;strong&gt;"AxonIvyEngine7.3.1.1904101154_All_x64"&lt;/strong&gt;
and run Engine and then run web app . everything is ok when I click "add new" button&lt;/p&gt;
&lt;p&gt;But when I copy that file :&lt;strong&gt;"xxx-app-1.0.0-SNAPSHOT.iar"&lt;/strong&gt; in docker file :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   FROM axonivy/axonivy-engine:7.3.1
   LABEL maintainer="xxxx@abc.com"
   COPY --chown=ivy:ivy target/xxx-app-1.0.0-SNAPSHOT.iar deploy/    ( this command will copy xxx-app-1.0.0-SNAPSHOT.iar to deploy folder on container )
   EXPOSE 8080
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then I create a docker-compose file &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;version: '3.3'
 services:
  axonivy-engine:
    image: my-app-test    
    build: .
    ports:
     - 8082:8080
    restart: always
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Run docker-compose up&lt;/li&gt;
&lt;li&gt;Run web app and then click "add new" button. I've get a errors:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Errorrs:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Caused by: ch.ivyteam.ivy.scripting.exceptions.classDef.ReferencedClassNotFoundException: Referenced class 'com/axonivy/persistence/beans/GenericEntity' not found for class 'controller.AddNew'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I don't why with same a file &lt;strong&gt;IAR&lt;/strong&gt; but when I run it on local it run well and doesn't through any errors
.But after run from &lt;strong&gt;docker container&lt;/strong&gt; the UI still appear ok, but when user click button, it call method in java class then through errors&lt;/p&gt;
&lt;p&gt;I've check in zip file on  &lt;strong&gt;"work"&lt;/strong&gt;  folder in Engine in docker container it still exist all file java class&lt;/p&gt;
&lt;p&gt;can you guy help me please &lt;/p&gt;
&lt;p&gt;my iar file:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://answers.axonivy.com/upfiles/my-app-1.0.0-SNAPSHOT.png"&gt;link text&lt;/a&gt;&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 28 Nov 2019 03:09:56 -0500</lastBuildDate><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4221</link><description>&lt;p&gt;@tuanvv
why do you pretend that the issue is fixed by migrating to 7.4 and afterwards create a new answer to the same problem? Now we have 3 questions for one library maven issues. And you mix docker and version migration problem into it : but it starts as and stays a simple maven library missunderstanding.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 28 Nov 2019 03:09:56 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4221</guid></item><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4218</link><description>&lt;p&gt;dependent pom files must be include on the IAR file and added to it's classpath. It's good practice to resolve them from MAVEN (pom.xml dep declaration), copy them with maven-dependency-plugin into the project (but do not put them to SCM), add them to classpath manually. see the link posted: &lt;a href="https://answers.axonivy.com/questions/2089/add-library-with-pom-xml"&gt;https://answers.axonivy.com/questions/2089/add-library-with-pom-xml&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 28 Nov 2019 02:45:53 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4218</guid></item><item><title>Comment by tuannv on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4216</link><description>&lt;p&gt;Hi Ivy team,
today, I decided upgrade axon ivy to 7.4 and every thing is ok on this version &lt;/p&gt;
&lt;p&gt;thank you guys for support&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tuannv</dc:creator><pubDate>Wed, 27 Nov 2019 22:10:29 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4216</guid></item><item><title>Comment by tuannv on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4215</link><description>&lt;p&gt;Hi Reguel Werme.
thank you a lot for your answer. 
about how do I  added persistent before --&amp;gt; I added dependency on Pom file and then use maven clean install to get dependency&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tuannv</dc:creator><pubDate>Wed, 27 Nov 2019 20:44:19 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4215</guid></item><item><title>Comment by Alex Suter on tuannv's question</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4214</link><description>&lt;p&gt;I just want to outline, that this issue has absolutly nothing todo with docker. It just shows that your iar will not run on a brand new engine. Please fix your dependency mgmt. as prposed by Reguel.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Wed, 27 Nov 2019 12:06:43 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4214</guid></item><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4213</link><description>&lt;p&gt;Well the docker deployment must be self contained. I don't know how you added it - but the logs show that the engine class loader can't find your artifacts that you have "added before".&lt;/p&gt;
&lt;p&gt;However, I do not see any advantage in somehow copying necessary artifacts in an non standard way. Just include in in the IAR as you should always do it. This is best practice , not only for docker engines. It leads to deterministic deployment scenarios.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 27 Nov 2019 05:23:52 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4213</guid></item><item><title>Comment by tuannv on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4212</link><description>&lt;p&gt;I added before deployed, the problem only happen after I run web app through docker container&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tuannv</dc:creator><pubDate>Wed, 27 Nov 2019 05:07:18 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4212</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception/4211</link><description>&lt;p&gt;You're IAR defines additional deps:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;dependencies&amp;gt; 
&amp;lt;dependency&amp;gt; 
&amp;lt;groupid&amp;gt;com.axonivy&amp;lt;/groupid&amp;gt; 
&amp;lt;artifactid&amp;gt;persistence&amp;lt;/artifactid&amp;gt; 
&amp;lt;version&amp;gt;0.0.1&amp;lt;/version&amp;gt; 
&amp;lt;/dependency&amp;gt;
&amp;lt;/dependencies&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You must add JAR dependencies from maven with your IAR: otherwise they will not be accessible to the engine&lt;/p&gt;
&lt;p&gt;&lt;a href="https://answers.axonivy.com/questions/2089/add-library-with-pom-xml"&gt;https://answers.axonivy.com/questions/2089/add-library-with-pom-xml&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 27 Nov 2019 04:23:54 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception/4211</guid></item><item><title>Comment by tuannv on tuannv's question</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4209</link><description>&lt;p&gt;Hi Alex Suter ,
I've added my IAR file to you, but the tool don't support upload file iar, so I change the file from iar to "png" file. please get it and change the file extension to iar file again to get the source code.
thank you a lot for support&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tuannv</dc:creator><pubDate>Wed, 27 Nov 2019 04:05:02 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4209</guid></item><item><title>Comment by tuannv on tuannv's question</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4208</link><description>&lt;p&gt;Hi Reguel Werme,&lt;/p&gt;
&lt;p&gt;I  don't mentioned GenericEntity class, I think the error relative to GenericEntity class because the genericEntity can't find a "AddNew" java class&lt;/p&gt;
&lt;p&gt;so the cause is axon ivy engine can't find java class in docker container. 
that's my question&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tuannv</dc:creator><pubDate>Wed, 27 Nov 2019 03:57:00 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4208</guid></item><item><title>Comment by Reguel Wermelinger on tuannv's question</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4207</link><description>&lt;p&gt;Is the mentioned class &lt;code&gt;com/axonivy/persistence/beans/GenericEntity&lt;/code&gt; part ot the IAR you are deploying? or is it in a dependency project?
Can you see the binary file packed in the IAR?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 27 Nov 2019 03:28:45 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4207</guid></item><item><title>Comment by Alex Suter on tuannv's question</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4206</link><description>&lt;p&gt;please send your iar to the support.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Wed, 27 Nov 2019 03:26:05 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4206</guid></item><item><title>Comment by tuannv on tuannv's question</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4205</link><description>&lt;p&gt;yes, I've tested with only copy IAR project , but it same result of errors&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tuannv</dc:creator><pubDate>Wed, 27 Nov 2019 03:00:43 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4205</guid></item><item><title>Comment by Alex Suter on tuannv's question</title><link>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4204</link><description>&lt;p&gt;don't copy everything of your target/* directory in deploy folder. only copy the iar project.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Wed, 27 Nov 2019 02:58:37 -0500</pubDate><guid>https://answers.axonivy.com/questions/4203/axon-ivy-docker-java-referenced-class-not-found-exception#4204</guid></item></channel></rss>