Expand WAR or EAR files in jBoss AS 7

deploymentearjbossjboss7.xwar

I'm deploying a WebService project into a jBoss AS7, and everything goes OK except that jBoss doesn't expand my WAR or EAR file.

Already tried copying the file to the "jboss-as-7.1.0.Final\standalone\deployments" folder and using the WebConsole, but in both cases the result was the same.

If I deploy from within Eclipse everything runs OK.

I need it to expand my file because in the application initialization I scan the class
directories looking for the correct class to instantiate using reflection.

EDIT : Don't know if this a particular situation with jBoss AS 7 or with the jBoss AS family, because I already used WebSphere and jBoss Web and both of them expanded the files.

EDIT2 : Added a System.out with the execution path

MyClass.class.getProtectionDomain().getCodeSource().getLocation().getPath();

and it returns the following path

C:\jboss-as-7.1.0.Final\bin\content\ServerEAR.ear\Server.war\WEB-INF\classes

witch doesn't exist. So I did a search for the class name and fount it at

C:\jboss-as-7.1.0.Final\standalone\tmp\vfs\deployment5a9e98d5c43716c3\Server.war-e31a657d2bc3bd0f\WEB-INF\classes\r30

Isn't it possible to force JBoss to extract the files to the deployment folder? Or how can I get the previous path at run time.

Best Answer

Had forgotten about this question, so this is the way that I solved it:

public String getRealFilePath(String aFilePath) throws Exception
{
    org.jboss.vfs.VirtualFile vFile = org.jboss.vfs.VFS.getChild(aFilePath);
    URI fileNameDecodedTmp = org.jboss.vfs.VFSUtils.getPhysicalURI(vFile);

    path = fileNameDecodedTmp.getPath();
    System.out.println(path);
    return path;
}

So at runtime I just need to call getRealFilePath() with the original question values, and problem solved ;)

Related Topic