Skip to content

fix(DataInjectionCommandLineRunner): do not fail on existing own partner#1062

Merged
tom-rm-meyer-ISST merged 2 commits intomainfrom
fix/command-line-runner
Dec 4, 2025
Merged

fix(DataInjectionCommandLineRunner): do not fail on existing own partner#1062
tom-rm-meyer-ISST merged 2 commits intomainfrom
fix/command-line-runner

Conversation

@tom-rm-meyer-ISST
Copy link
Copy Markdown
Contributor

Description

When restarting the pod an error occurs due to failed existence check:

2025-12-03T16:13:59.573Z  INFO 1 --- [nio-8081-exec-1] o.a.c.c.C.[.[localhost].[/catena]        : Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-12-03T16:13:59.573Z  INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2025-12-03T16:13:59.576Z  INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 2 ms
2025-12-03T16:14:03.577Z ERROR 1 --- [           main] o.e.t.p.b.m.l.s.PartnerServiceImpl       : Could not create Partner BPNL000000000ZH5 because BPNL already exists
2025-12-03T16:14:03.580Z  INFO 1 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger :



Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-12-03T16:14:03.777Z ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed



javax.management.openmbean.KeyAlreadyExistsException: Partner with given BPNL already exists.
  at org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerServiceImpl.create(PartnerServiceImpl.java:83) ~[!/:5.0.0]
  at org.eclipse.tractusx.puris.backend.DataInjectionCommandLineRunner.createOwnPartnerEntity(DataInjectionCommandLineRunner.java:135) ~[!/:5.0.0]
  at org.eclipse.tractusx.puris.backend.DataInjectionCommandLineRunner.run(DataInjectionCommandLineRunner.java:97) ~[!/:5.0.0]
  at org.springframework.boot.SpringApplication.lambda$callRunner$5(SpringApplication.java:788) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82) ~[spring-core-6.2.12.jar!/:6.2.12]
  at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.2.12.jar!/:6.2.12]
  at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:86) ~[spring-core-6.2.12.jar!/:6.2.12]
  at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:796) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:772) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) ~[na:na]
  at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(Unknown Source) ~[na:na]
  at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:na]
  at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:na]
  at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) ~[na:na]
  at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) ~[na:na]
  at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:na]
  at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source) ~[na:na]
  at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:772) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.5.7.jar!/:3.5.7]
  at org.eclipse.tractusx.puris.backend.PurisApplication.main(PurisApplication.java:39) ~[!/:5.0.0]
  at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[na:na]
  at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
  at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:106) ~[puris-backend.jar:5.0.0]
  at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:64) ~[puris-backend.jar:5.0.0]
  at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:40) ~[puris-backend.jar:5.0.0]



2025-12-03T16:14:03.970Z  INFO 1 --- [           main] o.s.b.w.e.tomcat.GracefulShutdown        : Commencing graceful shutdown. Waiting for active requests to complete
2025-12-03T16:14:03.973Z  INFO 1 --- [tomcat-shutdown] o.s.b.w.e.tomcat.GracefulShutdown        : Graceful shutdown complete
2025-12-03T16:14:03.975Z  INFO 1 --- [           main] o.s.m.s.b.SimpleBrokerMessageHandler     : Stopping...
2025-12-03T16:14:03.976Z  INFO 1 --- [           main] o.s.m.s.b.SimpleBrokerMessageHandler     : BrokerAvailabilityEvent[available=false, SimpleBrokerMessageHandler [org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry@7308ed03]]
2025-12-03T16:14:03.976Z  INFO 1 --- [           main] o.s.m.s.b.SimpleBrokerMessageHandler     : Stopped.
2025-12-03T16:14:04.173Z  INFO 1 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2025-12-03T16:14:04.272Z  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2025-12-03T16:14:04.277Z  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
 

Pre-review checks

Please ensure to do as many of the following checks as possible, before asking for committer review:

  • DEPENDENCIES are up-to-date. Dash license tool. Committers can open IP issues for restricted libs.
  • Copyright and license header are present on all affected files
  • If helm chart has been changed, the chart version has been bumped to either next major, minor or patch level (compared to released chart).

@tom-rm-meyer-ISST
Copy link
Copy Markdown
Contributor Author

Cross-checked after some sleeping!

I've run the local deployment and then restarted the pod.

cd local
./deploy.sh -ci

# .... starts

docker compose restart puris-backend-customer
docker compose logs puris-backend-customer -f

# ... some logs
customer-backend  | 2025-12-04T06:19:41.333Z  INFO 1 --- [           main] o.e.t.p.b.c.e.l.s.EdcAdapterService      : Registration of PartTypeInformation 1.0.0 submodel successful true
customer-backend  | 2025-12-04T06:19:41.639Z  INFO 1 --- [           main] o.e.t.p.b.DataInjectionCommandLineRunner : Following partner has been configured for yourself (and not been changed): Partner(uuid=36bc135b-c7a3-4fa9-a607-b6c90de855fc, name=Control Unit Creator Inc., edcUrl=http://customer-control-plane:8184/api/v1/dsp, bpnl=BPNL4444444444XX, addresses=[], sites=[Site(bpns=BPNS4444444444XX, name=Control Unit Creator Production Site, addresses=[Address(bpna=BPNA4444444444AA, streetAndNumber=13th Street 47, zipCodeAndCity=10011 New York, country=USA)])])
customer-backend  | 2025-12-04T06:19:41.640Z  INFO 1 --- [           main] o.e.t.p.b.DataInjectionCommandLineRunner : Creating setup for 
customer-backend  | 2025-12-04T06:19:41.640Z  INFO 1 --- [           main] o.e.t.p.b.DataInjectionCommandLineRunner : No role specific setup was created
customer-backend  | 2025-12-04T06:19:45.051Z  INFO 1 --- [nio-8081-exec-1] o.a.c.c.C.[.[localhost].[/catena]        : Initializing Spring DispatcherServlet 'dispatcherServlet'
customer-backend  | 2025-12-04T06:19:45.052Z  INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
customer-backend  | 2025-12-04T06:19:45.054Z  INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 2 ms
customer-backend  | 2025-12-04T06:20:40.934Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 0 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 0]

…njectionCommandLineRunnerTest.java

Co-authored-by: Malte Hellmeier <malte.hellmeier@isst.fraunhofer.de>
Copy link
Copy Markdown
Member

@ReneSchroederLJ ReneSchroederLJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes and especially also adding the test.

The change works for the own partner entity. However, when running this locally and restarting the customer container it fails on supplier creation, because the existing supplier partner from the previous run causes a conflict, which is not caught.

From your posted example I assume it worked, because you ran the command with -ci, which skips the data injection for supplier.

@tom-rm-meyer-ISST
Copy link
Copy Markdown
Contributor Author

Thank you for the changes and especially also adding the test.

The change works for the own partner entity. However, when running this locally and restarting the customer container it fails on supplier creation, because the existing supplier partner from the previous run causes a conflict, which is not caught.

From your posted example I assume it worked, because you ran the command with -ci, which skips the data injection for supplier.

fair point, please raise an issue. Need the change for today at the community days and will thus only need the built main image. Won't releaes yet

Copy link
Copy Markdown
Member

@ReneSchroederLJ ReneSchroederLJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved due to the main use case working.

I've created #1063 to take care of the remaining bug.

@tom-rm-meyer-ISST tom-rm-meyer-ISST merged commit ff47f26 into main Dec 4, 2025
15 of 16 checks passed
@tom-rm-meyer-ISST tom-rm-meyer-ISST deleted the fix/command-line-runner branch December 4, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants