payara / Payara-Examples

Repository for Example Code to demonstrate Payara specific features
144 stars 177 forks source link

setAlternateDomainXML #27

Closed pmarijan closed 8 years ago

pmarijan commented 8 years ago

Somehow I can't make it work to set alternate domain.xml programaticaly. Is it possible to get the working example?

I allways get this error

Could not rename /some_path/microdomain.xml to /tmp/gfembed4607422639911715601tmp/config/domain.xml.bak

mikecroft commented 8 years ago

The problem here is due to permissions. Payara makes a backup of the domain.xml so that you always have a copy to restore to if something goes wrong. The default temporary directory is /tmp, so if it doesn't have write permissions there, or on the original domain.xml, you might see an error like this.

You can change the temp directory by setting -Djava.io.tmpdir=/my/new/path which may help. If not, please upload the log file and I'll take a closer look.

mikecroft commented 8 years ago

Could I also ask exactly what the symptoms were? You say you couldn't make it work, but how did it fail? Did Payara Micro completely fail to start, or did it start with the default domain.xml?

pmarijan commented 8 years ago

Payara Micro started but with error I posted above and it didn't fail completely...I hadn't checked if it started with default domain.xml.

Solution you suggested worked, I just added System.setProperty("java.io.tmpdir", "/my/folder"); at the beginning of my application.

mikecroft commented 8 years ago

Excellent, thanks!

kissoid commented 7 years ago

i have same problem and i will try to change temp folder.