Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asadmin commands with quotes are not parsed properly in postbootcommandfile #1866

Closed
Davio opened this issue Aug 15, 2017 · 4 comments
Closed
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect
Milestone

Comments

@Davio
Copy link

Davio commented Aug 15, 2017

Description


When using a postbootcommandfile, there is some weird issue in parsing attributes with quotes

Expected Outcome

The commands are executed successfully, in this specific case: the JDBC connection pool is created

Current Outcome

java.lang.IllegalArgumentException: Unbalanced quotes
| at org.glassfish.common.util.admin.ParamTokenizer.scanToken(ParamTokenizer.java:142)
| at org.glassfish.common.util.admin.ParamTokenizer.nextTokenKeepEscapes(ParamTokenizer.java:113)
| at org.glassfish.common.util.admin.MapInjectionResolver.convertStringToProperties(MapInjectionResolver.java:501)
| at org.glassfish.common.util.admin.MapInjectionResolver.convertStringToObject(MapInjectionResolver.java:375)
| at org.glassfish.common.util.admin.MapInjectionResolver.getValue(MapInjectionResolver.java:179)
| at org.jvnet.hk2.config.InjectionManager.syncDoInject(InjectionManager.java:169)
| at org.jvnet.hk2.config.InjectionManager.inject(InjectionManager.java:74)
| at com.sun.enterprise.v3.admin.CommandRunnerImpl.injectParameters(CommandRunnerImpl.java:371)
| at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1224)
| at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
| at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
| at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
| at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:169)
| at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.run(CommandExecutorImpl.java:94)
| at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.doBootCommands(GlassFishMain.java:245)
| at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:126)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| at java.lang.reflect.Method.invoke(Method.java:498)
| at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:102)
| at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)

Steps to reproduce (Only for bug reports)

1 -** Create a postbootcommandfile postboot.txt

Contents:
create-jdbc-connection-pool --restype javax.sql.ConnectionPoolDataSource --datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource --property "serverName=localhost:databaseName=mydb:user=user:password=password" pool/db

2 -** Specify the postbootcommandfile

In my case with Docker:
ENTRYPOINT ["/opt/payara41/bin/asadmin", "start-domain", "--verbose", "--postbootcommandfile", "./postboot.txt", "payaradomain"]

Context (Optional)

I'm trying to create a JDBC connection pool with the --postbootcommandfile option

Environment

  • Payara Version: 4.1.1.172
  • Edition: Full (possibly others)
  • JDK Version: 8 OpenJDK
  • Operating System: Linux (Payara Docker image)
  • Database: PostgreSQL
@MattGill98
Copy link
Contributor

Hi Davio,

There were a couple of problems parsing post boot command files in 172. A few of these were since fixed in PR/1665. Speech marks however seem to still have a problem. I've raised internal issue 1957 to address this. As a quick fix for you, the command should work fine without speech marks. If not then I would recommend either building Payara yourself, or downloading the 173 release from here.

I hope this helps,

Matt

@MattGill98 MattGill98 self-assigned this Aug 15, 2017
@MattGill98 MattGill98 added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect labels Aug 15, 2017
@Davio
Copy link
Author

Davio commented Aug 15, 2017

I tried without quotation marks but it throws another error, something like unknown property name serverName.

I think there is maybe some double parsing or something like that where the postboot parser parses the file and asadmin parses the commands again.

I'll try it with 173, but the Docker images have not yet been updated.

@mikecroft
Copy link
Contributor

The prerelease tags are now up-to-date @Davio so you could try those for now

@Davio Davio changed the title asadmin commands with quotes are not parsed properly asadmin commands with quotes are not parsed properly in postbootcommandfile Aug 16, 2017
@Davio
Copy link
Author

Davio commented Aug 16, 2017

Using the prerelease (173) version yields the following error when using quotes:

PlainTextActionReporterFAILUREjava.lang.IllegalArgumentException: Invalid property syntax, missing property value: "serverName=localhost:databaseName=mydb:user=user:password=password"

However, it does work without quotes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect
Projects
None yet
Development

No branches or pull requests

4 participants