Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not being able to add more than one ZIP file with JARs to Jet instance's classpath [HZ-4712] #26320

Closed
AleksPeychev opened this issue Apr 29, 2024 · 1 comment

Comments

@AleksPeychev
Copy link
Contributor

AleksPeychev commented Apr 29, 2024

Describe the bug
In a test we need to add more than one ZIP file with client specific JARs, it is impossible after this change, which sets resource ID to null. Before this change last path segment ("filename") was used as resource ID.

Expected behavior
More than one ZIP files wtih JARs being added to Jet instance's classpath.

To Reproduce

Steps to reproduce the behavior:

  1. Add and Run the following test into com.hazelcast.jet.impl.deployment.AbstractDeploymentTest
    Or you can use the code directly from here.
   @Test
   public void addMoreJarsFromTwoZipFiles() throws Throwable {
       DAG dag = new DAG();
       dag.newVertex("load class", () -> new LoadClassesIsolated(true));

       JobConfig jobConfig = new JobConfig();
       jobConfig.addJarsInZip(this.getClass().getResource("/zip-resources/person-jar.zip"));
       jobConfig.addJarsInZip(this.getClass().getResource("/zip-resources/person-car-jar.zip"));

       executeAndPeel(getJet().newJob(dag, jobConfig));
   }

Actual behavior
java.lang.IllegalArgumentException: Resource with id:null already exists

Additional context

Stacktrace:
java.lang.IllegalArgumentException: Resource with id:null already exists

	at com.hazelcast.jet.config.JobConfig.add(JobConfig.java:1175)
	at com.hazelcast.jet.config.JobConfig.addJarsInZip(JobConfig.java:449)
	at com.hazelcast.jet.impl.deployment.AbstractDeploymentTest.addMoreJarsFromZipFiles(AbstractDeploymentTest.java:355)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.hazelcast.test.FailOnTimeoutStatement$CallableStatement.call(FailOnTimeoutStatement.java:115)
	at com.hazelcast.test.FailOnTimeoutStatement$CallableStatement.call(FailOnTimeoutStatement.java:107)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.lang.Thread.run(Thread.java:840)

@AleksPeychev AleksPeychev added this to the 5.4.z milestone Apr 29, 2024
@AleksPeychev AleksPeychev changed the title Not being able to add more than one ZIP file with JARs Not being able to add more than one ZIP file with JARs Jet instance's classpath Apr 29, 2024
@AleksPeychev AleksPeychev changed the title Not being able to add more than one ZIP file with JARs Jet instance's classpath Not being able to add more than one ZIP file with JARs to Jet instance's classpath Apr 29, 2024
@AleksPeychev AleksPeychev modified the milestones: 5.4.z, 5.5.0 Apr 29, 2024
@AleksPeychev AleksPeychev modified the milestones: 5.5.0, Backlog Apr 29, 2024
@github-actions github-actions bot changed the title Not being able to add more than one ZIP file with JARs to Jet instance's classpath Not being able to add more than one ZIP file with JARs to Jet instance's classpath [HZ-4712] Apr 29, 2024
Copy link
Contributor

Internal Jira issue: HZ-4712

@JackPGreen JackPGreen self-assigned this Apr 29, 2024
devOpsHazelcast pushed a commit that referenced this issue Apr 29, 2024
…1717)

In https://github.com/hazelcast/hazelcast-mono/pull/217, `JobConfig#add`
was changed to allow the `id` parameter to be `nullable`, and derived as
required.

When storing the resources, the now-`nullable` `ID` was being used
instead of the derived value.

This means that for `JobConfig`s adding resources from:
- JAR
- JARs in ZIP
- Classpath Resource by URL
- File by URL

They are not being properly stored in `JobConfig#resourceConfigs`.

Fixes: [HZ-4712](https://hazelcast.atlassian.net/browse/HZ-4712),
#26320

[HZ-4712]:
https://hazelcast.atlassian.net/browse/HZ-4712?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Aleksandar Peychev <154250829+AleksPeychev@users.noreply.github.com>
GitOrigin-RevId: efc0926334bc5f0470e1f2a739f9d3a3ef3a40a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants