What is the association between War file with exploded war file in /tmp folder

362 views
Skip to first unread message

Esther Neoh

unread,
Jul 12, 2022, 10:35:05 AM7/12/22
to WildFly
Where can I find the the association/logic between the war file and the exploded war file
i.e. This is the exploded war file directory from the war file here {EAP_HOME}/standalone/data/content/xx/yyy/content

E.g.
WAR file location
{EAP_HOME}/standalone/data/content/xx/yyy/content where content is the renamed war file
xx - first 2 characters of war file deployed, sha 1, derivable from standalone.xml
yyy - rest of sha1 excluding first 2 characters.
standalone.xml location - {EAP_HOME}/standalone/configuration/

Exploded war file location
{EAP_HOME}/standalone/tmp/vfs/temp/tempgg/content-zzz/

How do I know content-zzz is refering to which WAR file deployed. I need to make the link between the war file deployed and where the exploded war file contents is for each individual war / ear file.

Warm Regards

James Perkins

unread,
Jul 12, 2022, 10:41:41 AM7/12/22
to WildFly
What version of JBoss EAP are you using and what is it you need the files for? It's definitely not suggested to modify those files as they will likely be lost on a reload or restart.

Esther Neoh

unread,
Jul 12, 2022, 11:08:15 AM7/12/22
to James Perkins, WildFly
I am using EAP-7.3.0. I am trying to associate the war with the exploded war directory (under tmp) so that I can detect the dependent jar files in the war / ear file. 
It is for scanning purposes, understand that they will be lost on reload or restart. I am trying to make use of the /tmp  directory instead of exploding the war or ear files on my own to determine the dependencies, if able to find association I won't need to manually explode. Want to scan perhaps once a week to detect any changes in the dependent jar files. 

--
You received this message because you are subscribed to a topic in the Google Groups "WildFly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wildfly/z5mAfB1RmmA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/91a7599b-1569-44ee-89de-ff5b2075469cn%40googlegroups.com.

Emmanuel Hugonnet

unread,
Jul 12, 2022, 11:14:39 AM7/12/22
to wil...@googlegroups.com
You also could explode (using the cli explode operation) your deployment and it would be available under standalone/data/content/${hash}/mywar

Emmanuel
> <https://groups.google.com/d/msgid/wildfly/91a7599b-1569-44ee-89de-ff5b2075469cn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups "WildFly" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wildfly/CACkkBh7J%3DRWy4K%2B6b95SLx141NtmcBmEniBxOzjUfpEq%3Dt-Z4A%40mail.gmail.com
> <https://groups.google.com/d/msgid/wildfly/CACkkBh7J%3DRWy4K%2B6b95SLx141NtmcBmEniBxOzjUfpEq%3Dt-Z4A%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Esther Neoh

unread,
Jul 12, 2022, 11:48:38 AM7/12/22
to Emmanuel Hugonnet, wil...@googlegroups.com
Yes, I understand that one approach is to explode my deployment in 
standalone/data/content/xx/yyy/war
where xx refers to first 2 characters of sha1 hash, based of composite data, byte array, 
yyy refers to remaining characters. 

I am trying to explore if there is a way where I do not need to explode the war and just make use of the already exploded war. I may have many war and ears in my app server, and to scan for each of the dependencies, it would be better if I could just make use of the /tmp folder instead of exploding all these every time I want to scan. 

In the tmp folder the exploded wars / ears will each be in a folder "content-" + some string of characters. 
Are the characters added to the directory name random or there is a pattern stored somewhere that will associate them to the original WAR/EAR. 

I was searching in the wildfly core github repo https://github.com/wildfly/wildfly-core. I went through sever, deployment-repository but wasn't able to find what I was looking for. 

I was only able to find that deployment3423534 and temp34543645 which care created under standalone/tmp/vfs are random


private static final Random rng = new Random();
static String createTempName(String prefix, String suffix) { return prefix + Long.toHexString(rng.nextLong()) + suffix;}

I'm trying to find what creates the "content-123", "content-xws" directories and whether it can be matched with original war or ear. 

Happy to dig into source code  if I could have some direction. 


James Perkins

unread,
Jul 12, 2022, 12:24:33 PM7/12/22
to WildFly
If you're okay with using public WIldFly/JBoss EAP API's you could use operations to determine this. Something like the following:

public static void processDeployments() {
        try (ModelControllerClient client = ModelControllerClient.Factory.create("localhost", 9990)) {
            // Get the deployments
            ModelNode op = Operations.createOperation(ClientConstants.READ_CHILDREN_NAMES_OPERATION);
            op.get(ClientConstants.CHILD_TYPE).set("deployment");
            final List<ModelNode> deployments = executeOp(client, op).asList();
            for (ModelNode deployment : deployments) {
                final String deploymentName = deployment.asString();
                System.out.printf("Deployment %s%n", deploymentName);
                final int depth = deploymentName.endsWith(".war") ? 2 : -1;
                for (ModelNode dep : listDependencies(client, deploymentName, depth)) {
                    System.out.printf("\tDependency: %s%n", dep.get("path").asString());
                }

            }
        }
    }

    private static List<ModelNode> listDependencies(final ModelControllerClient client, final String deploymentName, final int depth) throws IOException {
        final ModelNode address = Operations.createAddress("deployment", deploymentName);
        final ModelNode op = Operations.createOperation("browse-content", address);
        if (depth > 0) {
            op.get("depth").set(depth);
        }
        // Only return files not directories
        return executeOp(client, op)
                .asList()
                .stream()
                .filter((model) -> !model.get("directory").asBoolean())
                .collect(Collectors.toList());
    }

    private static ModelNode executeOp(final ModelControllerClient client, final ModelNode op) throws IOException {
        final ModelNode result = client.execute(op);
        if (Operations.isSuccessfulOutcome(result)) {
            return Operations.readResult(result);
        }
        throw new RuntimeException(String.format("Failed op \"%s\": %s", op.asString(), Operations.getFailureDescription(result).asString()));
    }


Reply all
Reply to author
Forward
0 new messages