简体   繁体   中英

Wildfly Deployment going to temp folder

I am facing a little strange issue while deploying web service to WAR file.

If I deploy the application via Netbeans IDE it is going under \\standalone\\deployments directory.

However, if I deploy the war file from Admin Console it is always getting deployed at \\standalone\\tmp directory.

Please guide on this issue. The deployment should go under \\standalone\\deployments directory only.

The deployment should go under \\standalone\\deployments directory only

You are quite not right.

It is not an issue. It is what it is.

  • standalone/deployment folder stand there only for "hot-deployment" functionality available only with standalone mode. So, Netbeans uses it. You can do the same just by saving EAR or WAR into standalone/deployment and server will pick it. (default scan interval is 5 sec.)
  • but Admin console or CLI is only (and standard) way to deploy application on domain. In domain mode deployment folder is not in use and there is no deployment scanner. Then when you use console it goes common way - deploys as on domain regardless is it domain or standalone server.

Updated / follow-up:

In general it is better to keep .properties file(s) out of deployment, in separate location. It is main idea behind them - to be able to change properties without application rebuilding and redeploying. Usually properties are different in different environments (DEV/UAT/PROD)

So there are 2 most popular solutions:

  • store properties in different location add that location to class path and access them through ClassLoader.getResourceAsStream() mechanism

  • store properties in different location, pass that location through system (or -D) variable and access them as file. for JBoss you can place your .properties under configuration directory. there is already JBoss variable. Kind of jboss.config.dir (or such, you can find it in Admin console, I do not have JBoss right now).

But of course sometime it still needed to access resources inside WAR/EAR - in that situation it is pretty much the same as first solution above.

Just be sure your .properties file(s) are accessible through to ClassLoader (in class path) and use them from ClassLoader.getResourceAsStream (or if you use Spring point it as "classpath:" not as "file:".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM