Problem creating connection-pool from --postbootcommandfile

83 views
Skip to first unread message

Paul Blew

unread,
Aug 30, 2017, 3:33:49 AM8/30/17
to Payara Forum
Hi,

I have a simple webapp which uses a Derby database.  I've been deploying it successfully using:

./asadmin multimode --file asadmin.txt

where the content of asadmin.txt is:

create-jdbc-connection-pool --datasourceclassname=org.apache.derby.jdbc.ClientDataSource --restype=javax.sql.DataSource --property=ServerName=db:port=1527:DatabaseName=MyDB:user=aUser:password=aP@ssw0rd:connectionAttributes=\;create\\=true my-pool
create
-jdbc-resource --connectionpoolid my-pool jdbc/MyDS
deploy
--force --enabled=true myapp.war

This works without issue.

With Payara 172 and later, --postbootcommandfile became available, so it made sense to me to use it.  However, with the command line

./asadmin start-domain --postbootcommandfile asadmin.txt

I get the following exception (Payara 173):

[#|2017-08-30T07:03:38.662+0000|INFO|Payara 4.1||_ThreadID=1;_ThreadName=main;_TimeMillis=1504076618662;_LevelValue=800;|
 
Reading in commandments from /opt/payara41/asadmin.txt|#]

[#|2017-08-30T07:03:38.681+0000|INFO|Payara 4.1||_ThreadID=1;_ThreadName=main;_TimeMillis=1504076618681;_LevelValue=800;|
 
Running command: create-jdbc-connection-pool --datasourceclassname=org.apache.derby.jdbc.ClientDataSource --restype=javax.sql.DataSource --property=ServerName=db:port=1527:DatabaseName=MyDB:user=aUser:password=aP@ssw0rd:connectionAttributes=\;create\\=true my-pool|#]

[#|2017-08-30T07:03:38.819+0000|SEVERE|Payara 4.1|javax.enterprise.system.core|_ThreadID=1;_ThreadName=main;_TimeMillis=1504076618819;_LevelValue=1000;_MessageID=NCLS-CORE-00003;|
 
Exception while running a command
java
.util.regex.PatternSyntaxException: Illegal repetition near index 1
\${.+}
 
^
    at java
.util.regex.Pattern.error(Pattern.java:1955)
    at java
.util.regex.Pattern.closure(Pattern.java:3157)
    at java
.util.regex.Pattern.sequence(Pattern.java:2134)
    at java
.util.regex.Pattern.expr(Pattern.java:1996)
    at java
.util.regex.Pattern.compile(Pattern.java:1696)
    at java
.util.regex.Pattern.<init>(Pattern.java:1351)
    at java
.util.regex.Pattern.compile(Pattern.java:1028)
    at java
.lang.String.replaceAll(String.java:2223)
    at org
.glassfish.common.util.admin.MapInjectionResolver.convertStringToProperties(MapInjectionResolver.java:525)
    at org
.glassfish.common.util.admin.MapInjectionResolver.convertStringToObject(MapInjectionResolver.java:376)
    at org
.glassfish.common.util.admin.MapInjectionResolver.getValue(MapInjectionResolver.java:180)
    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:373)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1229)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1727)
    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.runCommand(GlassFishMain.java:231)
    at com
.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.doBootCommands(GlassFishMain.java:269)
    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)
|#]

