Topic
6 replies Latest Post - ‏2014-01-21T19:58:37Z by MyScreen2
MyScreen2
MyScreen2
41 Posts
ACCEPTED ANSWER

Pinned topic Liberty Profile Include Element not working

‏2014-01-21T19:10:35Z |

I have some smalls apps running in WLP 8.5.5.1 with a simple server.xml file.  I wanted to start using the include element to break my file into smaller pieces and was able to create a small xml file for my LDAP settings with no issue.  However, when I create two similar xml files for my two Applications I get the following error:

 

CWWKG0001E: The configuration parser detected an error while parsing the root of the configuration and the referenced configuration documents. Error: Cannot read ${server.config.dir}/MyApp.xml

 

My Include looks like this:

 

    <include location="${server.config.dir}/MyApp.xml"/>
 

and that xml looks like this:

<server>
    <application name="MyApp" type="war" location="MyApp.war" context-root="myapp" id="myapp"/>
</server>

 

Funny thing is I can copy this one line directly into the server.xml file, comment out the include and it works.  I'm sure I am doing something incredibly stupid - can someone see my mistake?

 

Thanks for any help!

  • AlexMulholland
    AlexMulholland
    32 Posts
    ACCEPTED ANSWER

    Re: Liberty Profile Include Element not working

    ‏2014-01-21T19:17:23Z  in response to MyScreen2

    Hi,

    Unless you are overriding the default location variables, ${server.config.dir} will resolve to this directory:

    usr/servers/<your_server_name>

    You don't state the location of your included file, is it in that directory?

    Regards, Alex.

    • MyScreen2
      MyScreen2
      41 Posts
      ACCEPTED ANSWER

      Re: Liberty Profile Include Element not working

      ‏2014-01-21T19:20:52Z  in response to AlexMulholland

      Yes, that is my directory.  I am placing the next xml file in the same directory as the server.xml.

      This is working for the LDAP.xml file I created for the same application so I don't know why it is not working for this.  It makes me think my syntax is wrong in the MyApp.xml file...

      • MyScreen2
        MyScreen2
        41 Posts
        ACCEPTED ANSWER

        Re: Liberty Profile Include Element not working

        ‏2014-01-21T19:36:41Z  in response to MyScreen2

        I just got both of my Apps to work using includes, but I stumbled into the 'solution' that will seem weird.  It seems to be related to the order in which I do the following two steps:

        1) Change the server.xml
        2) Create the actual xml file.

        Even though I had done plenty of stop and start server commands, it wasn't until I created the xml file first, THEN changed the server.xml that the setting took.  None of these changes were related to the content of the included xml file.

        Let me spend a few more minutes and see if I can get the exact steps down and reply to this thread.

        • MyScreen2
          MyScreen2
          41 Posts
          ACCEPTED ANSWER

          Re: Liberty Profile Include Element not working

          ‏2014-01-21T19:44:34Z  in response to MyScreen2

          Hmmm - I tried to recreate the issue by doing my steps in the same order but could not reproduce.  Even though I was stopping and starting the server through the DOS window, could something have been cached that was 'skewing' my attempts earlier?  If not, I'll just say I messed up earlier and move on.

          • bhdaniel
            bhdaniel
            2 Posts
            ACCEPTED ANSWER

            Re: Liberty Profile Include Element not working

            ‏2014-01-21T19:55:24Z  in response to MyScreen2

            It's possible that you were running with a cached version of the config that was in the main server.xml file. When it was failing, were you seeing the CWWKG0001E error every time you started the server? If not, this may be the explanation (though in a quick check here I wasn't able to reproduce.) If you were seeing the error, then it's likely that something was amiss with the file -- perhaps file permissions or something like that?

             

            • MyScreen2
              MyScreen2
              41 Posts
              ACCEPTED ANSWER

              Re: Liberty Profile Include Element not working

              ‏2014-01-21T19:58:37Z  in response to bhdaniel

              I do not think it was permissions related, but it could have been that caching was confusing me.  At this point it is working perfectly - so I am off to the next step.

              Thanks so much for everyone's quick response!