When this customer upgraded from 9.2 to 9.4 when startup they get :
2019-03-19T11:30:23.423+0700 INFO 1 com.l7tech.policy.wsp.PermissiveWspVisitor: Ignoring invalid property ScriptBase64 of class com.l7tech.external.assertions.js.JavaScriptAssertion
2019-03-19T11:30:23.425+0700 WARNING 1 com.l7tech.server.boot.GatewayMain: Error starting server : java.lang.NullPointerException
java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
at java.util.regex.Matcher.reset(Matcher.java:309)
at java.util.regex.Matcher.<init>(Matcher.java:229)
at java.util.regex.Pattern.matcher(Pattern.java:1093)
at com.l7tech.external.assertions.js.JavaScriptAssertion.getUsedVariablesFromScript(JavaScriptAssertion.java:88)
at com.l7tech.external.assertions.js.JavaScriptAssertion.getVariablesUsed(JavaScriptAssertion.java:74)
at com.l7tech.policy.variable.PolicyVariableUtils.getVariablesUsedNoThrow(Unknown Source)
at com.l7tech.server.policy.PolicyCacheImpl.a(Unknown Source)
at com.l7tech.server.policy.PolicyCacheImpl.a(Unknown Source)
I checked the formats for the JavaScript Asseriton ( for the draft one they got, and the one in 9.4) :
Here is the formats :From Assertion : from the .saar module we have : (this is the one in 9.2 - but for my testign I used 9.3) :<?xml version="1.0" encoding="UTF-8"?><wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"><wsp:All wsp:Usage="Required"><L7p:JavaScript><L7p:ScriptBase64 stringValue="dmFyIHg9IDE7CgovKiBURVNUTU9EICovCg=="/></L7p:JavaScript></wsp:All></wsp:Policy>For the JavaScript asserion that comes with 9.4 we have :<?xml version="1.0" encoding="UTF-8"?><wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"><wsp:All wsp:Usage="Required"><L7p:JavaScript><L7p:ExecutionTimeout stringValue=""/><L7p:Name stringValue=""/><L7p:Script stringValueReference="inline"><![CDATA[var x = 1;/* TESTMOD */]]></L7p:Script></L7p:JavaScript></wsp:All></wsp:Policy>
(the base64 one will use : stringValue or stringValueRefernece="inline" - depending on the size of the text, ans does the non-base64 one too )
The error that was in the 9.4 startup was clear that it did not understand property : ScriptBase64and I expect the null error would because it then did not have script file.For upgrade I am thinking that we may need to do either some direct manipulation of the policy xml, via db to get these references into loadable form - and then review them for correctness.
Here is first simple approach
1) We change the attribute to 'Script' which is value for new JavaScript option:
note: so this change is done directly in the database
mysql
> use ssg;
> update policy set xml = replace(xml, 'ScriptBase64', 'Script') where xml like '%ScriptBase64%';
2) try start ssg process
service ssg start
(hopefully this works now and gets past that 'ScriptBase64' issue - it seemed to on my test case)
3) In policy Manger edit the javascript policy assertions :
The data will appear as base64 encoded :<Please see attached file for image>
4) Use some decoded
cut-and-paste the b64 encoded data into some converter .
5) Paste back javascript code<Please see attached file for image>
And do "OK" and Save.
This worked for my test case, so keen to see if works for yours as well.