0

I have an app that I am looking to deploy to a weblogic server. Without adjsuting the context root it is accessible via http://{IP}:{port}/{war fileName}. I am looking to adjust the context root so that I can keep the version number in the name of my war file so it is immeadiately obvious which version is being used, yet accessible via http://{IP}:{port}/{appName}

I have tried setting app.context=/{appName} within application.properties, and setting grails.app.context = "/{appName}" within Config.groovy as other answers have suggested, although neither of these seem to have any effect:

How to deploy a grails app with a different context path

How to deploy Grails app without context path?

I have tried this running locally, running on a tomcat server, and on a weblogic server - and it only seems to make a difference when running locally (yes, it's within the production environment settings, not just development).

I have also tried adding a weblogic.xml file within the WEB-INF directory, with the contents:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
     <context-root>/YOUR_CONTEXT_ROOT</context-root>
 </weblogic-web-app>

This does have the desired effect when on the weblogic server, but I was trying to avoid having files specific to weblogic incase it's ever deployed to a different server.

Am I missing something? Are there any other changes that are need to be made to get the settings within application.properties, or Config.groovy to be used?

Community
  • 1
  • 1
Sam Taylor
  • 275
  • 3
  • 13

1 Answers1

0

Here is an example that works for me. Grails 3.0.9. Tomcat 8. In application.yml file. I have Staging server configured like this.

staging:
    localdir:
        dataDir: 'C:\\java\\data\\'
    grails.serverURL: 'http://xxx.xxx.xxx.xxx:8080/myappname'
    server:
        port: 8080
        contextPath: '/myappname'

Then in bootstrap i use it like this

grailsApplication.config.salesreplocator.dataDir
Arjang
  • 731
  • 1
  • 10
  • 19