Deploy WAR or EAR files in jBoss AS 7

I am deploying a WebService project to j8oss AS7 and everything goes OK except jBoss is not expanding my WAR or EAR file.

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

If I deploy from Eclipse everything works fine.

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

EDIT: Not sure if this was a specific situation with jBoss AS 7 or with the jBoss AS family, because I already used WebSphere and jBoss Web and they both extended the files.

EDIT2: Added System.out with 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

      

the witch does not exist. So I did a lookup for the class name and set it to

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

      

Can't get JBoss to extract files to deployment folder? Or how can I get the previous path at runtime.

+3


source to share


3 answers


Forgot about this question, so I solved this:

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 values ​​of the question and solve the problem;)

+5


source


I believe you cannot get Jboss7 to automatically expand the file war

on deployment.

However, you can copy the already advanced war

one and you shouldn't have any problems.



Actually, if you look closely at the Eclipse deployment, you will notice that it copies the entire directory to the deployment directory, not the file itself war

.

By the way, why do you need to deploy a blown up system? If you need to access and read some files as resources, you can look at the classpath resources

+2


source


Check your class settings. I recently ran into the same problem and solved it by adding system environment variables:

CLASSPATH=.;
C:\Program Files\Java\jdk1.6.0_10\lib;
C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;
C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar; `

      

+2


source







All Articles