Allow deploy command to accept URI (GLASSFISH-12699)

[GLASSFISH-19497] Can't get the proper path when deployed the application in the mode of relative path Created: 07/Jan/13  Updated: 20/Dec/16  Resolved: 14/Jan/13

Status: Closed
Project: glassfish
Component/s: admin, deployment
Affects Version/s: 4.0_dev
Fix Version/s: not determined

Type: Sub-task Priority: Major
Reporter: Jeremy_Lv Assignee: Hong Zhang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows



 Description   

[Bug Description]
I can't deploy the application in relative path because the jersey module doesn't get the proper path.
i.e: E:\glassfish3\glassfish\bin>asadmin deploy aa.jar
remote failure: File not found : E:\glassfish3\glassfish\domains\domain1\config\
aa.jar
Command deploy failed.
(The error occurs when I try to test the QL tests about the new feature as deploying in URI mode)

[Reason]
I have debug the source and found the paramater value about "DEFAULT" is aa.jar when I type as "asadmin deploy aa.jar". I know the paramater value about "DEFAULT" here should be "E:\glassfish3\glassfish\bin\aa.jar"but it doesn't get the proper value.

I wonder if someone can tell me how to set the paramater value about "DEFAULT" when deploy the application.

BTW:I have already tried to rollback the GF resource in my local workspace and build the source again but the issue is still exists(which is mean that after the issue is occured, the GFV4 can't be deployed in the mode of relative path even I have not change any source), I have looked into the source and found the paramaters value about "DEFAULT" which is get from the jersey side is still wrong(as the "DEFAULT" value doesn't get the proper value).

[Operations to Reproduce]
1、update my revised source to the latest version of GF and build the GFV4.
2、run the QL tests about the GFV4 built as the step1 shows.
3、then you will found something error as follows:

deploy-upload-v3-impl-windows:
     [exec] remote failure: File not found : E:\glassfish3\glassfish\domains\dom
ain1\config\..\..\dist\basicweb\hellojsp.war
     [exec] Command deploy failed.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 52.822s
[INFO] Finished at: Mon Jan 07 14:12:01 KST 2013
[INFO] Final Memory: 10M/28M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.maven-antrun-extended-plugin:maven-antr
un-extended-plugin:1.42:run (default-test) on project quicklook: An Ant BuildExc
eption has occured: The following error occurred while executing this line:
[ERROR] E:\GF_MAIN\SOURCE_0102\appserver\tests\quicklook\build.xml:149: The foll
owing error occurred while executing this line:
[ERROR] E:\GF_MAIN\SOURCE_0102\appserver\tests\quicklook\build.xml:240: The foll
owing error occurred while executing this line:
[ERROR] E:\GF_MAIN\SOURCE_0102\appserver\tests\quicklook\web\helloworld\build.xm
l:71: The following error occurred while executing this line:
[ERROR] E:\GF_MAIN\SOURCE_0102\appserver\tests\quicklook\gfproject\v3-targets.xm
l:232: The following error occurred while executing this line:
[ERROR] E:\GF_MAIN\SOURCE_0102\appserver\tests\quicklook\gfproject\v3-targets.xm
l:236: exec returned: 1

4、After the above operation and you will found you can't deploy the application in the mode of relative path(even you have rollback the modification and built the GFV4 again).

[affected versions ]
1 4.0_b70
2 gf's trunk until 2012/01/07



 Comments   
Comment by Jeremy_Lv [ 07/Jan/13 ]

I want to know which side will set the paramater value of "DEFAULT" that can be used in the operation of deploy?

Comment by Hong Zhang [ 07/Jan/13 ]

I think the "DEFAULT" is set by the underlying admin command infrastructure when a param is declared as "primary". In this case in DeployCommandParameters.java, the path is declared as primary:

@Param(primary=true)
public File path;

you should try to trace the code without your changes to see how the relative path is handled currently and then compare with the behavior when your changes are applied.

I am not sure why after your changes were rolled back locally you still see the problem. Did you try to remove the old installation and install a new one? I tried to update my workspace and built it this morning and I saw the expected behavior in this case in my box:

hzhang@nmr:~/files/sun/glassfish3/glassfish/bin$ asadmin deploy aa.jar
remote failure: File not found : /home/hzhang/files/sun/glassfish3/glassfish/bin /aa.jar
Command deploy failed.

