eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
387 stars 144 forks source link

appclient appending an extra $ and \r for arguments passed #18332

Closed glassfishrobot closed 12 years ago

glassfishrobot commented 12 years ago

When trying to run an appclient on windows with cygwin, appclient is appending extra characters to the arguments.For example for a simple parameter "3", it is sending "$'3\r'"

Here is the appclient output run on ubuntu and windows with cygwin with debug option:

Linux:

{imqDestinationName=cdi_hello_mdb_InQueue, imqDestinationDescription=A Description for the Destination Object} at time 1328620123577 Sent message 0 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties(): {imqDestinationName=cdi_hello_mdb_InQueue, imqDestinationDescription=A Description for the Destination Object}

at time 1328620124276 Sending message 1 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties():

{imqDestinationName=cdi_hello_mdb_InQueue, imqDestinationDescription=A Description for the Destination Object} at time 1328620124276 Sent message 1 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties(): {imqDestinationName=cdi_hello_mdb_InQueue, imqDestinationDescription=A Description for the Destination Object}

at time 1328620124509 Sending message 2 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties():

{imqDestinationName=cdi_hello_mdb_InQueue, imqDestinationDescription=A Description for the Destination Object} at time 1328620124509 Sent message 2 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties(): {imqDestinationName=cdi_hello_mdb_InQueue, imqDestinationDescription=A Description for the Destination Object}

at time 1328620124742 remote bean:test.ejb.session._HelloSless_Wrapper@9043235f remote invoke : PASS Waiting for queue message Received message : mdb() invoked Received message : PASS

Windows

++ dirname C:/ha/new/glassfish3/glassfish/bin/appclient

glassfishrobot commented 6 years ago
glassfishrobot commented 12 years ago

@glassfishrobot Commented msreekanth said: Not sure if this is related to this issue we had at 3.1 time frame. http://java.net/jira/browse/GLASSFISH-16044

glassfishrobot commented 12 years ago

@glassfishrobot Commented msreekanth said: On Normal command line terminal this works:

Windows CMD

C:\ha\file_repository\appclient>appclient -client RequestAndApplicationScopeEJBM DBClient.jar -targetserver bigapp-x2250-3.us.oracle.com:23700 Feb 07, 2012 2:16:46 AM org.hibernate.validator.util.Version INFO: Hibernate Validator 4.2.0.Final Feb 07, 2012 2:16:47 AM com.sun.messaging.jms.ra.ResourceAdapter start INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 4.5.2 (Build 2-d) Compile: Thu Dec 8 17:30:48 PST 2011 Feb 07, 2012 2:16:47 AM com.sun.messaging.jms.ra.ResourceAdapter start INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMO TE, connection mode is TCP Feb 07, 2012 2:16:47 AM com.sun.messaging.jms.ra.ResourceAdapter start INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE Sending message 0 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties():

{imqDestinationName=cdi_hello_mdb_InQueue, imqDestinatio nDescription=A Description for the Destination Object} at time 1328609819179 Sent message 0 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties(): {imqDestinationName=cdi_hello_mdb_InQueue, imqDestinatio nDescription=A Description for the Destination Object}

at time 1328609819195 Sending message 1 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties():

{imqDestinationName=cdi_hello_mdb_InQueue, imqDestinatio nDescription=A Description for the Destination Object} at time 1328609819210 Sent message 1 to Oracle GlassFish(tm) Server MQ Destination getName(): cdi_hello_mdb_InQueue Class: com.sun.messaging.Queue getVERSION(): 3.0 isReadonly(): false getProperties(): {imqDestinationName=cdi_hello_mdb_InQueue, imqDestinatio nDescription=A Description for the Destination Object}

at time 1328609819210 remote bean:test.ejb.session._HelloSless_Wrapper@9043235f remote invoke : PASS Waiting for queue message Received message : mdb() invoked Received message : PASS

C:\ha\file_repository\appclient>

glassfishrobot commented 12 years ago

@glassfishrobot Commented sonymanuel said: The last execution on Windows was on build 14. Then this test was failing due to issue http://java.net/jira/browse/GLASSFISH-18155. Once that issue was fixed we are hitting this one.

glassfishrobot commented 12 years ago

@glassfishrobot Commented @tjquinno said: I do not think it matters, but for completeness what version of Windows does this happen with?

I think I will have access to a Windows XP Pro system to try to duplicate the problem and investigate.

glassfishrobot commented 12 years ago

@glassfishrobot Commented junesm said: Added to 3.1.2 Release Notes:

Description

When you try to run an application client on Windows with cygwin, the application client is appending extra characters to the arguments. For example, for a simple parameter 3, it is sending $'3\r'.

Workaround

None.

glassfishrobot commented 12 years ago

@glassfishrobot Commented @tjquinno said: I was able to reproduce the problem and I see the cause. I made a small change in my workspace and it seems to repair the defect.

glassfishrobot commented 12 years ago

@glassfishrobot Commented @tjquinno said: Possible addition to the release note:

Depending on how your app client handles command-line arguments, you might be able to work around this problem without changing your app client by adding an extra command-line argument. For example, instead of

appclient -jar mydir/MyClient.jar 3

you could use

appclient -jar mydir/MyClient.jar 3 extra

This will add the trailing \r to the "extra" argument, protecting the earlier ones. Note that this will not work if your app client handles all the arguments on the line in some way.

Another workaround is to modify your app client to use String.trim on the arguments - at least the last one - which will remove any trailing \r character.

glassfishrobot commented 12 years ago

@glassfishrobot Commented @tjquinno said: Fix checked into the trunk (for 4.0).

Project: glassfish Repository: svn Revision: 52503 Author: tjquinn Date: 2012-02-08 16:20:51 UTC Link:

Log Message:

Fix for 18332.

CLIBootstrap prepares a java command line for launching the ACC which includes the command-line arguments to be passed to the app client. Due to differences in command-line parsing on the various platforms, this error was visible only on Windows systems using cygwin, but the code used System.out.println to convey the java command to use back to the command shell. On Windows under cygwin the final command-line argument had a trailing \r character which was then passed into the client.

This change uses System.out.print (instead of println) to suppress the trailing \r on the last argument.

Tests: QL, manual tests on Windows, Windows with cygwin, Mac OS X

Revisions:

52503

Modified Paths:

trunk/main/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java

glassfishrobot commented 12 years ago

@glassfishrobot Commented junesm said: Thanks for the Release Note update, Tim! I added your workaround info almost verbatim:

Workaround

Depending on how your application client handles command-line arguments, you might be able to work around this problem without changing your application client by adding an extra command-line argument. For example, instead of entering this command:

appclient -jar mydir/MyClient.jar 3

You could enter this command:

appclient -jar mydir/MyClient.jar 3 extra

This adds the trailing \r to the last argument, extra, protecting the previous ones. Note that this does not work if your application client handles all the arguments on the line in some way.

Another workaround is to modify your application client to use String.trim on the arguments, or at least the last one, which removes any trailing \r character.

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-18332

glassfishrobot commented 12 years ago

@glassfishrobot Commented Reported by msreekanth

glassfishrobot commented 12 years ago

@glassfishrobot Commented Marked as fixed on Wednesday, February 8th 2012, 8:23:23 am