[#|2017-08-30T07:03:38.903+0000|INFO|Payara 4.1||_ThreadID=1;_ThreadName=main;_TimeMillis=1504076618903;_LevelValue=800;|
 
PlainTextActionReporterFAILUREjava.util.regex.PatternSyntaxException: Illegal repetition near index 1
\${.+}
 
^Description: create-jdbc-connection-pool commandIllegal repetition near index 1
\${.+}
 
^
   
Usage: create-jdbc-connection-pool [--datasourceclassname=datasourceclassname] [--restype=restype] [--steadypoolsize=8] [--maxpoolsize=32] [--maxwait=60000] [--poolresize=2] [--idletimeout=300] [--initsql=initsql] [--isolationlevel=isolationlevel] [--isisolationguaranteed=true] [--isconnectvalidatereq=false] [--validationmethod=table] [--validationtable=validationtable] [--failconnection=false] [--allownoncomponentcallers=false] [--nontransactionalconnections=false] [--validateatmostonceperiod=0] [--leaktimeout=0] [--leakreclaim=false] [--creationretryattempts=0] [--creationretryinterval=10] [--sqltracelisteners=fish.payara.jdbc.SilentSqlTraceListener] [--statementtimeout=-1] [--statementleaktimeout=0] [--statementleakreclaim=false] [--lazyconnectionenlistment=false] [--lazyconnectionassociation=false] [--associatewiththread=false] [--driverclassname=driverclassname] [--matchconnections=false] [--maxconnectionusagecount=0] [--ping=false] [--pooling=true] [--statementcachesize=0] [--validationclassname=validationclassname] [--wrapjdbcobjects=true] [--description=description] [--property=property] jdbc_connection_pool_id
|#]

[#|2017-08-30T07:03:38.905+0000|SEVERE|Payara 4.1||_ThreadID=1;_ThreadName=main;_TimeMillis=1504076618905;_LevelValue=1000;|
  java
.util.regex.PatternSyntaxException: Illegal repetition near index 1
\${.+}
 
^
    at java
.util.regex.Pattern.error(Pattern.java:1955)
    at java
.util.regex.Pattern.closure(Pattern.java:3157)
    at java
.util.regex.Pattern.sequence(Pattern.java:2134)
    at java
.util.regex.Pattern.expr(Pattern.java:1996)
    at java
.util.regex.Pattern.compile(Pattern.java:1696)
    at java
.util.regex.Pattern.<init>(Pattern.java:1351)
    at java
.util.regex.Pattern.compile(Pattern.java:1028)
    at java
.lang.String.replaceAll(String.java:2223)
    at org
.glassfish.common.util.admin.MapInjectionResolver.convertStringToProperties(MapInjectionResolver.java:525)
    at org
.glassfish.common.util.admin.MapInjectionResolver.convertStringToObject(MapInjectionResolver.java:376)
    at org
.glassfish.common.util.admin.MapInjectionResolver.getValue(MapInjectionResolver.java:180)
    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:373)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1229)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
    at com
.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1727)
    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.runCommand(GlassFishMain.java:231)
    at com
.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.doBootCommands(GlassFishMain.java:269)
    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)
|#]

I think this indicates a problem with the regex parameter in MapInjectionResolver at line 525 - it should be:

String outside = secPart.replaceAll("\\$\\{.+}", "");

Not sure why this works in a multimode invocation but not using --postbootcommandfile though :-/

Can anyone confirm or point me in the right direction?

Warm regards,
Paul

Mike Croft

unread,
Aug 30, 2017, 4:08:17 AM8/30/17
to Payara Forum
Hi Paul, looks like that regex was added to support equals signs in environment variables in 172:
https://github.com/payara/Payara/pull/1476

Have you tried multimode with 172 or later?

Paul Blew

unread,
Aug 30, 2017, 5:05:36 AM8/30/17
to Payara Forum
Hi Mike,

multimode works fine with both 172 and 173. That's what I find confusing - I would expect both cases (multimode and --postbootcommandfile) to work, or both to fail

Probably also worth mentioning that the above is a distilled testcase - the original runs inside Docker, but the symptoms are the same: multimode works, --postbootcommandfile doesn't.  I've attached the asadmin.txt and Dockerfile for each just in case there is something relevant in there.
2configs.zip

Paul Blew

unread,
Aug 30, 2017, 8:06:30 AM8/30/17
to Payara Forum
Having discussed this by email with Ondro - moving to a GitHub issue ... and hopefully my first pull request :-)
Reply all
Reply to author
Forward
0 new messages