4 Replies Latest reply on Jun 5, 2014 11:17 PM by hai_feng

    Wrong file path (*/jboss-as-web-7.0.1.Final/bin/content/...)

    gistarbird

      Hi,

       

           My war application is avaliable on jboss5 and jboss6, but error on jboss7. I found the problem is as below:

       

           The code to get my jar file path is unavaliable on jboss as7, eg:

       

           excute  "MyClass.class.getProtectionDomain().getCodeSource().getLocation().toString();"

       

           get "vfs:/D:/jboss-as-web-7.0.1.Final/bin/content/mywar.war/WEB-INF/lib/myjar.jar".

       

           but my war and jar are not under the path /jboss-as-web-7.0.1.Final/bin/content/

       

           how can i get the correct path?

       

       

           Any suggestions appreciated.

       

           Regards

       

           Gistarbird

        • 1. Re: Wrong file path (*/jboss-as-web-7.0.1.Final/bin/content/...)
          gistarbird

          I copy mywar.war to JBOSS_HOME/standalone/deployments

           

          I used all kinds of methods to get the path of my own file, but all are failed!

           

          It always refer to JBOSS_HOME/bin/content/mywar.war/WEB-INF/lib/myjar.jar.

           

           

          • 2. Re: Wrong file path (*/jboss-as-web-7.0.1.Final/bin/content/...)
            tichon007

            Hello,

             

            I got the same problem.

             

            When i try to deploy my ear i got for each jar contain into EAR_ROOT/lib the message :

             

            14:55:49,960 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry hibernate-validator-4.2.0.Final.jar in "/C:/Program Files (x86)/JBoss/jboss-as-7.1.1.Final/bin/content/ner-ear-4.0.5-SNAPSHOT.ear"  does not point to a valid jar for a Class-Path reference.

            But there is nothing into content my ear is into the deployment folder.

            Other issue is when i search a jar path using :   URL url = LibraryLog.class.getResource(""); the url is wrong because refer to a jar contain into the bin/content folder wich do not exist.

             

            Any help will be apreciate.

             

            Thanks

            • 3. Re: Wrong file path (*/jboss-as-web-7.0.1.Final/bin/content/...)
              martsecurit

              Hello.

              I have exactly the same issue with AS 7.1.1 final. Did you find a solution?

               

              I have a file here: EAR/WAR/WEB_INF/classes/myfile.xml

              And reference it llike this:

               

              getClass().getClassLoader().getResource("/help_layout.xml")

               

              JBOSS then says it cannot find a file here:

              vfs:/C:/jboss-7.1.1/bin/content/ear/war/WEB-INF/classes/myfile.xml

               

              There is no bin/content directory.

               

              Thanks for reading.

              • 4. Re: Wrong file path (*/jboss-as-web-7.0.1.Final/bin/content/...)
                hai_feng

                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 path, and problem solved