I am working on a web project that requires Weblogic server and the only way I can view the site after deploying (on my Macbook Pro) is by specifying the application name as a prefix to the entire site. E.g.
http://localhost:7001/myapp-weblogic/
This breaks a ton of styling and JavaScript code that access resources with root URLs (e.g. /images/example.png)
While I can programmatically add "/my-app" to content in a .jsp, I can't do that in my .css files.
I tried setting the "Default WebApp Context Root:" in Weblogic > console > Environment > Servers > myserver > Protocols > HTTP - But that did not work.
This seems like it should be such a simple thing. In IIS I would simply add a line to my local hosts file and add the host name to my IIS container - taking me a grand total of about 42 seconds.
127.0.0.1 myapp.local -> Let's me view my site at http://myapp.local
Thank you in advance for any insight!
UPDATE!! I finally got things working. Some of this is very specific to my setup, but hopefully still helpful to others.
To get it working I needed to do 3 main things and one other related thing:
So another thing I had to do was set a path variable i was referencing to "/". When you request the path (request.getContextPath(); ) it does not prepend the path with a "/" and if you try to use something like <c:url context="${ _path }"
if the the _path variable does not begin with a "/" it will throw an exception.
That last bit was something I encountered from working with someone else's code.
In application.xml specify the below setting
<web>
<web-uri>yourweb.war</web-uri>
<context-root>/</context-root>
</web>
Now you can make a call without context root as
http://localhost:7001/
I assume because you are using weblogic you deploy a java application.
The structure should be a 'war' file.
More info on the structure you can find here.
http://www.openscope.net/2010/01/25/war-deployment-file-structure/
The name of the context root (by default name of the war) might be as well overridden
https://forums.oracle.com/forums/thread.jspa?messageID=10366462
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With