Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21244

Un-escaped $ in module file name passed in command line to weblogic.jar results in the input file not found deployer

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Linux

      My build utput produced by "mvn install" looks a bit like this:

      /home/ca31319/archdata/jenkins/jobs/Epdservices/modules/org.delta$org.delta.epd.services/builds/2014-01-06_14-08-56/archive/org.delta/org.delta.epd.services/1.0-SNAPSHOT/org.delta.epd.services-1.0-SNAPSHOT.war

      Notice the "$" in the module result.

      This file name is passed on the command line to weblogic.jar without the "$" being escaped - hence the file is not found.

      /usr/java/jdk1.7.0_45/jre/bin/java -Xms256M -Xmx256M -cp /opt/oracle/wls12120/wlserver/server/lib/weblogic.jar weblogic.Deployer -debug -stage -remote -verbose -upload -name "EPD Services" -source /home/ca31319/archdata/jenkins/jobs/Epdservices/modules/org.delta$org.delta.epd.services/builds/2014-01-06_14-08-56/archive/org.delta/org.delta.epd.services/1.0-SNAPSHOT/org.delta.epd.services-1.0-SNAPSHOT.war -targets myserver -adminurl t3://myhost:7001 -user weblogic -password mypassword -deploy

      If I cut and paste this into a terminal and escape the $ - it works fine.

      Please could you provide a fix?

          [JENKINS-21244] Un-escaped $ in module file name passed in command line to weblogic.jar results in the input file not found deployer

          Jaap Coomans added a comment -

          A "fix" for this issue broke the functionality of the plugin for me.

          In src/main/java/org/jenkinsci/plugins/deploy/weblogic/deployer/WebLogicDeployer.java the following line is added:

          args.add("\""+ parameter.getSource()+"\"");
          

          The result is that the source parameter is passed with two pairs of quotes (""/path/to/file""), of which the inner pair remains in the String that is being processed by the WebLogic deployer.
          This finally results in a FileNotFoundException:

          java.io.FileNotFoundException: /"/var/opt/jenkins/workspace/sample-project/target/sample-project-0.1.0-SNAPSHOT.war" (No such file or directory)
          	at java.io.FileInputStream.open(Native Method)
          	at java.io.FileInputStream.(FileInputStream.java:131)
          	at weblogic.utils.FileUtils.copy(FileUtils.java:266)
          	at weblogic.utils.FileUtils.copy(FileUtils.java:245)
          	at weblogic.utils.FileUtils.copy(FileUtils.java:186)
          	at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.upload(ServerConnectionImpl.java:849)
          	at weblogic.deploy.api.spi.deploy.internal.BasicOperation.uploadFiles(BasicOperation.java:332)
          	at weblogic.deploy.api.spi.deploy.internal.BasicOperation.execute(BasicOperation.java:465)
          	at weblogic.deploy.api.spi.deploy.internal.BasicOperation.run(BasicOperation.java:178)
          	at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.deploy(WebLogicDeploymentManagerImpl.java:390)
          	at weblogic.deploy.api.tools.deployer.DeployOperation.execute(DeployOperation.java:51)
          	at weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:139)
          	at weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88)
          	at weblogic.utils.compiler.Tool.run(Tool.java:158)
          	at weblogic.utils.compiler.Tool.run(Tool.java:115)
          	at weblogic.Deployer.run(Deployer.java:74)
          	at weblogic.Deployer.main(Deployer.java:55)
          

          Jaap Coomans added a comment - A "fix" for this issue broke the functionality of the plugin for me. In src/main/java/org/jenkinsci/plugins/deploy/weblogic/deployer/WebLogicDeployer.java the following line is added: args.add( "\" "+ parameter.getSource()+" \""); The result is that the source parameter is passed with two pairs of quotes ( ""/path/to/file"" ), of which the inner pair remains in the String that is being processed by the WebLogic deployer. This finally results in a FileNotFoundException: java.io.FileNotFoundException: /"/var/opt/jenkins/workspace/sample-project/target/sample-project-0.1.0-SNAPSHOT.war" (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:131) at weblogic.utils.FileUtils.copy(FileUtils.java:266) at weblogic.utils.FileUtils.copy(FileUtils.java:245) at weblogic.utils.FileUtils.copy(FileUtils.java:186) at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.upload(ServerConnectionImpl.java:849) at weblogic.deploy.api.spi.deploy.internal.BasicOperation.uploadFiles(BasicOperation.java:332) at weblogic.deploy.api.spi.deploy.internal.BasicOperation.execute(BasicOperation.java:465) at weblogic.deploy.api.spi.deploy.internal.BasicOperation.run(BasicOperation.java:178) at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.deploy(WebLogicDeploymentManagerImpl.java:390) at weblogic.deploy.api.tools.deployer.DeployOperation.execute(DeployOperation.java:51) at weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:139) at weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88) at weblogic.utils.compiler.Tool.run(Tool.java:158) at weblogic.utils.compiler.Tool.run(Tool.java:115) at weblogic.Deployer.run(Deployer.java:74) at weblogic.Deployer.main(Deployer.java:55)

          A performed a rollback on the unexpected commit. The fixed version is 2.11
          Sorry

          Raphael CHAUMIER added a comment - A performed a rollback on the unexpected commit. The fixed version is 2.11 Sorry

          Jaap Coomans added a comment -

          Thank you for the very quick response and resolution!

          Jaap Coomans added a comment - Thank you for the very quick response and resolution!

          Hi

          This issue will be fixed in 3.1 version.

          Concerns default command line and set command line in advanced task properties.

          Idea

          Escaping the $ or quoting the string should fix it, same as the other issue.

          Raphael CHAUMIER added a comment - Hi This issue will be fixed in 3.1 version. Concerns default command line and set command line in advanced task properties. Idea Escaping the $ or quoting the string should fix it, same as the other issue.

          trevorw added a comment -

          Excellent, thank you! Will try it as soon it's out.

          trevorw added a comment - Excellent, thank you! Will try it as soon it's out.

          Here is a workaround :

          Use advanced configuration feature then add the token

          {wl.source} with quotes like this :

          -adminurl http://{wl.host}:{wl.port} -user {wl.login} -password {wl.password} -debug -remote -verbose -name {wl.deployment_name} -source "{wl.source}

          " -targets

          {wl.targets}

          -cancel;

          Raphael CHAUMIER added a comment - Here is a workaround : Use advanced configuration feature then add the token {wl.source} with quotes like this : -adminurl http://{wl.host}:{wl.port} -user {wl.login} -password {wl.password} -debug -remote -verbose -name {wl.deployment_name} -source "{wl.source} " -targets {wl.targets} -cancel;

          3.1 released on 03/31/2015

          Raphael CHAUMIER added a comment - 3.1 released on 03/31/2015

          trevorw added a comment -

          Hello. Bad news, just tried 3.1 and it broke all the deploys. There is a leading / before the " string breaking things now.

          java.io.FileNotFoundException: /"/opt/jenkins/workspace/app-name-deploy/app-name-application/target/app-name-application-1.0.0-SNAPSHOT.war" (No such file or directory)

          trevorw added a comment - Hello. Bad news, just tried 3.1 and it broke all the deploys. There is a leading / before the " string breaking things now. java.io.FileNotFoundException: /"/opt/jenkins/workspace/app-name-deploy/app-name-application/target/app-name-application-1.0.0-SNAPSHOT.war" (No such file or directory)

          Hi,

          Thank you for your feedback. If you use the advanced configuration with "

          {wl.source}

          " does the '/' prepend ?

          Pehraps with single quotes?

          Raphael CHAUMIER added a comment - Hi, Thank you for your feedback. If you use the advanced configuration with " {wl.source} " does the '/' prepend ? Pehraps with single quotes?

          trevorw added a comment -

          Using the advanced configuration you posted above, the quoted string is good and does not prepend the '/'.

          Here it is using the advanced config:
          -source "/opt/jenkins/jobs/app-name-build-deploy/modules/com.apps.app-name$app-name-web/builds/51/archive/com.apps.app-name/app-name-web/1.0.0-20150401.222231-10/app-name-web-1.0.0-20150401.222231-10.war"

          trevorw added a comment - Using the advanced configuration you posted above, the quoted string is good and does not prepend the '/'. Here it is using the advanced config: -source "/opt/jenkins/jobs/app-name-build-deploy/modules/com.apps.app-name$app-name-web/builds/51/archive/com.apps.app-name/app-name-web/1.0.0-20150401.222231-10/app-name-web-1.0.0-20150401.222231-10.war"

          Thanks,

          So the problem only occurs if you don't use advanced configuration.

          Raphael CHAUMIER added a comment - Thanks, So the problem only occurs if you don't use advanced configuration.

          Using single quotes instead of using double one.

          Hope it will work

          Raphael CHAUMIER added a comment - Using single quotes instead of using double one. Hope it will work

          Tested. 

          Raphael CHAUMIER added a comment - Tested. 

          After updating to v. 3.7 deployments fail because a slash is prepended to the file path:

          java.io.FileNotFoundException: /'/opt/jenkins/jobs/AF_HerramientasEstandares/jobs/Comprobar_Actualizaciones/jobs/JWL2-Gesid_Deploy/workspace/gesid-3.2.1-desarrollo.war' (No existe el fichero o el directorio)

           

          Manuel J. Garrido added a comment - After updating to v. 3.7 deployments fail because a slash is prepended to the file path: java.io.FileNotFoundException: /'/opt/jenkins/jobs/AF_HerramientasEstandares/jobs/Comprobar_Actualizaciones/jobs/JWL2-Gesid_Deploy/workspace/gesid-3.2.1-desarrollo.war' (No existe el fichero o el directorio)  

          Hi mgarrido

           

          This is a regression. You can downgrade to 3.6 or wait the 4.0 which will be released today.

           

          Regards

          Raphael CHAUMIER added a comment - Hi mgarrido   This is a regression. You can downgrade to 3.6 or wait the 4.0 which will be released today.   Regards

          double/single-quoted source seems only work with windows architecture. Need to investigate about another solution for others OS.

          Raphael CHAUMIER added a comment - double/single-quoted source seems only work with windows architecture. Need to investigate about another solution for others OS.

            mgarrido Manuel J. Garrido
            adrianblakey Adrian Blakey
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: