Wednesday, 22 August 2018

Weblogic 12c: Solving Invalid Template error

One of the labs in our Weblogic Advanced Administration 12c course is about using domain templates. When revising the particular lab, we created a domain in Weblogic 12c and then created a template based on the domain. On recreation of the domain based on the template we get an exception:
This we get regardless of if we provide nodemanager details at the initial creation of the domain.

We did some investigation and found for instance this forum,  that gave a hint, but not a solution or workaround.

One important hint is the message 'config-nodemanager.xml: failed to parse the template!(/home/rcma/rcma_domain_template.jar): Parsing the config-nodemanager.xml failed!'. So it relates to the nodemanager configuration and the contents of the config-nodemanager.xml file in the template.

By the way, my colleague found that the same issue can also be experienced during pack and unpack, as desribed in Oracle support note 2311027.1. Here you can find that the problem in the config-nodemanager.xml is about the password. If you have a nodemanager password set in the domain's config.xml, it is encrypted with the domain's seed/salt. It can't be decrypted and read by the domain configurator or unpack tools, because they don't have the salt of the source domain.

So, what is the work-around or solution? I see two:
  1. Following the before mentioned support note, you can replace the nodemanager password in the ${SourceDomainHome}/config/config.xml in the  <node-manager-password-encrypted>******</node-manager-password-encrypted> element with a clear text password. Do the same in the <nod:password>******</nod:password> element in the ${SourceDomainHome}/init-info/config-nodemanager.xml
  2. Open the templates jar file:
    Then Extract the config-nodemanager.xml from it and edit it:
    <?xml version="1.0" encoding="UTF-8"?>
    <nod:nodeManagerInfo xmlns:nod="http://xmlns.oracle.com/cie/nodemanager">
      <nod:userName>weblogic</nod:userName>
      <nod:password>{AES}6eu/SDW2GBcb4R2lZgBD1hJVzN7UXQw+w4o46wfvHlk=</nod:password>
      <nod:nodeManagerHome>/app/work/domains/AA2Domain/nodemanager</nod:nodeManagerHome>
      <nod:perDomainNodeManager>true</nod:perDomainNodeManager>
      <nod:customLocationNodeManager>false</nod:customLocationNodeManager>
      <nod:manualNodeManagerSetup>false</nod:manualNodeManagerSetup>
    </nod:nodeManagerInfo>
    replace the password with something readable, for instance:
    <?xml version="1.0" encoding="UTF-8"?>
    <nod:nodeManagerInfo xmlns:nod="http://xmlns.oracle.com/cie/nodemanager">
      <nod:userName>weblogic</nod:userName>
      <nod:password>DoesNotNecessarilyBeAMatchingPassword2018</nod:password>
      <nod:nodeManagerHome>/app/work/domains/AA2Domain/nodemanager</nod:nodeManagerHome>
      <nod:perDomainNodeManager>true</nod:perDomainNodeManager>
      <nod:customLocationNodeManager>false</nod:customLocationNodeManager>
      <nod:manualNodeManagerSetup>false</nod:manualNodeManagerSetup>
    </nod:nodeManagerInfo>
    The password does not necessarily be the actual password of the source environment (at least with the template, not sure in case of pack/unpack). Then re-package the file into the template.
I tested the second work-around, not the one suggested by the note. I actually prefer the second option, since the first option suggest updating the source domain, which I'd rather prevent to do.
Since you do need to do a change, why not change the template? This we tested succesfully.

Another issue solved. Well, actually not really. This is a workaround and the Weblogic tooling should prevent this from happening. You should be able to enter a nodemanager password that is added to the template, or you should be asked for a password at unpack or domain creation. In fact, at creation of a new domain based on the template, you are asked for a nodemanager password. So, why would the domain configurator even bother about trying to read the nodemanager password and/or fail at parsing the file?

If I'd be so honoured to have this blog be read to a product manager or developer of Weblogic, could you take a look into this? Thanks!

No comments :