Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
534 views
in Technique[技术] by (71.8m points)

jsf - Can alternatedocroot property be defined in Payara/GlassFish server?

I am using Payara Server, Community Edition, and wish to define an alternatedocroot property so as to serve a web page defined outside my application. I can make this work by adding a property to glassfish-web.xml, such as:

<property name="alternatedocroot_1" value="from=/tutorials/* dir=C:srvExtSTAR"/>

However, I'm running into an issue because while my application is developed under Windows, it is deployed to Linux, so I need a different path for the value of the "dir" attribute depending on whether I'm trying to run the application in my development environment or build it for deployment. My hope is that instead of defining the property in my application, I could instead add it to the server configuration. However, while I did see a hint somewhere that that could be done, I have been unable to make it happen. Is this possible to do, and if not, is there any alternative strategy available that would let me accommodate both my development and deployment environments without having to remember to change the configuration when that's necessary?

EDIT: There is actually documentation here that indicates this can be done, but I am still unable to make it work this way.

question from:https://stackoverflow.com/questions/65893756/can-alternatedocroot-property-be-defined-in-payara-glassfish-server

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I answered my own question on the accident of having to rebuild my environment due to a disk crash. Under Linux, I use the following definition for the alternatedocroot_1 property:

  <property name="alternatedocroot_1" value="from=/tutorials/* dir=/srv/ExtSTAR"/>

Upon trying to run the application under Windows, that would fail because that directory cannot be found. The error in server.log told me it was looking for the /srv/ExtSTAR directory within the domain directory. So all I needed to do was create that directory structure within the domain directory and voila, no errors when I run in my development environment.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...