Topic
  • 4 replies
  • Latest Post - ‏2013-11-14T09:35:34Z by MatthewJackson
MatthewJackson
MatthewJackson
5 Posts

Pinned topic Properties and Context roots

‏2013-11-13T18:00:58Z |

Hi,  I'm evaluating the Liberty profile and currently trying to install an EAR that was developed using WSAD on WAS 6.1.

If I import the EAR as is,  its got a deployment descriptor of 1.4, and I can go in and change the context root of one of the WAR files, however if I create a new EAR (6.0) and pull the WARs in, I can't seem to be able to set that - so where do I do that?  Presumably somewhere in server.xml, but I can't see where.

My second issue is that the EAR needs to access a properties file, and there's no 'properties' folder.   Where do I put that?   The closest I can find is in the topic

https://www.ibm.com/developerworks/community/forums/html/topic?id=45e42c28-a8b5-4b67-8b4f-bc550de7dde9&ps=25

however, the example XML that seems to fit closet - which is create a folder to put the propery file in  seems invalid.  What's this XML supposed to be?

(Code below)

Many thanks,

Matthew Jackson, Head of Technical Research, Riva Financial Systems.

 

 

D) Using a library folder class path location (8.5.5 onwards)

If you are using the 8.5.5 beta, you could also add a folder to the class path of your application, like so:

<library id="configResources">
    <folder="${server.config.dir}/config" />
</library>

<application location="foo.war">
    <classloader privateLibraryRef="configResources" />
</application>

 

  • rsanchezh
    rsanchezh
    26 Posts
    ACCEPTED ANSWER

    Re: Properties and Context roots

    ‏2013-11-13T19:31:15Z  

    Hello,

    About the context root for web projects, here is a link that explains the precedence of different ways to specify the context root: http://pic.dhe.ibm.com/infocenter/radhelp/v9/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.multiplatform.doc%2Fae%2Ftwlp_dep_war.html

    You can to specify the context root in the deployment descriptor (DD) of the EAR. When you create an EAR 6, the DD is not created by default. If you want to create it in WDT, you can right click on the EAR project and select Java EE Tools > Generate deployment descriptor stub

    If you do not want to have a DD in the EAR, you can specify the context root in the file ibm-web-ext.xml of the web project. To create this file using WDT, right click on the web project, and select Java EE Tools > Generate WebSphere Extensions Deployment descriptor.  The file will be created under WEB-INF

  • Alasdair
    Alasdair
    55 Posts
    ACCEPTED ANSWER

    Re: Properties and Context roots

    ‏2013-11-13T20:39:46Z  

    The xml:

    <library id="configResources">
        <folder="${server.config.dir}/config" />
    </library>

    should be:

    <library id="configResources">
        <folder dir="${server.config.dir}/config" />
    </library>

    that might be the reason you are getting an error.

  • rsanchezh
    rsanchezh
    26 Posts

    Re: Properties and Context roots

    ‏2013-11-13T19:31:15Z  

    Hello,

    About the context root for web projects, here is a link that explains the precedence of different ways to specify the context root: http://pic.dhe.ibm.com/infocenter/radhelp/v9/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.multiplatform.doc%2Fae%2Ftwlp_dep_war.html

    You can to specify the context root in the deployment descriptor (DD) of the EAR. When you create an EAR 6, the DD is not created by default. If you want to create it in WDT, you can right click on the EAR project and select Java EE Tools > Generate deployment descriptor stub

    If you do not want to have a DD in the EAR, you can specify the context root in the file ibm-web-ext.xml of the web project. To create this file using WDT, right click on the web project, and select Java EE Tools > Generate WebSphere Extensions Deployment descriptor.  The file will be created under WEB-INF

  • Alasdair
    Alasdair
    55 Posts

    Re: Properties and Context roots

    ‏2013-11-13T20:39:46Z  

    The xml:

    <library id="configResources">
        <folder="${server.config.dir}/config" />
    </library>

    should be:

    <library id="configResources">
        <folder dir="${server.config.dir}/config" />
    </library>

    that might be the reason you are getting an error.

  • MatthewJackson
    MatthewJackson
    5 Posts

    Re: Properties and Context roots

    ‏2013-11-14T09:15:09Z  
    • Alasdair
    • ‏2013-11-13T20:39:46Z

    The xml:

    <library id="configResources">
        <folder="${server.config.dir}/config" />
    </library>

    should be:

    <library id="configResources">
        <folder dir="${server.config.dir}/config" />
    </library>

    that might be the reason you are getting an error.

    Thanks, that works a treat. :-)

    Just for reference, as this is an ear, I had to set the server.xml to have:

    <library id="configResources">
        <folder dir="c:/test/Liberty/config" />    
    </library>
     
        <enterpriseApplication id="TestEAR6" location="TestEAR6.ear" name="TestEAR6">
        <classloader privateLibraryRef="configResources" />
        </enterpriseApplication>

    I set the dir to a fixed location just to test, but it worked with server.config.dir

  • MatthewJackson
    MatthewJackson
    5 Posts

    Re: Properties and Context roots

    ‏2013-11-14T09:35:34Z  
    • rsanchezh
    • ‏2013-11-13T19:31:15Z

    Hello,

    About the context root for web projects, here is a link that explains the precedence of different ways to specify the context root: http://pic.dhe.ibm.com/infocenter/radhelp/v9/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.multiplatform.doc%2Fae%2Ftwlp_dep_war.html

    You can to specify the context root in the deployment descriptor (DD) of the EAR. When you create an EAR 6, the DD is not created by default. If you want to create it in WDT, you can right click on the EAR project and select Java EE Tools > Generate deployment descriptor stub

    If you do not want to have a DD in the EAR, you can specify the context root in the file ibm-web-ext.xml of the web project. To create this file using WDT, right click on the web project, and select Java EE Tools > Generate WebSphere Extensions Deployment descriptor.  The file will be created under WEB-INF

    Thank you, that's sorted it.   Also under the same menu option I found Generate Websphere Extentions Descriptor which allowed me to share the session context.