Comment by Jeremy_Lv [ 08/Jan/13 ]

I found the issue is occured when excuting the deploy command with the option of --upload true.

After the issue is occured, I can't deploy the application with relative path althought I have trace the code without any changes. I'm sure I have remove the old installation and install a new one.

Comment by Jeremy_Lv [ 08/Jan/13 ]

After the issue is occured. I have delete all of codes of GFV4 and its dependency. Then I download the GFV4 source and downloand all of the dependency again. After built the GFV4 and run it in my computer. The issue is still exists. I think some option has been set into my computer system when run the GFV4 after excute the --upload option.

Comment by Jeremy_Lv [ 08/Jan/13 ]

I think my modification are not finish. specially MapInjectionResolver.java and DeployCommandParameters.java. I will check it later..

Comment by Jeremy_Lv [ 08/Jan/13 ]

I have looked into the code and found the value of "filePaths" in MapInjectionResolver isn't correct when deploy with --upload mode.

                final List<String> filePaths = getUploadedFileParamValues(
                        "DEFAULT",
                        type, optionNameToUploadedFileMap);

I will look into the reason and try to fix it

Comment by Hong Zhang [ 08/Jan/13 ]

Strange. I could not reproduce the problem with an unmodified GF 4.0 build when the upload option is set:

hzhang@nmr:~/files/sun/glassfish3/glassfish/bin$ asadmin deploy --upload=true aa.jar
Could not read the file /home/hzhang/files/sun/glassfish3/glassfish/bin/aa.jar to upload it.
Command deploy failed.

One thing I just remembered is Tom (from admin team) once told me there is now a command cache, so you can try to remove the cache to see if it makes a difference:
There is a new command model cache under the $GF_HOME/.gfclient directory that is intended to speed up command execution. When you update your server software, a cached command model can become invalid. This means that a new command model has to be downloaded from the server and cached, and the command retried.

However, this cache update should all be automatic so if this is indeed the cause, maybe there is some bug in the command cache that needs to fixed also.

Yeah, look into the MapInjectionResolver and see what you can find. We need to fix this for the URI case anyways.

Comment by Jeremy_Lv [ 09/Jan/13 ]

I found the .gfclient directory is not exists in $GF_HOME, However, I found this directory in C:\Users\jeremy\.gfclient.
After I delete the directory in C:\Users\jeremy\.gfclient, the deploy command can be excute successfully.

[Suggestion]
I think it is kindly to move the .gfclient directory to the directory of $GF_HOME.

Comment by TangYong [ 09/Jan/13 ]

Hi Tom, Sahoo, Hong,

Although I can understand the aim of using $GF_HOME/.gfclient cache in order to speed up command executing, this change currently is based on gf self's consideration regardless of whether an user needs such a cache(or the cache maybe bring an unexpected result(eg. the issue)). So, from an user's perspective and gf, I think that:

1) keeping the cache here, no problem
2) adding an option into "asadmin start-domain --clean" to clear the cache and osgi/cache including temp data.

2)'s way is similar to Apache Karaf and once executing "karaf.bat clean ", karaf related cache data will be cleared.

Do you agree with me?

Thanks
--Tang

Comment by Hong Zhang [ 09/Jan/13 ]

Jeremy: Sorry I had a typo in my previous post, it was supposed to be $HOME/.gfclient directory with the current implementation.

Tang: I think Martin Mares is the one who implemented the command cache. If you have suggestions for it, it's better to file a separate issue under admin category and assign to him or write to him (martin.mares@java.net) directly and probably Cc Tom (tmueller@java.net) also. They may not see this issue as this issue is under deployment category unless they have subscribed to see all the issues.

Comment by TangYong [ 09/Jan/13 ]

Hi Hong,

OK, I will firstly send a mail to user list and let they confirm whether the suggestion is needed or not?

Thanks
--Tang

Comment by Hong Zhang [ 09/Jan/13 ]

Yeah that sounds good.

Comment by Jeremy_Lv [ 14/Jan/13 ]

Have confirmed the phenomenon is occured by the temporary directory about $HOME/.gfclient

Generated at Wed Mar 29 23:42:17 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.